Results 1 to 4 of 4

Thread: Error Messages

  1. #1
    JamesP
    Guest

    Error Messages

    Hi!
    Is it possible to turn off error messages?
    I now that you can turn off warnings with:
    DoCmd.SetWarnings (False)
    Is there something similar to it for error messages?

    Thanks!!

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

    Re: Error Messages

    you can put On Error Resume Next into your code routines to make it continue in spite of errors, roughly the equivalent of the native ADO behavior.However, turning off error messages is NOT a good idea, even if it were possible. You want to know about errors so you can handle them. Otherwise, your program would do things you never intended without your being any wiser.

    ADO doesn't raise error messages the way DAO does, it just fails silently; so you have to work harder with ADO to make sure you know about the errors and can handle them instead of just scratching you head and wondering why the result wasn't what you expected.
    Charlotte

  3. #3
    Star Lounger
    Join Date
    Feb 2001
    Location
    Wirral, Merseyside, Merseyside, England
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error Messages

    I use this routine to ignore some error messages as a way of handling errors. This example below gives a message if no disk was placed in the drive. In this way I can handle errors that I may expect, but allow unexpected errors to appear.

    On error GoTo Error_handler

    'your code....

    Error_Handler:
    If Err.Number = 3021 Then 'No disk in Drive a:
    MyMsg = "Please ensure that there is a disk"
    MyMsg = MyMsg & " in Drive a: or "
    MyMsg = MyMsg & " there is a Directory displayed"
    MyMsg = MyMsg & " which is in the correct format,"
    MyMsg = MyMsg & " or that the directory you are copying"
    MyMsg = MyMsg & " from is not empty"

    MsgBox MyMsg, , "Disk or Directory error"
    ElseIf Err.Number <> 0 Then
    Err.Raise Err.Number 'Display error number
    End If

  4. #4
    JamesP
    Guest

    Re: Error Messages

    Thank you both!

Posting Permissions

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