How do i make a query with fields taken from a form?

T

Tom

Can a query be made with the field names chosen in a dropdown box in a form?

I want to be able to run the same query over multiple different tables with
different names, but i cannot change the tables. So i want to be able to
choose the columns in a form, to be used in a query.

Thanks

Tom
 
J

John Spencer

You can do this by writing the SQL string in VBA and assigning the
created SQL string to the query.

It is not simple and can be complex to do. How much time do you want to
devote to doing this?

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
J

John W. Vinson

Can a query be made with the field names chosen in a dropdown box in a form?

I want to be able to run the same query over multiple different tables with
different names, but i cannot change the tables. So i want to be able to
choose the columns in a form, to be used in a query.

Thanks

Tom

You'll need to actually build the SQL string in VBA code.

The need to do this strongly suggests that your database is incorrectly
normalized, but I'm guessing you already know that...

Could you perhaps instead use a UNION query to string all the tables together
so you can search them all together? What's the structure of your database,
and why do you have multiple tables with the same fields?
 
Top