+ Reply to Thread
Results 1 to 8 of 8

Prevent duplicate entry in a userform by matching record to multiple columns.

  1. #1
    Registered User
    Join Date
    11-17-2011
    Location
    Philippines
    MS-Off Ver
    MS Office 2010 to 2013
    Posts
    22

    Cool Prevent duplicate entry in a userform by matching record to multiple columns.

    Hi,

    I really need help in my project.

    I used a userform to add records. What I want to happen is that when I hit the Submit button, there will appear an error message saying that a duplicate record already exists which would depend on multiple criterias matching the record that I am trying to add.

    For instance,
    A B C D
    1 Date Category Payment Amount
    2 3/12/13 Food Cash 500
    3 3/13/13 Supplies Check 10000
    4 3/13/13 Maintenance Check 2000
    .
    .
    n An Bn Cn Dn

    On the userform, I have a record that would be like that in fourth entry, as I hit the submit button, I would like to see a msgbox that would say duplicate entry found, recheck entry or something. How do I compare my data from the textboxes or comboboxes in my userform to the ones already existing in the database, like check columns through A to D and see if all OR any (at least 3) criterias are matching so that the msgbox would appear to prevent user from adding the duplicate entry.

    It would be good if I would have an option to still add the data if the user wants to. But that might be easy since I can add that option in the msgbox instead.

    I really need your help guys, I would appreciate it! Thanks!

  2. #2
    Registered User
    Join Date
    11-17-2011
    Location
    Philippines
    MS-Off Ver
    MS Office 2010 to 2013
    Posts
    22

    Re: Prevent duplicate entry in a userform by matching record to multiple columns.

    By the way, here is the code that I currently have in my Submit button. Any suggestion is welcome. Thanks.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor Toonies's Avatar
    Join Date
    07-30-2009
    Location
    Newcastle, UK
    MS-Off Ver
    Excel 2016
    Posts
    492

    Re: Prevent duplicate entry in a userform by matching record to multiple columns.

    this form should help you, simply amend it to your needs

    Subs1.xls

    to launch form click on ID No

  4. #4
    Registered User
    Join Date
    11-17-2011
    Location
    Philippines
    MS-Off Ver
    MS Office 2010 to 2013
    Posts
    22

    Re: Prevent duplicate entry in a userform by matching record to multiple columns.

    Toonies,

    Thanks for the response and the file attachment. It seems that this will help me a lot but I have a question. In your attached file, it seems that the duplicate entry would depend on one column only. Can you help me compare and validate two fields, say column 1 and column 2? And the statement be in Select Case version since my other sheets are using this.

    You've helped me a lot already. Thanks.

  5. #5
    Forum Contributor Toonies's Avatar
    Join Date
    07-30-2009
    Location
    Newcastle, UK
    MS-Off Ver
    Excel 2016
    Posts
    492

    Re: Prevent duplicate entry in a userform by matching record to multiple columns.

    it may help if you upload a sample of your spreadsheet

  6. #6
    Forum Contributor Toonies's Avatar
    Join Date
    07-30-2009
    Location
    Newcastle, UK
    MS-Off Ver
    Excel 2016
    Posts
    492

    Re: Prevent duplicate entry in a userform by matching record to multiple columns.

    Replace with this code
    Please Login or Register  to view this content.
    this sorts your 1st part of your request
    Last edited by Toonies; 03-15-2013 at 06:32 AM.

  7. #7
    Registered User
    Join Date
    08-31-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    0

    Re: Prevent duplicate entry in a userform by matching record to multiple columns.

    Hi Toonies,

    Just Wondering if you can help me with my project. I'd like to add those features you have on Subs.xls on my project. But instead of ID number, I want to be able to search data using the date. Please help
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,164

    Re: Prevent duplicate entry in a userform by matching record to multiple columns.

    Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1