Drop down list for queries

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to set up a query to do two things. First when the query is
executed the user will have to choose from a drop down box with some names of
some workers (this is so there are no spelling discrepencies). Then after
choosing a name the query will bring up the the four most recent records for
the worker. I know that I can call for the user to enter the name manually by
[Enter Worker Name:] but I cannot figure out how to get a drop down box. Any
help would be greatly appreciated. Thanks.
 
Parameters cannot be drop-down boxes. You have to use a form for that.

Create a small unbound form, with a combo named (say) cboWorker.
Save the form as frmWorker.
Choose the worker in the combo.

In the Criteria row of your query, under the correct field, enter:
[Forms].[frmWorker].[cboWorker]
 
Thank you very much for the info. I tried doing everything you just said with
the names you suggested and when I put in the

[Forms].[frmWorker].[cboWorker]

string into the query design view criteria and then run the query, all that
shows up is a blank text box with "[Forms].[frmWorker].[cboWorker]" as the
title. Do I have to set something up before doing this? Thanks a lot.



Allen Browne said:
Parameters cannot be drop-down boxes. You have to use a form for that.

Create a small unbound form, with a combo named (say) cboWorker.
Save the form as frmWorker.
Choose the worker in the combo.

In the Criteria row of your query, under the correct field, enter:
[Forms].[frmWorker].[cboWorker]

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Jamil Afza said:
I am trying to set up a query to do two things. First when the query is
executed the user will have to choose from a drop down box with some names
of
some workers (this is so there are no spelling discrepencies). Then after
choosing a name the query will bring up the the four most recent records
for
the worker. I know that I can call for the user to enter the name manually
by
[Enter Worker Name:] but I cannot figure out how to get a drop down box.
Any
help would be greatly appreciated. Thanks.
 
Add a command button to your form and put this code in the Command1_Click
event.


DoCmd.OpenQuery "Query1", acNormal, acEdit
(change "query1" to the actual name of your query.)

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
| Thank you very much for the info. I tried doing everything you just said
with
| the names you suggested and when I put in the
|
| [Forms].[frmWorker].[cboWorker]
|
| string into the query design view criteria and then run the query, all
that
| shows up is a blank text box with "[Forms].[frmWorker].[cboWorker]" as the
| title. Do I have to set something up before doing this? Thanks a lot.
 
There's a slight typo in Allen's criteria. It should be:

[Forms]![frmWorker].[cboWorker]
--
Marsh
MVP [MS Access]



Jamil said:
Thank you very much for the info. I tried doing everything you just said with
the names you suggested and when I put in the

[Forms].[frmWorker].[cboWorker]

string into the query design view criteria and then run the query, all that
shows up is a blank text box with "[Forms].[frmWorker].[cboWorker]" as the
title. Do I have to set something up before doing this?


Allen Browne said:
Parameters cannot be drop-down boxes. You have to use a form for that.

Create a small unbound form, with a combo named (say) cboWorker.
Save the form as frmWorker.
Choose the worker in the combo.

In the Criteria row of your query, under the correct field, enter:
[Forms].[frmWorker].[cboWorker]


Jamil Afza said:
I am trying to set up a query to do two things. First when the query is
executed the user will have to choose from a drop down box with some names
of
some workers (this is so there are no spelling discrepencies). Then after
choosing a name the query will bring up the the four most recent records
for
the worker. I know that I can call for the user to enter the name manually
by
[Enter Worker Name:] but I cannot figure out how to get a drop down box.
Any
help would be greatly appreciated. Thanks.
 
Back
Top