Results 1 to 5 of 5
  1. #1
    EvanScamman
    Guest

    Bypass delete confirmation msg in delete query (A2k)

    I'm trying to run a delete query in VBA, and I don't want users to see the delete confirmation msg each time. in there a way to turn this off?

    thanks,
    Evan

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Bypass delete confirmation msg in delete query (A2k)

    The basic syntax is
    Docmd.SetWarnings False

    After you are done, be sure to turn them back on by specifying True instead of False.
    Wendell

  3. #3
    2 Star Lounger
    Join Date
    Dec 2000
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bypass delete confirmation msg in delete query (A2k)

    I would caution against using DoCmd.SetWarnings False - Doing so turns off all system messages not just Action Query warnings.

    Instead I would use:
    Application.SetOption "Confirm Action Queries", False to temporarily turn off the confirmation messages for Action Queries, a delete query being an action query.

    Then in your code I would use:
    Application.SetOption "Confirm Action Queries", True to turn the confirmation back on.

    NOTE: This method assumes you are using an Access Database as your data store as opposed to SQL Server or MSDE (Microsoft Data Engine). Also it's important to note, should you turn off the confirmation, it is an Access application setting that will be turned off for Microsoft Access not just the database you were working in. So it's important to turn the confirmations back on.

    Should you use the SetWarnings instead, you could hit the delete key with a form or other object selected and it would be removed no questions asked.

    FWIW

  4. #4
    EvanScamman
    Guest

    Re: Bypass delete confirmation msg in delete query (A2k)

    Thankyou everybody for your help. Right now, I'm using the DoCmd.SetWarnings methode. However, I'm turning it back on instantly, so it's only off while 1 line of code is being processed. I'm hoping that this is safe enough.

    Thanks again!

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Bypass delete confirmation msg in delete query (A2k)

    If you're using code, make sure you have error trapping in place so that if an error is generated, your code picks up at a point where it will turn the SetWarnings property back on. Otherwise, you'll get a silent error that will stay silent.
    Charlotte

Posting Permissions

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