Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DLookUp Help - Error 3464 Data Type Mismatch

Status
Not open for further replies.

VhbuiA

MIS
Oct 6, 2005
22
US
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
 
Is SSN text or number?
If its text you need :
txtAS1 = DLookup("EMP_NAME", "TBL_EMPDATA", "[EMP_SSN]='" & txtAS2 & "'")

and so on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top