suppress warning when export from query to excel

X

xg

How to suppress overwritte warnings whan export from query to excel?
I have DoCmd.SetWarnings False but it still gives warning when overwrite
existing file.


Private Sub cmdGetIt_Click()
On Error Resume Next
DoCmd.SetWarnings False
If fraSelect = 1 Then
DoCmd.OpenQuery "MyRoster"
MsgBox "Click Excel button above to export." _
& vbCrLf & "File is \My Documents\MyRoster.", , conAppName
Else
DoCmd.OpenQuery "MyRosterDept"
MsgBox "Click Excel button above to export." _
& vbCrLf & "File is \My Documents\MyRosterDept.", , conAppName
End If
DoCmd.SetWarnings True
If Err = 2001 Or 2501 Then Err.Clear
End Sub


Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top