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!

search function - parameter query

Status
Not open for further replies.

gscma1

Technical User
Jun 27, 2006
94
GB
My database uses various parameter queries where the user must input a code to return the required results e.g.

parameter query : enter employee id:

This would then bring up details on that employee.

is it possible to have a search facility for the user to enable them to for example press f2 at the parameter to bring up the list of all codes?

there are often some 50 or 60 codes therefore it is highly unlikely any employee will know them all off by heart. some sort of search function whihc brings up a report of codes would be ideal.

could anyone tell me if this is possible

many thanks
 
create a form with a combobox
coulmns=2
coulmswiths=0";3"
boundcolumn=1
rowsource=

Select employeeid, employeename from Employeetable

create a command button in the onclick

docommand.openquery "queryname"

change parameter to employeeid=forms!formname!controlname
 
thanks, thats great.

i've set this up however, i'm having trouble with the parameter bit

change parameter to employeeid=forms!formname!controlname

i have replaced 'enter employee id:' with the above however it does not seem to bring up my new form when i open the report i simply get a parameter box with 'forms!formname!controlname' in it.

any ideas?
 
You have to run the form first Select the employee that you want and press the command button to run the query
 
i now have a message when i select the command button saying:

Database can't find the macro 'docommand.'
the macro (or its macro group) doesn't exist, or the macro is new but hasnt been saved.

 
baffled by this.

i have a combo box which selects my id, then i have a 'go!' button which in theory should run my query and open the report however, the on click event procedure DoCmd.OpenQuery"QryEmployee" doesn't work and i assume will not produce a report.

could anyone help me with this one?

many thanks
 
Provided the Report is based on the query referencing the combo, simply launch the report:
DoCmd.OpenReport ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
thanks for the help guys, its working great now
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top