dynamic combobox query

patfee

New member
Local time
Today, 09:58
Joined
Jul 10, 2009
Messages
4
hi,
im trying to develop a dynamic query depending on the data from a combobox.

i managed to get this working using the LIKE * & CMBBOX & * criteria.

but the *.* criteria is a little to wide. supose i use a combobox listing the client id's.

If i select a client id 3 my query retruns all clients who include a 3 in there id. so also 13 and 31 one and 113 etc.

is there a way to avoid this please?

thanks:)
 
Just use

= CMBBOX
 
using CMBBOX does not really work either.

If i make no selection on the CMBBOX, my query is not responding any results.

And i wish to use the CMBBOX to narrow down the query results.

Or am i doing something wrong here?

Thanks
 
If your combo box is named CMBBOX then, no. But if your combo box is named something else then you have to use the actual name of the combo box. And, you might need to include the form name:

=[Forms]![YourFormnameHere]![YourComboBoxNameHere]

Do not replace any of the blue parts, but replace the black parts above with your actual form and combo box names.
 
I'm completely lost here.... ;-)

i have an unbound form UFORM with a combobox CMB_CLIENT
the CMB_CLIENT is bound to the ID_CLIENT in my TBL_CLIENT

on the UFORM i have a SUB_UFORM which is bount to a query qry_TEST
the qry_TEST is:
SELECT * FROM TBL_CLIENT
WHERE ID_CLIENT= Forms!UFORM!CMB_CLIENT;

if i change my CMB_CLIENT and requery the SUB_UFORM everything works nicely and only the selected client is shown

but when i open the fresh form, and no CMB_CLIENT is selected, the SUB_UFORM is not returning any results.

Whereas i whish to show ALL the clients

anything wrong here?
 
Hi Dear,

I'm completely lost here.... ;-)

i have an unbound form UFORM with a combobox CMB_CLIENT
the CMB_CLIENT is bound to the ID_CLIENT in my TBL_CLIENT

on the UFORM i have a SUB_UFORM which is bount to a query qry_TEST
the qry_TEST is:
SELECT * FROM TBL_CLIENT
WHERE ID_CLIENT= Forms!UFORM!CMB_CLIENT;

if i change my CMB_CLIENT and requery the SUB_UFORM everything works nicely and only the selected client is shown

but when i open the fresh form, and no CMB_CLIENT is selected, the SUB_UFORM is not returning any results.

Whereas i whish to show ALL the clients

anything wrong here?

the reason could be that you are using the query in which you set the criteria i.e. =[Forms]![YourFormnameHere]![YourComboBoxNameHere]
If you dont want to filter any data then use simple query or delete the criteria from the query you are using in your new form... Just try...
 
is it possible to delete the Query criteria by for instance using an On Change event from a combo box in a form?

thanks
Patrick
 
well use the simplest method to use that query....

1. Open the query in design mode and locate the criteria in you desire field like ID_CLIENT and then delete it by selecting all text from criteria field.

2. Just remove the WHERE clause from your query expression, like "where ID_CLIENT= ......." what ever........
 

Users who are viewing this thread

Back
Top Bottom