Look for matching first and last name

  • Thread starter ILoveAccess via AccessMonster.com
  • Start date
I

ILoveAccess via AccessMonster.com

Hello!

I have a form called "frmLeads" with two fields "FirstName" "LastName".

I type in FirstName: Jane LastName: Doe

If there is someone else in the database with the FirstName, Jane, and
LastName, Doe, then I want it to do the following:

1.) say, "There is another record(s)in the database that contain the same
First and Last Name. Would you like to veiw the other record(s)?"

2.) If I choose yes, then filter those records.
If I choose no, then ignore and let me continue entering the record.

Is there a way to do this?

Thanks!
 
D

Douglas J. Steele

One approach (not necessarily the best) would be:

If DCount("*", "MyTable", "FirstName = " & Chr$(34) & _
Me.FirstName & Chr$(34) & " And LastName = " & _
Chr$(34) & Me.LastName & Chr$(34)) > 0 Then
MsgBox "You already have a record with that name."
End If

Of course, it's not that uncommon to have two (or more) people with the same
name...
 
G

Guest

Not disagreeing with your suggestion, but a couple of questions. What is the
"$" for? Could the record source be a query (based on MyTable) with a
concatenated name field?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top