Looking for Existing Records

A

Anders

Howdy,

What type of expression do I create if I want to search a table (take
customers) to see if someone already exists? My customer table contains the
usual contact information. Everything I've seen on Help is setting the query
before hand (e.g. in the first name column, Like "Mar*" would return anybody
with Mar in the first name). I would love to find a way to have the user
define that criteria, but not have to setup a query.

Ideal world, the user clicks a button on the switchboard, then 3 consecutive
popup windows ask for the first three letters of 3 fields; first name, then
last name, then organization. Is this possible?

Greatly appreciated!

Anders
 
A

Allen Browne

Use DLookup(). Like this:

Dim strWhere As String
dim varResult As Variant
strWhere = "(LastName = ""Jones"") AND (FirstName = ""Anders"")"
varResult = DLookup("ClientID", "tblClient", strWhere)
If Not IsNull(varResult) Then
MsgBox "Found! Client ID is " & varResult
End If

More info about DLookup() in:
Getting a value from a table: DLookup()
at:
http://allenbrowne.com/casu-07.html
 
T

TedMi

Matching names is more art than science, because of possible variations in
spelling. Are Jon Smith, Jonathan Smith and John Smith the same or different
persons?Here's the method I use for this:
Present a "New Customer" form, on which the user enters only the last name
of a supposedly new customer. Query the customer table and return all names
& addresses which match the input name. Ask the user if any of the displayed
names are the "new" customer; if not, have user click button which presents
a full customer entry form. Nice touch - have the last name transferred from
the new customer form to the full form.
-TedMi
 

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