M
Martin
I would like to write some code that will delete a table if the table name
contains the text "import errors". This is the code I have so far but it
does not work. I think the problem is with the Docmd.Delete line. Can
anyone help me fix this?
Public Function Delete()
Dim db As Database, FileName As String, tbl As TableDef
Set db = CurrentDb()
FileName = "ImportErrors"
For Each tbl In db.TableDefs
If tbl.Name Like FileName Then
MsgBox "Hello"
DoCmd.DeleteObject acTable, FileName
End If
Next
End Function
Thank you,
Martin
contains the text "import errors". This is the code I have so far but it
does not work. I think the problem is with the Docmd.Delete line. Can
anyone help me fix this?
Public Function Delete()
Dim db As Database, FileName As String, tbl As TableDef
Set db = CurrentDb()
FileName = "ImportErrors"
For Each tbl In db.TableDefs
If tbl.Name Like FileName Then
MsgBox "Hello"
DoCmd.DeleteObject acTable, FileName
End If
Next
End Function
Thank you,
Martin