Guest_imported
New member
- Jan 1, 1970
- 0
I am a novice and have created a table with employees last name, first name and ID number. I want to type in thier id number and have the fields for thier names fill in automatically. I have gone to the form and to the properties section for the ID number. In the after update box of the event field I typed in:
Private Sub CCN_AfterUpdate()
Dim varFIRSTNAME, varLASTNAME As Variant
varFIRSTNAME = DLookup("FIRSTNAME", "Employee List", "CCN =[CCN]"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
varLASTNAME = DLookup("LASTNAME", "Employee List", "CCN =[CCN]"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
If (Not IsNull(varFIRSTNAME)) Then Me![FIRSTNAME] = varFIRSTNAME
If (Not IsNull(varLASTNAME)) Then Me![LASTNAME] = varLASTNAME
End Sub
When I type in the ID number, it populates the form with the improper information.
Private Sub CCN_AfterUpdate()
Dim varFIRSTNAME, varLASTNAME As Variant
varFIRSTNAME = DLookup("FIRSTNAME", "Employee List", "CCN =[CCN]"
varLASTNAME = DLookup("LASTNAME", "Employee List", "CCN =[CCN]"
If (Not IsNull(varFIRSTNAME)) Then Me![FIRSTNAME] = varFIRSTNAME
If (Not IsNull(varLASTNAME)) Then Me![LASTNAME] = varLASTNAME
End Sub
When I type in the ID number, it populates the form with the improper information.