T
TheUbe
I am trying to use a variable in a SET RST statement in the WHERE clause.
Even though I assign the value, when I run the code the record set returns
zero records. If I type in WHERE (((tblstudents.group) = '6'))")
it works. Any suggestions why the variable fails.
Dim strGroupIn As String
strGroupIn = "6"
Dim Rst As Recordset
Dim MyDb As Database
Set MyDb = CurrentDb()
Set Rst = MyDb.OpenRecordset("SELECT tblstudents.* FROM tblStudents WHERE
(((tblstudents.group) = '&strgroupin&'))")
Even though I assign the value, when I run the code the record set returns
zero records. If I type in WHERE (((tblstudents.group) = '6'))")
it works. Any suggestions why the variable fails.
Dim strGroupIn As String
strGroupIn = "6"
Dim Rst As Recordset
Dim MyDb As Database
Set MyDb = CurrentDb()
Set Rst = MyDb.OpenRecordset("SELECT tblstudents.* FROM tblStudents WHERE
(((tblstudents.group) = '&strgroupin&'))")