Results 1 to 4 of 4
  1. #1
    Basil is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2019
    Posts
    2

    Record Archive using Document Number on a Form

    How do I copy a record to an archive table whilst I have the record open on a form? I want to use the document number of the record I am viewing as the criteria for archiving it. I don't want to delete the record, I simply want to copy and paste it into another table. I then want to be able to change/update field values on the record I have open i.e. creating a new version. I would need to archive the record before updating any fields.

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    The simple answer is DON'T!
    Doing so would mean duplicating data
    A better approach is to have a Yes/No field in your table called Active with default value =True
    When you want to archive a record, set the field false

    If you really must send the data to another table, use an append query, then delete that record from the first table
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,043
    Hi, I suppose you want a history table which reflects all changes mad to the records. Be aware this could make explode the size of the database, so I would advise to keep the history table in another database.
    - Add all fields you want to track to the history table, together with some metafields like createdOn, createdBy, ChangedOn, ChangedBy, VersionDate. In the original table you add the fields createdOn, createdBy, LastChangedOn, LastChangedBy.
    - in the afterupdate event you can fill the metafields LastChangedBy, and LastChangedOn, so they are triggered even when the archive button is not clicked.
    - In the Onclick event of the archive button write a code that triggers an append query or uses an ADODB.command to copy the record to the archive table. in the WHERE clause you can put something like "..... where ID = " & me.txtID. This assumes that the ID is a number and the field is bound to a txtID textbox on the form.
    - Click the button to archive the current version
    -Go on changing the actual record
    - Don't forget to clean out your archive database from time to time.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    If you want an audit trail, review http://allenbrowne.com/AppAudit.html

    If you really want to archive, review http://allenbrowne.com/ser-37.html
    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.

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

Similar Threads

  1. Replies: 21
    Last Post: 08-28-2019, 02:49 AM
  2. Find Last Number Of Document
    By zozzz in forum Forms
    Replies: 2
    Last Post: 09-04-2015, 10:50 AM
  3. Replies: 5
    Last Post: 01-23-2014, 09:36 AM
  4. Replies: 0
    Last Post: 10-04-2012, 01:39 AM
  5. Move a single record to an archive table
    By 10 Gauge in forum Forms
    Replies: 7
    Last Post: 02-14-2011, 06:50 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