Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003
    Posts
    104

    Unanswered: disabling Debug notices?

    Hi All,
    In my VBA code, I have statements that look like this

    Code:
    Dim SQL as String
    SQL = "some SQl Code"
    
    DoCmd.RunSQl(SQL)
    The problem is that every time DoCmd.RunSQL is executed, MS Access (2002) Asks to confirm. If the user clicks on "No" or "Cancel" It goes to debug the code.

    I want to disable this so that if a user clicks no or cancel, nothing happens! How can this be done?

    Thanx in advance

  2. #2
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238

    Re: disabling Debug notices?

    Originally posted by shassouneh
    Hi All,
    In my VBA code, I have statements that look like this

    Code:
    Dim SQL as String
    SQL = "some SQl Code"
    
    DoCmd.RunSQl(SQL)
    The problem is that every time DoCmd.RunSQL is executed, MS Access (2002) Asks to confirm. If the user clicks on "No" or "Cancel" It goes to debug the code.

    I want to disable this so that if a user clicks no or cancel, nothing happens! How can this be done?

    Thanx in advance
    Hmmm... Good question... I'll have to look into that...

    Personally, I'd just ask the user to confirm first, set warning to false and then run the query... Like this:

    If MsgBox("Are you sure you want to run query?", vbQuestion + vbYesNo, "Confirm") = vbYes Then
    DoCmd.Setwarnings = False
    DoCmd.RunSQL(SQL)
    DoCmd.Setwarnings = True
    End If

    HTH

  3. #3
    Join Date
    Nov 2003
    Posts
    104

    Exception Handling

    Asking the user for confirmation is NOT viable since enough measures are done to make sure the user is doing what he/she wants/

    I WOULD use Exception Handling but I do not know how exception handling works in VB

  4. #4
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Smile Re: disabling Debug notices?

    Originally posted by shassouneh
    Hi All,
    In my VBA code, I have statements that look like this

    Code:
    Dim SQL as String
    SQL = "some SQl Code"
    
    DoCmd.RunSQl(SQL)
    The problem is that every time DoCmd.RunSQL is executed, MS Access (2002) Asks to confirm. If the user clicks on "No" or "Cancel" It goes to debug the code.

    I want to disable this so that if a user clicks no or cancel, nothing happens! How can this be done?

    Thanx in advance
    Try DoCmd.SetWarnings False (Not = False, just space then False)
    You need to turn the warnings back on after you run your code.
    DoCmd.SetWarnings True


    Gregg

    I'm sorry, I just noticed that the above code was already given.

    Gregg

Posting Permissions

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