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.
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.