Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Nevada, USA
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Carol W.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    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

  3. #3
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Nevada, USA
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Carol W.

Posting Permissions

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