Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2003
    Posts
    123

    Unanswered: Check for existing TableDef (temporary table)

    I have a routine that creates a temporary table and deletes it at the end. Sometimes it doesn't get deleted. How do I check if the table already exists, and if it does, delete it at the beginning of the routine?

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    If it is at the beginning of the routine, you can always delete it. This function tries to delete the table and if the table does not exist ignores the error.

    Code:
    Public Sub DeleteTable(strTableName As String)
    
        On Error Resume Next
        DoCmd.DeleteObject acTable, strTableName
        
    End Sub

Posting Permissions

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