VBA code for table deletion

S

Smigidy

I have the following code to delete all table data except for what is in the
Switchboard Items table, but there's a compile error. Any suggestions?

Public Sub sDeleteAllTableData()
Dim dbAny As DAO.Database
Dim I As Long

Set dbAny = CurrentDb()
For I = 0 To dbAny.TableDefs.Count - 1
If (dbAny.TableDefs(I).Attributes And dbSystemObject) = 0 or
If (dbany.tabledefs(i).name="Switchboard Items") Then
dbAny.Execute "DELETE FROM [" & dbAny.TableDefs(I).Name & "]"
End If
Next I

End Sub

Thanks, Michael
 
Top