Checking for duplicate names in record creation

I have a form called “Patient” which is used to add new patients to the database.  I have a vba code in my “Before Update” event of the form that checks the “Last Name” and “DOB” for duplicates before adding the new patient. Due to historic data that has been loaded to the patient table, there are patients that don’t have date of birth (DOB) and as a result of that I have to change the code used for checking  duplicates. I want the VBA to only check “Last Name” if the “First Name” & “DOB” are null but can check the other fields “UTSW MRN” or “Parkland MRN” if not Null. For example if a patient “Last Name” is entered without a “first name” and “DOB” but a “UTSW MRN” is entered that matches that last name and MRN with an existing patient, a message box should display saying there is a similar record in that database.  How can I accomplish this goal. Attached is a copy of my database with the form. Thanks in advance.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LucasMS Dynamics DeveloperCommented:
Look at the attached database so you can get an idea.   But basically i created 3 functions that would check for your duplicates which you can change.  Remember this is just an idea.

Each time the value changes on the patient form, the before update event on the control will check for a duplicate.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
As lucas911 will tell you, systems like this can start to slow down the DB, if you start having to check more fields and as the number of records grows.

Consider frontline techniques like making certain fields required.
My business is mostly Medical.
In a medical DB, there should not be an allowable reason for a patient's DOB to be blank.
For example, even in an emergency situation, the DOB is "approximated", butt never left blank.

The issue with using "Other fields" is that it just complicates things unnecessarily...

Just my 2c
Chrisjack001Author Commented:
You are absolutely correct boag2000. The only problem with these records are the patients are not required to provide all this information because they are used for research purposes. Example all the historic data we have to be uploaded are missing DOBs, Some first names etc.
Jeffrey CoachmanMIS LiasonCommented:

Just an fyi...
Chrisjack001Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.