Results 1 to 3 of 3
  1. #1
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160

    Invoices Table Primary Key

    Hi Guys,



    I am working with a billing Database. I have a table tblPurchase and tblPurchaseDetails. tblPurchase has a primary key PurchaseID which is autonumber field.

    Now most of the time invoices and invoices details, needs to be imported through excel. Recently while importing i faced an error, due to which tblPurcahse was imported but tblPurchaseDetails failed to import. I ran the process again after correcting the error and everything worked fine, but now there were two entries for the same invoice under different PurchaseID. I would like to control this error.

    tblPurcahse has Invoice Number, but it could be same from different suppliers, hence cant use Invoice number alone as unique. I was thinking of making a unique with combination of supplier and invoice number as that can never be same in combination. How can this be achieved?

    I already have lots of data in the table. Was thinking of making both Invoice Number and SupplierID_FK as indexed with no duplicates. Would this solve the problem? Need your advise, to avoid any future problems.

    Thanks and Regards
    Deepak Gupta

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Yes, set a compound index and continue using the autonumber as primary key.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    Thanks, Idea works.

    Regards
    Deepak Gupta

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

Similar Threads

  1. Replies: 3
    Last Post: 09-23-2017, 08:16 AM
  2. Replies: 2
    Last Post: 04-13-2017, 03:00 PM
  3. Replies: 14
    Last Post: 05-06-2015, 11:19 PM
  4. Replies: 2
    Last Post: 08-21-2012, 02:38 PM
  5. Replies: 8
    Last Post: 03-22-2012, 08:48 AM

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