I'm trying to create a script that appends or updates a table when a report is opened. I've written a script and tied it into the report's 'On Open' event. It works fine except for one thing. When the script goes to update the table I get a popup message that says, "You won't be able to undo the changes this action query is about to make to data in a linked table or tables. Do you wish to continue? {Yes}{No}." I'd like this to run without any dialog. The 'append' portion works fine, no dialog. Anyone know why the 'update' portion still gives me a dialog, and more importantly, how to suppress it? Thank you.
Application.SetOption "Confirm Action Queries", 0
If dtCurrentDate > dtMaxDate Then
DoCmd.OpenQuery "AppendHistoryFile", acViewNormal, acEdit
ElseIf dtCurrentDate <= dtMaxDate Then
DoCmd.OpenQuery "UpdateHistoryFile", acViewNormal, acEdit
End If
Application.SetOption "Confirm Action Queries", -1
~Abby
Application.SetOption "Confirm Action Queries", 0
If dtCurrentDate > dtMaxDate Then
DoCmd.OpenQuery "AppendHistoryFile", acViewNormal, acEdit
ElseIf dtCurrentDate <= dtMaxDate Then
DoCmd.OpenQuery "UpdateHistoryFile", acViewNormal, acEdit
End If
Application.SetOption "Confirm Action Queries", -1
~Abby