Hello, I'm trying to copy the structure of a table to make a temp table. I'm using CopyObject (which also copies the data). So when I delete the data from the temp table, it also deletes data from the source table. Is the data linked? It should just be deleted from the temp table. Below is the beginning of the code. I've stepped through, and at the last step shown, the data in the source table deletes. Can someone help?
Code:
Dim strFile As String
Dim temp As String
Dim tbl As String
Dim db As DAO.Database
' error handle
On Error GoTo F_Error
' warnings
DoCmd.SetWarnings False
' set variables
' strfile
strFile = "N:\Price Increases\Fee Notice Import Master.xlsx"
'temp
temp = "tempNotices"
'tbl
tbl = "tblNotices"
' db
Set db = CurrentDb()
' confirm
If MsgBox("Would you like to import Fee Notices from the master file?", vbYesNo, "Import") = vbYes Then
' create temp table
DoCmd.CopyObject , temp, acTable, tbl
' delete all from temp table
DoCmd.RunSQL "DELETE * FROM " & temp