Can a Sharepoint Web Database Lookup Field use a query? - ms-access

I'm working with this table and want to offer the user a Lookup list in one column. I can do this easy if I want to use a whole table.
But I want to show in this lookup just a subset of data.
Like this: SELECT ID, Name FROM Items WHERE Type = 'SomeType'
I have a query, but when I go into Lookup Wizard, I cannot select Queries. Why is this?
This is Sharepoint 2010, editing the Web Database in Access.

If you build a continues form then you would simply drop in a combo box control for one of the columns and then you can build your SQL as you have using the query builder.
For most access applications it really never was very practical to allow users to open and edit data by using tables directly anyway.
And for published web applications you not even allowed to do as such on the web side (so you can edit tables client side, but not web side in a browser).
Using a continues form here should work just fine. So drop in a combo box, build your query as you have. Set number of columns to 2 and bind this combo box to whatever the underlying column is that this first ID value is to be saved to, and you off to the races.

Related

Access 2016 drop-down list appearing in Reports and Queries

In Access 2016 I have a table called 'Orders'.
I also have a Form (also called 'Orders') that we use to enter order information. On the form, one field in particular ('Company') is a drop-down list. The control source is a second table called 'Companies'. And the Row Source is a SQL Query:
SELECT [Companies].[ID], [Companies].[CompanyName] FROM Companies ORDER BY [CompanyName];
So, when the user is entering an order into the Form, he/she can select the company name from this drop-down list and it in turn updates the Orders table. All basic stuff, and it works fine.
Next, I created a query (also called 'Orders') and it is based off of the Orders table.
When I run the query in Access and view it as a Datasheet, I was surprised to notice that the Company field (IN THE QUERY datasheet) is a drop-down list. Not only that, it even lets me change the value - right here in the query! If I view the SQL for this query, I can see that it is a SELECT query. In my mind, a SELECT query is read only. So my questions are - What's a drop-down list doing in a Query, and WHY does Access let me edit the values directly in the query? Isn't this supposed to be read only?
Next question:
After verifying that all of the data I need is in the Orders query, I then created a report (called 'All Orders') and the control source for this report is the Orders query. (not the table).
When I view the Report in Design view, there's the drop-down list again. Why? I am just looking to add the Company name that the user selected when they completed the form. I realize that the form Control for entering that data (on the FORM) is a drop-down list. But here I am building a report and I just want the VALUE to appear here. Not the drop down control? (I know that when I print the report or view it on the screen, the drop-down boxes go away and all I see is the actual text). But my question is - WHY is Access showing me a drop-down list control on a report? and in a select query? The query and the report are no place for editing data. I just want the value that was selected.
That's because you've defined the lookup list in the table. If you do so, it propagates to queries and new reports and forms, and will be the default way to view the data everywhere you've placed it.
Open your table in design view, and change the display control for your field back to text box. Note that any forms and reports will need to be edited or recreated, for queries the change should propagate.

Can a report be built in Access where users select the fields they want then create said report?

I have an Access database which I have restricted for end users as I do not want them interfering with tables, queries and the like.
Is it possible to develop a tool so that users can select the fields they want to include in a report and then produce said report themselves?
Effectively, I mostly want to replicate the Query Builder function in Access because users do not have access to this due to the (necessary) system restrictions that I have put in place.
Ideally, this is how it will work. End users will:
Open Report function and are presented with a list of tables
Choose required fields.
Add criteria.
Run report.
Can this be / has something like this been done? Does anyone have any examples of such a feature?

Access Form Field Logic

