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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Column Name As Parameter

Status
Not open for further replies.

meinhunna

Programmer
Jul 31, 2004
118
AU

In MS-Access, is it possible to pass column name as a parameter for Select query

say for example i can do this in SQL Server

SELECT @ColumnName
FROM tableName
 
If you create a simple query, you can then look at it's SQL equivalent. Here's an example with Table = "CallData" and field = "UseCode":


Code:
SELECT CallData.UseCode
FROM CallData;


Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
You can write a function that modifies the SQL for a query but within a query the columns and table names cannot be parameters.

You could use IIf to get different column values based on a parameter but it's not as flexible as using a function and the column heading would still be static.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top