I've been working on this for a couple of days and I can't find the syntax error. It worked earlier on another machine but not on my laptop.
Error message:
Syntax error in string in query expression 'AreaID = 1 And MachineName = 'KATHY-PC'
Code:
Dim vMachineName As String
Set recName = db.OpenRecordset("SELECT UserId FROM tblLoggedOn Where AreaID = 1 And MachineName = '" & vMachineName & "'")
Error message:
Syntax error in string in query expression 'AreaID = 1 And MachineName = 'KATHY-PC'
Code:
Dim vMachineName As String
Set recName = db.OpenRecordset("SELECT UserId FROM tblLoggedOn Where AreaID = 1 And MachineName = '" & vMachineName & "'")