Results 1 to 9 of 9
  1. #1
    Simonhtc4 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    30

    Compact and repair/ close access 2016

    hope this helps anyone here,

    VBA to compact and repair then close access.

    Private Sub CloseFormcmd_Click()
    SendKeys ("%T D C")
    DoCmd.Quit




    End Sub

  2. #2
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    Avoid any use of Sendkeys.

    And there is a setting option to automatically compare/repair the database on close.

  3. #3
    Simonhtc4 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    30
    i didnt know the, can you show me were that feature is please, i could only find to close the database and not the whole of access.

  4. #4
    Simonhtc4 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    30
    Doh i found the setting thank you for the advice :-)

  5. #5
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349

  6. #6
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Avoid any use of Sendkeys
    Please explain.

  7. #7
    Simonhtc4 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    30
    ThanksJwhite:-)

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,409
    @aytee - basically because sendkeys is unreliable, particularly in a production environment, and does not respect which application window it is in - so user might inadvertently change focus to another app/window and the keys will be applied there instead - possible with disastrous results.

  9. #9
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Thanks, Ajax, great explanation.

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

Similar Threads

  1. Replies: 3
    Last Post: 02-01-2016, 03:43 PM
  2. MS Access 2007/2010 Compact & Repair not working
    By danielgriffin12 in forum Access
    Replies: 1
    Last Post: 08-11-2015, 09:47 AM
  3. Replies: 7
    Last Post: 11-22-2013, 07:32 PM
  4. Compact and repair on close
    By colotazzman in forum Access
    Replies: 2
    Last Post: 05-20-2010, 02:04 PM
  5. MS-Access 2007 - Compact & Repair how?
    By techexpressinc in forum Access
    Replies: 2
    Last Post: 03-05-2009, 02:12 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