When I run a query from a switchboard in order to narrow down my customer list I have to type exactly what I want. Now is there a way fo Access to take the info from those fields and create a drop down right in the query?
You could create a combobox with the required list
the in the criteria of that query have it point to the ComboBox for example:
Criteria = Forms!Form_Name!ComboBox.Colunm(1)
Colunm(1) is under the assumption that you have the Key Field hidden or in other words you have to fields in your ComboBox. If not then select Colunm(0)
then on the AfterUpdate_Event of the ComboBox Run the Query.
Was your question about defining the criteria or having a dropdown list of values to select as criteria?
ToeShot's guidance will define the criteria for the query.
If you want a dropdown on your switchboard so you don't have to type, add a combo box with the wizard.
In answer to the questions the wizard asks:
1.) You want the combo box to look up the values in a table or query. Next >
2.) Select the View Queries radio button and select your query. Next >
3.) Select the field you want displayed. Next >
4.) Adjust the width of the column. Next >
5.) You want to "Remember the value for later use.' Next >
6.) Type in the label caption. Finish >
In the Properties pane, Data tab, look at the Combo Box's Row Source. EG:
Code:
SELECT DISTINCTROW[qryCustomerAddress].[PostalCode] FROM [qryCustomerAddress]
To eliminate the repeated values in the list, change the word DISTINCTROW to DISTINCT.
Does anyone know if you can accomplish this in a regular parameter query? (ie not based from a switchboard)
I have some lengthy names of locations in a table (that are to be used as criteria for a query) and I know that people are bound to make errors in entering the parameter if they are left to their own devices. I can't get anything other than a blank space there and I have also tried creating my own form (with the drop down box on it) and attaching that to the criteria in the query and I can't seem to make that work, either. If I put this in the query:
Criteria = Forms!Form_Name!ComboBox.Colunm(1)
I get a parameter box with a blank and Forms!Form_Name!ComboBox.Colunm(1) as the caption.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.