Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Warn of duplicate SS number
Harold Laski 
    
4 years ago
I have a customer form with a field called SS representing a Social Security Number.  Occasionally my front desk enters the same person twice. Sometimes this is on purpose and sometimes it is an error. I just want a msg box to pop up whenever the SS field is tabbed out of telling the user that this is a duplicate SS number and asking him to enter Yes or No if he wishes to continue entering that duplicate number as a separate customer or clear the new entry and start over.
Richard Rost  @Reply  
          
4 years ago
Just DLookup the SSN in the BeforeUpdate event, and then MsgBox asking if they want to add or not.
Harold Laski OP  @Reply  
    
4 years ago
I have been trying for the past 5 hours to get this to work. Pleae help me write this one line code. I wrote:
Private Sub SS_BeforeUpdate(Cancel As Integer)
DLookup("CustomerF", "SS", "SS = " & Forms![CustomerF]!SS)
End Sub

Where the Form is called CustomerF and the field is SS. All I want is to this to notify me by MsgBox when the SS has been used with a current customer.  I do not want to stop someone from using the smae SS, just notify the user that he or she has entered  a duplicate SS number.  (Rarely we give the same customer 2 different accounts with the same demographics including the SS number.
Richard Rost  @Reply  
          
4 years ago
Your parameters for DLookup are wrong.

1. Watch the DLookup video.
2. You have to put the value returned by DLookup into a field or a variable.
3. The first parameter is the FIELD you're looking up, not a form name. Never a form name. You look up from a table or query.
4. If SSN is a text field (and it should be) you'll need Double Double Quotes
5. I would go watch Access Expert 10 where I cover DLookup for the first time. You have it.

Put all of that aside for a moment. The EASIEST solution for what I think you're trying to do, is to just INDEX the SSN field in your table and set it to NO DUPLICATES. That will prevent a double entry. We can worry about the whole DLookup thing later.

Indexing
Dan Jackson  @Reply  
            
4 years ago
Problem is Rick, he wants to enable the creation of duplicate SSN's, but warn if there is a duplicate.

Practice the DLookup on something simple and follow along with the video. You'll get there
Richard Rost  @Reply  
          
4 years ago
Ah. My mistake. Maybe I'll make a video out of this.
Harold Laski OP  @Reply  
    
4 years ago
Dan, you are correct.  In this day and age of security all medical practices must conform to HIPAA regulations.  That not only means printed and digital security but other changes.  Our office administers to several different health care professionals with one front desk. Rarely patients are seen by more than one specialist. So therefore we wish only to have a warning when the SS# comes up duplicate. Then the office user can determine if that patient with the duplicate SS is being seen by another health care professinal or indeed there has been a duplication of that patient's records with the same physician. Thank you. I think that this would make an excellent video as using a DLookup to search in the same database can be very useful for a number of purposes.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 4/30/2026 3:21:53 PM. PLT: 0s