I'm trying to make access conditionally only show rows that meet a certain condition, allow me to give you some background info before I proceed :
I've created an Access form and linked it to a test DB on my machine. The particular table I am interested in contains the following (important) rows :
ID , Office, Name, SecurityNumber
The thing is, ID is not unique. There are two Office locations, and each Office has it's own set of unique ID numbers. This means that ID 10 here and there may or may not be the same person. (this data comes out of a legacy security system we're not looking to change yet, so I cannot change it)
But ID -is- unique to each Office.
SO! I created an Access form with TABS! Two tabs, one for each office. What I am trying to achieve now is :
Have the ID/Name/SecurityNumber fields for each tab populate with only rows that match it's particular 'Office' value.
Thank you for reading and thank you for helping! :D
If you want the data for the office locations presented in separate tab page controls, you could use subforms on the pages which differ only in the WHERE clause of the queries used as their record sources. So for the Office1 subform, the query could be:
SELECT ID, Office, [Name], SecurityNumber
FROM YourTable
WHERE Office = 'Office1'
ORDER BY [Name];
Then for Office2, the query would be the same except for the WHERE clause:
WHERE Office = 'Office2'
As I understand your question, that approach would do what you're asking for.
However, that's not really the easy "Access way" to do it. Instead consider a combo box control to allow your users to choose which office they want to view. In the code for the combo's after update event, either modify the SELECT statement used as the form's record source or create a filter expression an apply it.
Also, since you're pulling the form's data from SQL Server, consider whether you want your form to load every record for the selected office location. It may not be much concern if you have only a few to moderate number of rows for each location, but if you'll be dealing with multiple thousands of rows it could be. In general, you should try to avoid pulling copious amounts of data across the wire; pull sparingly instead ... only what you need for the immediate task at hand.

MS Access Report showing the id of the combobox and not the bound name column

The company I work for have an access database that is linked to a sql server table. The database is on a shared network location so it is used by lots of people in the company (with the annoying problem that only one person can use it at a time).
There are several forms that are used as a front end for the data and on one particular form there are combo boxes that are linked to other tables.
When a report is generated on the form the ID of the combobox is on the form (a GUID) and not the bound item of the combobox.
How can I get the bound items to appear on the form itself? The solution needs to be easy to do or something i can produce that can be regenerated as it's used by non technical people.
In order to make the database usable by many, simply give each user a copy of the front-end.
Forms should almost never be used for reports, the best thing to do is to build a query (the query design window will help) that references each of the relevant tables, for example, if the combobox contained a reference to person type and you might build a query like this for your report:
SELECT a.ID, a.SName, a.MainAddress, c.PersonType
FROM Addresses a
INNER JOIN PersonTypes c ''Or LEFT JOIN if data is missing
ON a.PersonTypeKey = c.PersonTypeKey
If this is not possible, perhaps you could explain in more detail exactly how the report is generated from the form.

checked list box

I am new to Access and i am in the process of creating a database for some of our users. I have designed a form where the user name, first and last name etc are inputted.
Some of these users work for more than one department which means I need some type of listbox control that allows them to select more than one department when they enter their contact info.
In VB Studios 2005, this control is called a CHECKED LISTBOX. I have looked everywhere in access but cant seem to find it or anything closely similar.
The option of a listbox or combobox is not feasible here as these only allow the user to select one option only when inputting their details. Any help with this is much appreciated.
Use an ordinary list box with the "Multi Select" property set to "Simple".
The user can then click multiple list items, all of which stay selected until they un-select them again.
You may wish to consider a subform, as this will save you the trouble of updating a table with the data from a list box. A subform can use a department-person junction table with person id as the linked child field and master field. A combobox bound to department id will allow the user to select departments.
If you are really set on having checkboxes, Stephen Lebans has a sample database that uses the built-in Access listbox with checkboxes (from one of the Access wizards).
There is another choice:
If you are using Access 2007, you can declare your field as a lookup field accepting multiple values.
When you bind the list box to that field, you will get checkboxes.
It's easy to use them.
You'll also find more information is available from the MS Office website.
However, note:
This is only possible in the new Access 2007 database format and you will not be able to save your database to the older MDB format.
Multiple value fields are not compatible with most other databases, meaning that if you decide one day to upsize to SQL Server, you'll have to redesign your tables to use a junction table as Remou mentioned.
These multi-value fields are difficult to use from VBA: the value they return is in fact another recordset that you must iterate through to get all the values.
Having said that, if you just want something simple and you're not planning on manipulating the database from code, then it can be a practical option, albeit not a very compatible or future-proof one.
I'm not using them, but I think others should be able make their own decision knowing what is available to them.