Phil4tektips
Technical User
I've got this code:
If ([Reported by] = ".") Then
[User Opened] = strUserName
[Project] = DLookup("[Project]", "Reported by List", "[Clock Number] = 's02506'")
End If
The code above is correct for looking up a text string and works. Trouble is I need the criteria of the DLOOKUP to be a string name called 'strUserName' which is actually assigned by looking at the users login details.
I tried changing criteria to:
"[Clock Number] = 'strUserName'"), but that fails because it just looking for the text strUserName rather than what is assigned to strUserName which is s02506.
I've also tried:
"[Clock Number] = '" & Forms![Main Data form]![User Opened] & "'")
In other words lookup up the text string from a field on the form. But the error is: "Syntax error in string in query expression '[Clock Number] = 's02506'.
Any ideas on how to code this correctly?
Thanks!!
-Phil4tektips-
If ([Reported by] = ".") Then
[User Opened] = strUserName
[Project] = DLookup("[Project]", "Reported by List", "[Clock Number] = 's02506'")
End If
The code above is correct for looking up a text string and works. Trouble is I need the criteria of the DLOOKUP to be a string name called 'strUserName' which is actually assigned by looking at the users login details.
I tried changing criteria to:
"[Clock Number] = 'strUserName'"), but that fails because it just looking for the text strUserName rather than what is assigned to strUserName which is s02506.
I've also tried:
"[Clock Number] = '" & Forms![Main Data form]![User Opened] & "'")
In other words lookup up the text string from a field on the form. But the error is: "Syntax error in string in query expression '[Clock Number] = 's02506'.
Any ideas on how to code this correctly?
Thanks!!
-Phil4tektips-