Find Matching Criteria

B

Bryan Hughes

Hello,

I am trying to create a class module that executes after user hits cmdbtn on
form when entering new record. I would like to search my main table to see
if the [firstName] and [lastName] matches previously entered records. If
matches are found, get total numbers of matches. I will then pass this
information on to the user to do something before new record is entered into
table.

What is the best method using ADO to do this?
 
R

Ron Weiner

How about something like:

dcount("SomeFieldInMainTable","MainTable","LastName='"& txtLastName & "' and
FirstName='" & txtFirstName &"'")

Will return the number of records in your table MainTable where the first
and last name match the first and last name on your form. Returns 0 (Zero)
when there are no matches

Ron W
 

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