Lookup value in a table

J

Janet

I am using a form for data entry which is bound to tlbLetter. After entering
a loan number in a field in the form , I want a message box to tell me if the
loan number is in a different table called tblImport. Can someone help me
with the code on this? Thanks...
 
D

Duncan Bachen

Janet said:
I am using a form for data entry which is bound to tlbLetter. After entering
a loan number in a field in the form , I want a message box to tell me if the
loan number is in a different table called tblImport. Can someone help me
with the code on this? Thanks...

You can use the Dlookup Function in the After Update event of the text
control on the form.

Sample:

If DLookup("[LoanID]","[tblImport]","[LoanNumber]=" &
txtLoanNumberOnForm) Then
MsgBox "Already Exists"
End If
 
J

Janet

This is just what I was looking for. THanks a million.

Duncan Bachen said:
Janet said:
I am using a form for data entry which is bound to tlbLetter. After entering
a loan number in a field in the form , I want a message box to tell me if the
loan number is in a different table called tblImport. Can someone help me
with the code on this? Thanks...

You can use the Dlookup Function in the After Update event of the text
control on the form.

Sample:

If DLookup("[LoanID]","[tblImport]","[LoanNumber]=" &
txtLoanNumberOnForm) Then
MsgBox "Already Exists"
End If
 
Top