Hello Access users.
Thought this VBA code module would be simple, but as usual, probably missing a nuance, and this doesn't work.
I need to selectively delete about 5 tables in a 2007 database before the major processing, and I thought I could do so in VBA with following example of code:
For Each tblDef in CurrentDb.TableDefs
If tblDef.Name = "TableThatMustBeDeleted" Then
DoCmd.SelectObject acTable, tblDef.Name, True
DoCmd.DeleteObject acTable, tblDef.Name
End If
Next tblDef
Also have:
Dim db as Object
Set db = CurrentDb
Dim tblDef as TableDef
CAN ANYONE SPOT WHAT I'M DOING WRONG??
Thanks in advance to any help.
Thought this VBA code module would be simple, but as usual, probably missing a nuance, and this doesn't work.
I need to selectively delete about 5 tables in a 2007 database before the major processing, and I thought I could do so in VBA with following example of code:
For Each tblDef in CurrentDb.TableDefs
If tblDef.Name = "TableThatMustBeDeleted" Then
DoCmd.SelectObject acTable, tblDef.Name, True
DoCmd.DeleteObject acTable, tblDef.Name
End If
Next tblDef
Also have:
Dim db as Object
Set db = CurrentDb
Dim tblDef as TableDef
CAN ANYONE SPOT WHAT I'M DOING WRONG??
Thanks in advance to any help.