Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query field references second query for string variable

Status
Not open for further replies.

KalEl33

Programmer
May 20, 2002
17
US
I am trying to create a SQL statement in my query that will get a string from another query (Here query2) and use that string to change the field name within the SQL statement. In the example below I want the query to substitute the field ChangeMe to the string from query2.

SELECT query1.[ChangeMe], query1.[Something], query1.[SomethingElse] FROM query1;

__1st__GUESS___________________________________________
My first guess was to use DLookup to retrieve the string from a table and then place that string in the SQL statement.

SELECT query1.[(DLookup("[String]", "tblString)]
FROM query 1;

This attempt didn't work, but it illustrates what I'm trying to achieve. Any ideas on how I can achieve this goal?

Thanks in advance for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top