I have a dataset where I have code on the 'on click' event on a button on a form that will import a table from a known db and then delete the old table and rename the imported table.
All works fine as shown below. . . . .
Code:
Private Sub bUpdateTable_Click()
'Updates Data table
DoCmd.TransferDatabase acImport, "Microsoft Access", "P:\AAA ASA LTD\ASA Ltd Volunteers\Volunteer Timesheets\VolunteerTimes.accdb", acTable, "tTimeData", "tTimeData", False
'Delete old table
DoCmd.DeleteObject acTable, "tTimeData"
'Rename new table
DoCmd.Rename "tTimeData", acTable, "tTimeData1"
'Set Msg Box that table updated
MsgBox "The Times Data table has been updated" & Chr(10) & "Click OK and continue"
'Cancel the action
Cancel = True
'Reset focus to Form
Forms![1Dummy]![bClsDmy2].SetFocus
Me.Refresh
End Sub
If I want to import two or three tables (or more) into a db, should I just add additional code lines, respectively, under "Updates Data Table" and then under "Delete" and "Rename" sections referring to the respective import tables, or do a separate 'action' - Update/Delete/Rename for each of the tables?
Appreciate any advice that allows me to keep it simple.
Cheers
Mortonsafari