Syntax help with two dlookup with two string variables (1 Viewer)

latex88

Registered User.
Local time
Today, 00:04
Joined
Jul 10, 2003
Messages
198
I need help with dlookup based on two global string variable. Please help me fill in the ...........................

Public GstrVariable1 as String
Public GstrVariable2 as String

Result1 = dlookup("MyLookupField","MyTable", "[MyField] = .........................)
 

latex88

Registered User.
Local time
Today, 00:04
Joined
Jul 10, 2003
Messages
198
Hi Paul,

I've seen that page before, but I still can't figure it out.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 22:04
Joined
Aug 30, 2003
Messages
36,133
Did you figure it out? If not, what have you tried that's failed?
 

latex88

Registered User.
Local time
Today, 00:04
Joined
Jul 10, 2003
Messages
198
Sorry Paul, I was out for a few days on another project. I still have not figured it out. Based on the variables above, I've tried...
Result1 = dlookup("MyLookupField","MyTable", "Field1 = '" & GstrVariable1 & "'" and "Field2 = '" & GstrVariable2 & "'")

I get Type Mismatch error message. I know the fields and the variables are text/string type, so I suspect it's the syntax, which I can't ever understand them whenever I use more than one condition.
 

JHB

Have been here a while
Local time
Today, 07:04
Joined
Jun 17, 2012
Messages
7,732
You have to many ".

Result1 = dlookup("MyLookupField","MyTable", "Field1 = '" & GstrVariable1 & "'" and "Field2 = '" & GstrVariable2 & "'")

So try:
Result1 = dlookup("MyLookupField","MyTable", "Field1 = '" & GstrVariable1 & "' and Field2 = '" & GstrVariable2 & "'")
 

latex88

Registered User.
Local time
Today, 00:04
Joined
Jul 10, 2003
Messages
198
Thank you, JHB. That worked perfectly. I never quite understand the methodology of the syntax structures. The only way for me to write dlookup's is to reference past expressions, and whenever I have multiple conditions with different combination of datatypes, then I'm clueless :(
 

pr2-eugin

Super Moderator
Local time
Today, 06:04
Joined
Nov 30, 2011
Messages
8,494
I always refer back to this site.. Even after many usage of Domain functions, I sometime get it wrong.. So do not feel bad.. Everyone has one of those moments.. :)
 

Users who are viewing this thread

Top Bottom