| | |
|
|
|
delete table |
| message from Michael Magg on 5 May 2004 |
Hello!
I wanna import a table with a makro, but a table with this name already
exists. So the imported table (f. i. "table") is saved as "table1". How can
I check, if such a table already exists and then delete it?
So how can I check the existence of a table?
________________________________________
Function Importieren1()
On Error GoTo Importieren1_Err
DoCmd.DeleteObject acTable, "schueler"
DoCmd.RunCommand acCmdImport
Importieren1_Exit:
Exit Function
Importieren1_Err:
MsgBox Error$
Resume Importieren1_Exit
End Function
________________________________________
Yours Jürgen
|
| John W. Vinson [MVP] replied to Michael Magg on 5 May 2004 |
delete it?
Don't bother checking. Just note the error number that you
get when you attempt to delete the table when it does not
exist, and trap that error. I'm posting from a computer
without Access installed and I don't recall the error
number, but the code in your error handler would be
something like
Importieren1_Exit:
Exit Function
Importieren1_Err:
Select Case Err.Number
Case xxx ' the relevant error number here
Resume Next ' just go on as if no error happened
Case Else ' any other error
MsgBox "Error " Err.Number & vbCrLf & Err.Description
Resume Importieren1_Exit
John W. Vinson/MVP
|
|
Archived message: delete table (MS Access Forms)