Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does SetWarnings work on confirmation popups? 2

Status
Not open for further replies.

gwoman

Programmer
Nov 16, 2004
199
US
I have a user that has created a macro to update an .snp file automatically ... she is having a problem with the confirmation popup "the file already exists do you want to replace it" ... she has set the SetWarnings option before and after her output command and is still getting the prompt to replace the file. I created the following simple module for her ...

Sub OutputReport()

DoCmd.SetWarnings False


DoCmd.OutputTo acOutputReport, "YourReportNameHere", acFormatSNP, "YourReportNameHere.snp"

DoCmd.SetWarnings True


End Sub

... and had her replace her OutputTo command in the macro with the RunCode command and had her fill in the function name at the bottom ...

She is still getting the yes/no confirmation popup ...

Can this be remedied ... or does SetWarnings not work on confirmation popups at all?

Thanks

gwoman
 
Hi gwoman,

Since you are writing VBA code, You could first check and see if the file exists. If the file does exist, you can first delete it in code yourself. Perhaps use the Kill command.

Hope this helps,
Hap...


Access Developer [pc] Access based Accounting Solutions - with free source code
Access Consultants forum
 
Code:
Sub OutputReport()
Dim strPath As String
strPath = "YourReportNameHere.snp"
DoCmd.SetWarnings False
If Dir(strPath) <> "" Then Kill strPath
DoCmd.OutputTo acOutputReport, "YourReportNameHere", strPath
DoCmd.SetWarnings True
End Sub

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top