Beatrix
03-27-2016, 04:44 PM
Hi Everyone,
I have an Access Database with 16 tables and need to have a script which deletes all records from 16 tables and pull new data from Excel to Access.
There are 16 spread sheets in Excel. Each spread sheet is a data source for one table in Access.
I have below code to clear 16 tables. I need to achieve the second bit which is pulling data from Excel to Access. Can anyone help me on this please? What approach I should use etc? I came across with some scripts but not for multiple workbooks though..
Thanks in advance.
B.
Sub ClearTables()Dim T As TableDef
DoCmd.SetWarnings False
For Each T In CurrentDb.TableDefs
If T.Name Like "Term*_*" Then
DoCmd.RunSQL "DELETE * FROM " & T.Name
End If
Next T
DoCmd.SetWarnings True
End Sub
I have an Access Database with 16 tables and need to have a script which deletes all records from 16 tables and pull new data from Excel to Access.
There are 16 spread sheets in Excel. Each spread sheet is a data source for one table in Access.
I have below code to clear 16 tables. I need to achieve the second bit which is pulling data from Excel to Access. Can anyone help me on this please? What approach I should use etc? I came across with some scripts but not for multiple workbooks though..
Thanks in advance.
B.
Sub ClearTables()Dim T As TableDef
DoCmd.SetWarnings False
For Each T In CurrentDb.TableDefs
If T.Name Like "Term*_*" Then
DoCmd.RunSQL "DELETE * FROM " & T.Name
End If
Next T
DoCmd.SetWarnings True
End Sub