Lookup from Field

S

Steve Voorhees

I have a database that has some tables joined via relationships.
The main table is a customer table, for gathering the first name, last name,
address, etc. Then there are others are linked to it.
What I am wondering...is there a way to have the form check the table after
a first and last name are entered to see if there is already a possible
record that exists for that customer? Even something that would find similar
matches based on both fields, and present option in a pop up form.
Any suggestions?
 
P

Pete

Steve

You can use the dlookup function. Example (untested) below.

Dim varFound as Variant
varFound=dLookup("aField","tblCustomer","Where cSurname = '" & Me.txtSurname
& "' AND cFirstName = '" & Me.txtFirstName & "'")

If not isnull(varFound) then
Duplicate record code.....
End If
 
Top