Criteria in Queries

  • Thread starter Thread starter Les Wilcock
  • Start date Start date
L

Les Wilcock

Guest
Hi group members

I guess this is a fairly basic question but bear with me.

As with all newbies 'how can I' type questions come thick and fast and this one involves using Criteria in a Query. I am comfortable with the concept of prompting for a variable within a query using the square brackets ie.[Enter Post Town]. This of course relies on the person entering a valid value or spelling it right.

So I thought, what if I make Post Town a Combo box (I am working with a small sub set of places). Which then brings me to my question.

Can I create a query (which runs a report) that when activated will prompt for variable (in my case Town) and display the drop down list ?

Thanks in anticipation

Les Wilcock
 
Yes must be a way, its just the drop down list that im not too sure of how to create for a query!
 
If you create a query selects town from your table
Create a combo box on your form with a data source of the newly created query.
When you open the form and click on the combo box it will be populated with a list of towns

Then in the query that you have to produce your report place the following in the criteris section under the town field
forms![yourform]![yourcomboboxname]

(I would create a button on the form that calls your report,click on the button your report will run taking the town parameter from your form)
 
I use a LookUp table. I create a table that just contains Autonumber ID and the name of the towns you use. Then in the table, under the town field, change it to a combo box, or list box. And use your lookup table as the source. Then when you add it to your form etc, it will have the data ready for use. The only problem with this, is if you need a new town you have to add it to the table. If you want help setting this up let me know.
 

Users who are viewing this thread

Back
Top Bottom