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

Passing a paramater of a column name 1

Status
Not open for further replies.

hcisteve

Technical User
Jan 12, 2005
47
US
In the following SQL statement below I want to be able to pass a parameter of a column name after the WHERE statement -- see below.

SQL2 = "INSERT INTO SelectedEmployees ( ID, Region, SID, ccMailName, DomainAddress) "
SQL2 = SQL2 + "SELECT ActiveEmployeesWithEmailTest.ID, ActiveEmployeesWithEmailTest.Region, ActiveEmployeesWithEmailTest.SID, ActiveEmployeesWithEmailTest.ccMailName, ActiveEmployeesWithEmailTest.DomainAddress "
SQL2 = SQL2 + " FROM ActiveEmployeesWithEmailTest "
SQL2 = SQL2 + "WHERE (((ActiveEmployeesWithEmailTest.Title)= " & Chr$(39) & Selection & Chr$(39) & "))"

So,what I want to be able to do is to pass a parameter so that ActiveEmployeesWithEmailTest.Title after the WHERE statement could be some other column in the ActiveEmployeesWithEmailTest table.
 
Something like this ?
SQL2 = SQL2 + "WHERE ActiveEmployeesWithEmailTest.[" & varParameter & "]='" & Selection & "'"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top