View Full Version : Setting an event on a form combo box...


DawnC
08-31-2001, 11:44 AM
When I enter the criteria for my query as =[Forms]![Choose Customer]![CustomerName] (I am trying to link it to an unbound form to make a dropdown box for the user to choose query criteria from), all I get is a parameter query box that is asking for typed input.

I think my problem lies with linking the unbound form and the query using the "OnChange" event.

I need help with the way to phrase the event on the "OnChange" of a combo box to make it run the query.

Any help would be great. I figure this out and everything else will fly!!!

jwindon
08-31-2001, 02:13 PM
You should be using the FORM first, not the query. On the OnChange: Set the event to run the query. Put the Code on the Event in Code Builder.

DoCmd.OpenQuery "qryBasedOnSearchForm", acViewNormal, acEdit

That will do the trick.

R. Hicks
08-31-2001, 02:56 PM
Do not use the On Change event of the control to do this. The query will execute everytime you type in a character. You need to either use the After Update event of the control or simply add a cmdButton to trigger the execution of the query.

Also this form will have to remain open until the query references the control for the criteria. Then you can close it with code if needed.

HTH
RDH