none
Append Data to a table without Duplication

    Question

  • Hi,

    I have mini-app in access 2010.I want append the Quantity Available of the Product to another table daily when logging out. But my problem is how can this be done without duplication of data, since use can decides to logging and log-out as many time they like.

    I want a system that will just replace or update record for each day without duplicating data, just in case users want to view history of daily opening and closing stock from the table.

    Thanks in advance for the reply guys!

    Johnmc71


    • Edited by Johnmc71 Friday, January 3, 2014 4:05 PM Correction
    Friday, January 3, 2014 4:04 PM

Answers

  • Create an Index on the table you want to store this data in.  Go to the table's design view.  Then click on the Index icon on the toolbar/ribbon above the design view.  The Index button has a lightening bolt icon.  In the Index dialog window you enter any name you want to call it and then select the fields to make up this index -- make it unique.  This way you cannot enter duplicate data into the table.  Then in your app closing procedure add

    On Error Resume Next

    to continue closing when the app tries to add a duplicate record to this table.


    Rich P

    • Marked as answer by Johnmc71 Friday, January 3, 2014 8:33 PM
    Friday, January 3, 2014 4:57 PM