fields in a select query

  • Thread starter Thread starter junk186d
  • Start date Start date
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?
 
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.
 
Back
Top