I want to delete all records from all tables, but whenever i try the below code it shows me Run-time error 3131: Syntax error in FROM clause. Could someone direct me to the mistake I'm making please?
Dim tVar As TableDef
Dim strVar As String
For Each tVar In CurrentDb.TableDefs
If Left(tVar.Name, 4) <> "MSys" Then
'Here I've tried without WHERE clause too, but same error appears back
CurrentDb.Execute "DELETE * FROM " & tVar.Name & " WHERE ID Is Not Null"
End If
Next tVar
Dim tVar As TableDef
Dim strVar As String
For Each tVar In CurrentDb.TableDefs
If Left(tVar.Name, 4) <> "MSys" Then
'Here I've tried without WHERE clause too, but same error appears back
CurrentDb.Execute "DELETE * FROM " & tVar.Name & " WHERE ID Is Not Null"
End If
Next tVar