Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of drop down lists in queries-how?

Status
Not open for further replies.

tosh124

Technical User
Jul 18, 2002
28
GB
I have a database in which I have set up some queries to search for property by property type. however the property types are entered from a look up table. I want to incorporate the look up table in the query so that people can only choose to query on the items in the look up table (maybe using list box, combo box or subform).
In addition once the data set has been compiled from the query I then need to incorporate the data into a list box with a form above so that once an address is selected from the list box the detail shows in the form above the list box.
my main issue is that I cannot get the query to work with a drop down so any help would be appreciated.
TIA
Colin
 
Well, I'll confess that I am confused by what you are doing. Is this a drop down you want to display in a raw query, or is it that you want to query against information in a drop down that is on a form?

If it is the former, go into the design veiw of the query. Then click into the dead space beneath the field you want to alter. Right click there, Properties and then you have a look up tab much like in a table.

If it is that you want to have a combo box on a form give only valid property types and that value, entered by the user, will in turn feed a query that populates a form, then it is a bit more work. I will type out the best explanation I can if you indicate that it is indeed your question. Brambojr
 
Hi Brambojr,
thanks for your reply. It is the second of your points that I am trying to do. This is to ensure that the query runs against valid data types that are pre-defined and the point of data entry.
TIA
Colin
 
I'll assume you have the form set up as well as a drop down box that returns the values you want since both of those items are set up well by the wizards.

Create a new query and make sure one of the fields you include is the same as that is contained in the drop down. I'd run it right now, simply to make sure everything looks right - I know it has too much info, but it's better to look first, you catch mistakes that way.

Ok, so everything looks fine. Open up the new query in design view, go to the criteria area of the field that will limit the records. Click into the cell, then right click, then build.

Off to the left, you can "surf" through everything that is in the Db. Double click forms, then the form you have the combo box on, then find THE combo box and double click it. You're done.

Try it. This should do the trick for you.

Let me know how it turns out. Brambojr
 
Hi Brambojr,
thanks for your reply. Sorry I haven't got back to you sooner but I am swamped at the moment.
I will have a bash with your suggestion next week when hopefully things will have cooled off a little.
thanks *very* much for your help.
cheers
Colin
 
Hi Brambojr
now I'm confused. I have tried both of the methods you have explained and not managed to get either working, so I must be doing something wrong.
I have created a query with the wizard without any selectors which returns all of the records(227).
One field in the query is the property type field which contains different types of properties. This field at the point of input is a lookup table which prevents the user entering any duff data. It is this field which I want to use to query the database.
For example if we have a form that is used for data input that has a drop down list under the field name of property type the data contained in the list has come from a related look up table.
In the lookup table there is a field called retail (picked from the drop down list), I want to be able to use the same drop down list (lookup table) to query the data and return all of the properties with the property type of retail. I do not want the surveyors to be able to enter their own property types as there are many different forms of classification, most of which are not verified by the Government.
apologies for the rambling mail but I am trying to explain the background behind my conundrum. I hope it makes sense!
;-)
thanks
Colin
 
Ok, at the bottom of the query area you see an area labelled "criteria." Click into this area underneath the property type field. Ok now right click there too. This will give you a list of things you can do - you want to build. Click that.

This will open up an expression builder. On the bottom left is a window. Double click forms, find the form you are working on, and click it. In the center window is a list of every control on that form (the combo boxes, text boxes, and yes even labels). Find teh query that the user will use to select the property type and double click that.

In the top window you should have all of the directions for the computer to find the value they have selected.

You will need to tell the computer to requery whatever controls are fed from this query (list box).

To do all that you may aspire to do on this form is no small task, and if you are just starting out, you may find this pretty frustrating and time consuming. Brambojr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top