Results 1 to 2 of 2
  1. #1
    NoiCe is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2008

    Running a Delete (Records) Query on Close


    I have no experience with VBA (which I am thinking may be the only solution to this problem) but I want to be able to have Access (2003 or 2007) run a Delete Query of this one table right before someone decides to close down the database. The reason for this is that the only way autonumber will reset is if you delete the records in a table and compact the database. The compacting portion was already set within the options menu, but now I am looking to have all records deleted on close. Can someone help me out? Also, if VBA is the only way, can someone walk me through on how to accomplish this. I have yet to begin teaching myself VBA or SQL.


  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    8300' in the Colorado Rocky Mountains
    I have a Housekeeping form that I open hidden with the AutoExec macro. You can then use the OnLoad and OnUnload events to do such tasks as you describe. If it is the first form to open then it will be the last form to close. It also sounds like you are using the AutoNumber value beyond what it was designed to do.

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

Similar Threads

  1. #delete records
    By supernova122 in forum Access
    Replies: 0
    Last Post: 07-08-2009, 08:41 AM
  2. Replies: 0
    Last Post: 06-21-2009, 01:29 PM
  3. Unable to close Query without saving
    By jhrBanker in forum Access
    Replies: 0
    Last Post: 06-08-2009, 05:09 PM
  4. Replies: 0
    Last Post: 08-25-2008, 12:17 PM
  5. Delete all records in a table?
    By bob646 in forum Access
    Replies: 1
    Last Post: 05-20-2007, 11:41 PM

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