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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add a query criteria from a combo box

Status
Not open for further replies.

hany111

Technical User
Mar 20, 2004
2
IL
I am trying to build a query that includes a criteria.the criteria's parameter should be a value choosen in a combo box. the combo box is in a form.
can anyone guide me how to do it?
 
Try this as an example:

Code:
Select * FROM [red]tblYourTableName[/red] as A WHERE A.[[red]SelectField[/red]] = FORMS![[red]frmFormName[/red]]![[red]cboComboBoxName[/red]];

This is relying upon the Bound column in the combobox being the value of the field that you wish to select on.

Post back if you have further questions.

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
first of all - thank you Bob.
i've tried your suggestion and still i get the pop-up message asking me to fill the value of the parameter (the text that apears in the pop up message is whatever I write in the brackets of the SQL line ...![Form_Name]!...).
When I'm calling the query from a form using a 'command button' I get the following message:
" the expression on click you entered as the event property setting produced the following error : a problem accured while microsoft access was comunicating with the OLE server or ActiveX control"
do you have any ideas how can i solve these problems?
thanks again,
hany
 
What is the name of your form with the combobox on it? That is the name that you should put between the brackets. Then the next box should be the name of the combobox control.

Please post your SQL code for you query and answer the above questions.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top