wilnah
asked on
Passing varaible into SQL statement
I want to pass in a variable to replace the field name of a table. I need the correct syntax. i.e.
Dim strsql As String, strdte As String
strdte = "9/24"
strsql = "SELECT tblenviroment.Enviroment, tblenviroment.(strsql) FROM tblenviroment WHERE (((tblenviroment.(strsql)) Is Not Null));"
Me.RecordSource = strsql
I need help with the - - tblenviroment.(strsql) syntax.
I tried tblenviroment. & [strsql] & - - among others with no luck.
Dim strsql As String, strdte As String
strdte = "9/24"
strsql = "SELECT tblenviroment.Enviroment, tblenviroment.(strsql) FROM tblenviroment WHERE (((tblenviroment.(strsql))
Me.RecordSource = strsql
I need help with the - - tblenviroment.(strsql) syntax.
I tried tblenviroment. & [strsql] & - - among others with no luck.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
strsql = "SELECT tblenviroment.Enviroment, tblenviroment.[" & strsql & "]" & " FROM tblenviroment WHERE (tblenviroment.[" & strsql & "]" & "
Is Not Null);"