combo box in Query

mithani

Registered User.
Local time
Tomorrow, 10:42
Joined
May 11, 2007
Messages
291
Dear Friends,

I have made one query. To get the particular data, I entered ["Project Code"] in criteria of project_code. What I am looking that instead of entering project code, I have to have comobo box. So whenever I run my query I select project code instead of writting project code. I have tried this code =Forms!YourFormName!YourComboBoxName but not working.

can you help me please

mithani
 
I have tried this code =Forms!YourFormName!YourComboBoxName but not working.
This is the correct syntax. But for this to work you have to create your own form and have a combo box on that form. You then substitute the names of your form and your combo in the statement. The form also has to be open at the time the query runs. So the code might look like

=Forms!frmUserInput!cboProjectCode
 
thanks neileg, when I open form and run query, query runs straight away, not taking care of criteria. any help

thanks

mithani
 
Last edited:
hi neileg,

my SQL query:

SELECT STATUS.PROJECT_CODE, PROJECT.PROJECT_NAME, STATUS.ITEM_CODE, STATUS.ITEM, STATUS.FINISH, STATUS.QTY, STATUS.UNIT, STATUS.PCS, STATUS.SUPPLIER_CODE, supplier.supplier, STATUS.CONTACT, STATUS.ORDER, STATUS.ORDER_DATE, STATUS.FI_ORDER_NO
FROM (STATUS INNER JOIN PROJECT ON STATUS.PROJECT_CODE = PROJECT.PROJECT_CODE) INNER JOIN supplier ON STATUS.SUPPLIER_CODE = supplier.supplier_code
WHERE (((STATUS.PROJECT_CODE)=[Forms]![master]![cboProjectCode]))
ORDER BY STATUS.ITEM_CODE, STATUS.SUPPLIER_CODE;
thanks
 
I can't see anything wrong with that!

Are you saying that the query returns the same results no matter what is selected in cboProjectCode?
 

Users who are viewing this thread

Back
Top Bottom