I was going to check if a temp table exists and delete the it,since "the temptable already exists" arises if you want to perform another operation.
Here's the code i used five statements but it says syntax error in drop table or drop index statement.
Any help would be appreciated.

"DROP TABLE IF EXISTS LIKE 'prtempTable%'"
"DROP TABLE IF EXISTS LIKE '%prtempTable%'"
"DROP TABLE IF EXISTS WHERE TABLE LIKE 'prtempTable%'"
"DROP TABLE LIKE 'prtempTable%'"
"DROP TABLE LIKE '%prtempTable%'"

It doesn't work,since it's for sql server db.Is there another way to solve it?

How about just putting the delete code in a Try-Catch block and seeing what error occurs if the table does not exist? That will tell you what error to ignore.

I used this sub procedure and it worked fine.

On Error GoTo ErrorHandler
        Dim str As String
        str = "DROP TABLE ptempTable"
        ExecSQL(str)
        Exit Sub
ErrorHandler:
        If Err.Number = 7874 Then
            Resume Next
        End If

Thanks by the way

This question has already been answered. Start a new discussion instead.