G
Guest
After setting the values of the respective variables, I am running this code to copy a table from a patch file to a live database:
DoCmd.SetWarnings False
DoCmd.CopyObject FilePathData, tblName, acTable, tblName
DoCmd.SetWarnings True
However, I need a way to ensure that I do not overwrite the table if it already exists, for obvious reasons. If I do not run DoCmd.SetWarnings False, the user sees the Yes/No dialog and may answer "Yes" (bad news if they already have the table and it is populated with data).
If I run DoCmd.SetWarnings False, the code AUTOMATICALLY overwrites the existing table. What I need is SetWarnings False with an option to force a "No" response.
Alternatively, I need a way to check for the existence of the table in the target DB so that I can run an If...Then statement to determine whether I run the copy statement at all.
DoCmd.SetWarnings False
DoCmd.CopyObject FilePathData, tblName, acTable, tblName
DoCmd.SetWarnings True
However, I need a way to ensure that I do not overwrite the table if it already exists, for obvious reasons. If I do not run DoCmd.SetWarnings False, the user sees the Yes/No dialog and may answer "Yes" (bad news if they already have the table and it is populated with data).
If I run DoCmd.SetWarnings False, the code AUTOMATICALLY overwrites the existing table. What I need is SetWarnings False with an option to force a "No" response.
Alternatively, I need a way to check for the existence of the table in the target DB so that I can run an If...Then statement to determine whether I run the copy statement at all.