Syntax with quotations / DLookup
I've been attempting to use DLookup in a function i'm writing and had many problems getting it to work properly. My first attempt after reading the MS help file was:
Which didnt work... So i tried all manner of variations of putting:
"[UserID] = ' & strUserID & '") for the criteria as well as many others. Basically just trying to fiddle with it until it worked, right?
Well none of that worked so i searched aruond on the forums and found a poster who was using Dlookup in a similar manner. Their code was:
Which, when i plugged this in, it worked perfectly. My question is about the syntax of the single and double quotations. This isnt the first time I've been stuck on this and I think I'm missing some fundamental understanding here, so any explanation would help. Why does it have to be in this manner to work? Why is there a Double then Single then Double Qutation instead of a Double then Double then Single?
Both UserName and UserID are text fields.
Thanks! Guy
I've been attempting to use DLookup in a function i'm writing and had many problems getting it to work properly. My first attempt after reading the MS help file was:
Code:
[B][COLOR=red]?Dlookup("[UserName]","tbl_AuthUserList","[UserID] = strUserID")[/COLOR][/B]
"[UserID] = ' & strUserID & '") for the criteria as well as many others. Basically just trying to fiddle with it until it worked, right?
Well none of that worked so i searched aruond on the forums and found a poster who was using Dlookup in a similar manner. Their code was:
Code:
[B][COLOR=blue]?DLookup("[UserName]", "tbl_AuthUserList", "[UserID] = '" & strUserID & "'")[/COLOR][/B]
Both UserName and UserID are text fields.
Thanks! Guy
Last edited: