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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database locks after Docmd.SendObject

Status
Not open for further replies.

SaturnSeven

Programmer
Aug 4, 2005
40
GB
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
 
And what about this ?
DoCmd.SendObject acSendReport, rptName, acFormatSNP, , , , "Open Orders", "Please find attached file detailing Open Orders.", False

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
And what happens if you comment out the On Error instruction ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
with out On Error, you still get the message "The SendObject action was canceled." The Form remains open but without focus.

It looks like cancelling a SendObject action throws the focus the the database window only. But if it's not shown what happens?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top