• Access 2003 Macro Condition

    Author
    Topic
    #464912

    I have an Access macro in which I would like to test for the existence of a temporary table before execution of a DeleteObject action that deletes that table.

    This macro has been running for years but every once in a while the table does not exist (reasons unknown at this time) and the macro terminates abnormally.

    What condition do I put in the condition column to accomplish this?

    Thanks in advance.

    Viewing 1 reply thread
    Author
    Replies
    • #1192203

      I’d convert the macro to VBA; you can then add error handling, e.g.

      On Error Resume Next
      DoCmd.DeleteObject acTable, “tblTemp”
      On Error GoTo 0

    • #1192277

      Hans,

      The action directly after the DeleteObject is execution of a make table query that creates the same table. I originally inserted the DeleteObject action to ensure that the table would be deleted before the make table query runs (I was a novice back then and wasn’t quite sure if the table would automatically be deleted).

      I just tested it, simply removing the Delete Object action, and found that apparently Access automatically deletes the table as part of the make table query.

      Problem seems to be solved.

      Thanks, as always, for the reply.

    Viewing 1 reply thread
    Reply To: Access 2003 Macro Condition

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: