Hi, I've searched the site but nothing I seem to change works for what I need accomplished.
I have a form that basically after a user types in the SSN in the txtAS2 field, the code would then look up the values associated with that SSN in the employee table. Here's what I have so far...any help is sincerely appreciated!
Private Sub txtAS2_AfterUpdate()
Dim txtAS2, txtAS1, txtAS3, txtAS4 As Variant
Set txtAS2 = Forms!frmAwardSheet("txtAS2")
Set txtAS1 = Forms!frmAwardSheet("txtAS1")
Set txtAS3 = Forms!frmAwardSheet("txtAS3")
Set txtAS4 = Forms!frmAwardSheet("txtAS4")
txtAS1 = DLookup("EMP_NAME", "TBL_EMPDATA", "[EMP_SSN]=" & "" & txtAS2) & ""
txtAS3 = DLookup("EMP_GRADE", "TBL_EMPDATA", "[EMP_SSN]=" & "" & txtAS2) & ""
txtAS4 = DLookup("ORG_ABB", "TBL_EMPDATA", "[EMP_SSN]=" & "" & txtAS2) & ""
If txtAS2 <>"TBL_EMPDATA.[EMP_SSN]" Then
MsgBox ("You have entered an invalid SSN..."
End If
End Sub
I have a form that basically after a user types in the SSN in the txtAS2 field, the code would then look up the values associated with that SSN in the employee table. Here's what I have so far...any help is sincerely appreciated!
Private Sub txtAS2_AfterUpdate()
Dim txtAS2, txtAS1, txtAS3, txtAS4 As Variant
Set txtAS2 = Forms!frmAwardSheet("txtAS2")
Set txtAS1 = Forms!frmAwardSheet("txtAS1")
Set txtAS3 = Forms!frmAwardSheet("txtAS3")
Set txtAS4 = Forms!frmAwardSheet("txtAS4")
txtAS1 = DLookup("EMP_NAME", "TBL_EMPDATA", "[EMP_SSN]=" & "" & txtAS2) & ""
txtAS3 = DLookup("EMP_GRADE", "TBL_EMPDATA", "[EMP_SSN]=" & "" & txtAS2) & ""
txtAS4 = DLookup("ORG_ABB", "TBL_EMPDATA", "[EMP_SSN]=" & "" & txtAS2) & ""
If txtAS2 <>"TBL_EMPDATA.[EMP_SSN]" Then
MsgBox ("You have entered an invalid SSN..."
End If
End Sub