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.
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.