Hi.
Another very simple one for the font of all knowledge. I have the following code which works perfectly:
Code:
'Return the ID of the matching UserName
varUserID = DLookup("[ID]", "tblDBUsers", "[UserName] = 'test1'")
However, I obviously don't want to hardcode the 'test1' into the expression. The following variations on using a variable fail:
Code:
varUserID = DLookup("[ID]", "tblDBUsers", "[UserName] = " & varUserName)
varUserID = DLookup("[ID]", "tblDBUsers", "[UserName] = varUserName")
varUserID = DLookup("[ID]", "tblDBUsers", "[UserName] = 'varUserName'")
varUserName is a string variable which has been earlier retrieved from a text box and I know it has the correct content by using the debug step through system and watching the variable(s).
How should this be phrased correctly please? Yes, I am working through this by trial and error. Thanks.
Mike.