ACC1x: How to Delete Multiple Tables QuicklyID: Q106304
|
In some situations you may want to quickly delete multiple tables, rather
than deleting them one at a time.
For example, when you import data from another product, an error table may
be created. After several imports, you may have several old import error
tables to delete.
Below are two methods of quickly deleting multiple tables. The first method
allows you to bypass the delete confirmation screen. The second method uses
a function that deletes all tables that begin with "Import Errors," and is
particularly useful when the same table type must be deleted often.
Delete table Test?
Function DeleteImportErrorTables ()
On Error GoTo ResetEnv
Dim MyDB As Database, MySnapShot As Snapshot
If MsgBox("Delete Import Error Tables?", 292) = 7 Then
On Error GoTo 0
Exit Function
End If
Set MyDB = CurrentDB()
Set MySnapShot = MyDB.ListTables()
DoCmd Echo False ' Turn off screen updates.
DoCmd SetWarnings False ' Turn off warning messages.
Do Until MySnapShot.EOF
If MySnapShot.[Name] Like "Import Errors*" Then
DoCmd SelectObject A_TABLE, MySnapShot.Name, True
DoCmd DoMenuItem A_DATABASE, A_EDIT, A_DELETE
End If
MySnapShot.MoveNext
Loop
DoCmd SetWarnings True ' Be sure to set SetWarning back on!
DoCmd Echo True ' Be sure to turn screen updating back on!
Exit Function
ResetEnv:
DoCmd SetWarnings True ' Be sure to set SetWarning back on!
DoCmd Echo True ' Be sure to turn screen updating back on!
Exit Function
End Function
Additional query words: erasing
Keywords : kbusage TblOthr
Version : 1.0 1.1
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: March 27, 1999