Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2004
    Posts
    19

    Unanswered: how to supress messages

    hi,

    Am trying to drop tables in access.Problem is: whenever there is no such table as mentioned, I get an error message saying table doess not exist, and my automated program stops.

    I have done an automation through batch file and hence would require, that
    even if there be an error message, it be supressed completely.

    I have uncheck the confirm options in access, yet when dropping tables , message is popping up...

    Please help me...

    Thanks

  2. #2
    Join Date
    Mar 2004
    Posts
    4

    Re: How to supress messages

    If you are using visual basic, you can implement an error trap subrutine. For example:

    Static Sub YourProcedureName()
    On Error Goto Err_YourProcedureName

    .
    .
    .
    YourProcedureCode here
    .
    .
    .

    Exit_YourProcedureName:
    Exit Sub

    Err_YourProcedureName
    If Err = Theerrornumberyouwanttotrap Then
    Anycodethatyouwanttoexecuteinresponsetotheerror
    Resume [Next]
    Endif
    MsgBox error$
    Resume Exit_YourProcedureName
    End Sub


    Hope this answer your question

    Ing. Jesús Rodríguez L.
    Spanish Pawn Software Specialists
    http://www.sicmx.com

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    You could check the AllTables collection to see if it exists before trying to drop it as well.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  4. #4
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    Are you using SQL to drop the table? Can you use DoCmd.DeleteObject?

    Whenever I need to delete a table I have always used DeleteObject and if you surround it with error trapping code then it should work, example:

    On Error Resume Next
    DoCmd.DeleteObject acTable, "tblYourTable"
    On Error Goto 0 (or your error handling label)

    I assume the only error will be that the table doesn't exist. If the table could not be deleted for some other reason it will be igrnored. I personally have never had a problem with this code.

Posting Permissions

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