DLookup working on subform, but not on main form

terrytek

Registered User.
Local time
Today, 14:21
Joined
Aug 12, 2016
Messages
75
I have a sbfTests with testing information. One of the text boxes has NRSLevelID, and I need to look up the corresponding text value EducationFuncLevel in the tblNRS (because this subform is also used for data entry, I cannot pull the text values into the query qryTestingUpdateable underlying the form because then the query won't be updateable).
The DLookup in the text box on sbfTests is
=DLookup("[EducationalFuncLevel]","tblNRS","[NRSLevelID] =" & [Forms]![sbfTests]![NRSLevelID])
When I look at the subform by itself, the appropriate text values EducationFuncLevel display fine. When I look at the subform on its main form, though, instead of the text value, the field says "#Name?"
Why?
 

I actually looked at the reference above before I posted here, but when I change

=DLookup("[EducationalFuncLevel]","tblNRS","[NRSLevelID] =" & [Forms]![sbfTests]![NRSLevelID])

to

=DLookup("[EducationalFuncLevel]","tblNRS","[NRSLevelID] =" & [Me]![NRSLevelID])

I not only get the "#Name?" error when I show the subform on the main form, I get that same error when I view sbfTests by itself as well. With my original option, the DLookup works fine when I view the subform on its own.
(BTW, Access inserts the brackets around Me by itself).
 
"Me" is VBA. You can't use that in a control source. Try just...
Code:
=DLookup("[EducationalFuncLevel]","tblNRS","[NRSLevelID] =" & [NRSLevelID])
 

Users who are viewing this thread

Back
Top Bottom