SaturnSeven
Programmer
The following extract all works fine, with the exception that when a users choose option 3 to send a snapshot report attached to a email but then chooses to close the email without sending it, you can no longer select any other custom menu item.
If you try to close the database you recieve message "Can't exit now. If you're running a VB using OLE or DDE, you need to interupt"
The database is setup to start by not showing the database window. If I set this to show on startup the problem goes away.
I've already exclued Error 2501, but no other error is reported.
Any help will be greatly appreciated.
Many thanks
On Error GoTo Err_cmdOK_Click
'Open Report
If FrameOutput.Value = 1 Then
DoCmd.OpenReport rptName, acViewPreview
ElseIf FrameOutput.Value = 2 Then
Call ExportExcel("qry OpenOrdersData")
ElseIf FrameOutput.Value = 3 Then
DoCmd.SendObject acSendReport, rptName, acFormatSNP, , , , "Open Orders", "Please find attached file detailing Open Orders."
End If
'Close Form
DoCmd.Close acForm, "frm OpenOrders", acSaveNo
Exit_cmdOK_Click:
DoCmd.Close acForm, "frm OpenOrders", acSaveNo
Exit Sub
Err_cmdOK_Click:
If Err.Number <> 2501 Then
Call LogError(Err.Number, Err.Description, "frm Open Orders - cmdOK_Click" & AuditFieldKey & " " & AuditRecord)
End If
Resume Exit_cmdOK_Click
If you try to close the database you recieve message "Can't exit now. If you're running a VB using OLE or DDE, you need to interupt"
The database is setup to start by not showing the database window. If I set this to show on startup the problem goes away.
I've already exclued Error 2501, but no other error is reported.
Any help will be greatly appreciated.
Many thanks
On Error GoTo Err_cmdOK_Click
'Open Report
If FrameOutput.Value = 1 Then
DoCmd.OpenReport rptName, acViewPreview
ElseIf FrameOutput.Value = 2 Then
Call ExportExcel("qry OpenOrdersData")
ElseIf FrameOutput.Value = 3 Then
DoCmd.SendObject acSendReport, rptName, acFormatSNP, , , , "Open Orders", "Please find attached file detailing Open Orders."
End If
'Close Form
DoCmd.Close acForm, "frm OpenOrders", acSaveNo
Exit_cmdOK_Click:
DoCmd.Close acForm, "frm OpenOrders", acSaveNo
Exit Sub
Err_cmdOK_Click:
If Err.Number <> 2501 Then
Call LogError(Err.Number, Err.Description, "frm Open Orders - cmdOK_Click" & AuditFieldKey & " " & AuditRecord)
End If
Resume Exit_cmdOK_Click