Thursday, November 22, 2007

Microsoft Access VBA Delete Error Tables

Public Function iDeleteErrorTables() As Integer
'Returns the number of error tables deleted
Dim obj As AccessObject
Dim dbs As Object
Dim iCount As Integer

Set dbs = Application.CurrentData
iCount = 0
' Check each object of the AllTables collection
For Each obj In dbs.AllTables
If Right(obj.NAME, 6) = "Errors" Or Right(obj.NAME, 7) = "Errors1" Then
DoCmd.DeleteObject acTable, obj.NAME
iCount = iCount + 1
End If
Next obj

DeleteErrorTables = iCount

End Function

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home