PanzerAttack
Board Regular
- Joined
- Jan 3, 2008
- Messages
- 197
I'm creating a new database, I have about 100 tables that's updated each AM which act as look ups to provide categories and descriptions for the main information coming in from Sales or Finance etc. I want to empty the tables whilst I'm still building it to check it's all importing but don't want to create loads of quieries to do this.
I Thought something like this might work but I'm obviously missing something, can you please help.
My code:
Public Sub EmptyAllTables()
On Error Resume Next
Dim DB As DAO.Database
Dim TDF As DAO.TableDef
Dim strSQL_DELETE As String
Set DB = CurrentDb()
For Each TDF In DB.TableDefs
If Left(TDF.Name, 4) <> "MSys" Then
strSQL_DELETE = "DELETE FROM " & TDF.Name & ";"
DB.Execute strSQL_DELETE
End If
Next
End Sub
I Thought something like this might work but I'm obviously missing something, can you please help.
My code:
Public Sub EmptyAllTables()
On Error Resume Next
Dim DB As DAO.Database
Dim TDF As DAO.TableDef
Dim strSQL_DELETE As String
Set DB = CurrentDb()
For Each TDF In DB.TableDefs
If Left(TDF.Name, 4) <> "MSys" Then
strSQL_DELETE = "DELETE FROM " & TDF.Name & ";"
DB.Execute strSQL_DELETE
End If
Next
End Sub