G
Guest
Can anybody out there help me? Please look at the following and tell me what
I'm doing wrong:
Dim varHAZTYPE, varDEPT, varDIV As Variant
varHAZTYPE = (DLookup("[HAZTYPE]", "SPACELISTLOOKUP", "[LOC]&[FRAMES]=
LOC&FRAMES"))
varDEPT = (DLookup("[DEPT]", "SPACELISTLOOKUP", "[LOC]&[FRAMES]=LOC&FRAMES"))
varDIV = (DLookup("[DIV]", "SPACELISTLOOKUP", "[LOC]&[FRAMES]=LOC&FRAMES"))
If (Not IsNull(varHAZTYPE)) Then Me![HAZTYPE] = varHAZTYPE
If (Not IsNull(varDEPT)) Then Me![DEPT] = varDEPT
If (Not IsNull(varDIV)) Then Me![DIV] = varDIV
I want the HAZTYPE, DEPT, and DIV fields to be automatically filled in from
my lookup table whenever LOC and FRAMES are the same on my form as they are
in the lookup table. It sort of works. I get the first record in the lookup
table no matter what I type in for LOC and FRAMES. What am I doing wrong?
James
I'm doing wrong:
Dim varHAZTYPE, varDEPT, varDIV As Variant
varHAZTYPE = (DLookup("[HAZTYPE]", "SPACELISTLOOKUP", "[LOC]&[FRAMES]=
LOC&FRAMES"))
varDEPT = (DLookup("[DEPT]", "SPACELISTLOOKUP", "[LOC]&[FRAMES]=LOC&FRAMES"))
varDIV = (DLookup("[DIV]", "SPACELISTLOOKUP", "[LOC]&[FRAMES]=LOC&FRAMES"))
If (Not IsNull(varHAZTYPE)) Then Me![HAZTYPE] = varHAZTYPE
If (Not IsNull(varDEPT)) Then Me![DEPT] = varDEPT
If (Not IsNull(varDIV)) Then Me![DIV] = varDIV
I want the HAZTYPE, DEPT, and DIV fields to be automatically filled in from
my lookup table whenever LOC and FRAMES are the same on my form as they are
in the lookup table. It sort of works. I get the first record in the lookup
table no matter what I type in for LOC and FRAMES. What am I doing wrong?
James