Results 1 to 3 of 3
  1. #1
    mrmims is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    53

    DCount to check multiple fields for duplicates? Am I Crazy

    Am I right in thinking I can use DCount in the following way?



    I have a Table for storing Products using Material, Manufacturer, and Vendor. A Product may have many different combinations of these three Fields. For example Baking Soda made by Arm & Hammer sold by Costco ... or Baking Soda made by Kroger sold by Smiths ... and on and on.

    I need to create a line of code which will check, as I enter new products, my 3 fields (MaterialID, ManuID, and VendorID) to insure I do not have a duplicate combination of those fields.

    I don't understand where to begin with a DCount ...

    Thank you for you help

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I would set a unique index instead of using code. Setting an index on those 3 field will not allow a duplicate entry.

  3. #3
    mrmims is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    53
    That works even better! And much cleaner without code.

    Thank you

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Check of duplicates by name in a form
    By quicova in forum Access
    Replies: 2
    Last Post: 11-08-2013, 08:08 AM
  2. Using DCount to check for exisitng records
    By dylcon in forum Programming
    Replies: 15
    Last Post: 06-11-2013, 02:35 PM
  3. Replies: 2
    Last Post: 07-12-2012, 12:46 AM
  4. Replies: 3
    Last Post: 09-29-2010, 09:31 AM
  5. Replies: 0
    Last Post: 01-08-2009, 05:49 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums