fields in a select query

J

junk186d

Can the target fields of a select query be specified by the values in
a table or the results of another query?

Here's the essential sql statement I want to execute:

SELECT field1, field2, field6, field8
FROM table1;

And table2 looks like this:

fieldNum fieldName
1 field1
2 field2
3 field6
4 field8

So can I use the values in fieldName from table2 to select the fields
from table1 in the select query?

If so, how?
 
A

Allen Browne

No. You would have to generate the SQL statement dynamically, using
OpenRecordSet on Table2, and looping through the records to build up the
SELECT clause of the SQL string.
 

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