Access Create Access query dynamically

Joined
Aug 30, 2009
Messages
1
Reaction score
0
I need to create a query dynamically
cbo1 ...Combo Box has row source= "Field List" from "table1"
txt1...Text box where the user will type
The user selects 'Field Name" in the combo and types a value in the text box

The query will keep changing based on selection of the field in the combo box

Select * from table1 where (field name selected in cbo1) LIKE [txt1]
when I try
Select * from table1 where forms!Form1![cbo1] LIKE [txt1] and type a value existing in the table...the query returns no records.
Looks like it is unable to understand that the value selected in the combo is a Field Name.

Eg: Field names in the table are Products,Country,date
then the possible queries should be based on cbo1 selection
Select * from table1 where [Products] LIKE [txt1]
Select * from table1 where [Country] LIKE [txt1]

and I want to set this as the Recordsource of a Subform

How do i do it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top