Results 1 to 4 of 4

Thread: Log Deletions

  1. #1
    Join Date
    Mar 2013
    Posts
    2

    Unanswered: Log Deletions

    Hi all,

    I want to log certain strings to a unbound table when a user deletes a record from the main bound table.
    However I have little idea what code I would need to able to do this? I presume it would need to be placed in the AfterDelConfirm section on the form but thats about it!

    Example would be on delete, create new record in example_table, create autonumber in example_table!del_ID, save string1 to example_table!field1.value and string 2 to example_table!field2.value

    Hope that makes sense

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Many experienced developers would only use one Table in this situation, and wouldn't actually delete Records! They would
    • Add a Yes/No Field to the Table
    • Name it Delete
    • Create Queries, based on this single Table, as the Record Source for both frmCurrent and frmDeleted

    In Query Design for the Query to be used for frmCurrent, in the Criteria Box for Delete, enter

    <> -1

    In Query Design for the Query to be used for frmDeleted, in the Criteria Box for Delete, enter

    = -1

    In both Forms
    • Change the Record Source to the appropriate Query
    • Add the desired Fields for both Forms onto the Forms
    • Add the Field named Delete to both Forms
    • In the Delete_AfterUpdate event for both Forms place the line Me.Requery


    Now each Form will show the appropriate Records and your data is stored in one, not two, Tables. Also, if you made a mistake in ticking the Delete Checkbox, you can go to frmDeleted and untick Delete. The Record will then reappear in frmCurrent.

    In this way you can retrieve all Fields in all 'deleted' Records.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Mar 2013
    Posts
    2
    Thanks Linq. The problem is I need to keep the size of the dB to a minimum so I really do need to delete the records. All I really need to store is a particular key and a user ID along with a time stamp.

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Then you'll have to create a Table with these Fields and use an Append Query to write the Values to it, just prior to deleting the Record.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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