I am not a programmer and I usually use macro to fulfill some small functions.
This time I use a Macro of "SendObject " to send report as Pdf format.
it is working well when I test it while "Navigation Pane" is displayed. But after I hide the "Navigation Pane", the problem appears:
If I cancel emailing by click "X" of outlook 2007 window,The system crashes. Access can not even be closed. The dialogue window shows"You can not exit Microsoft Office Access now", "If you're running A Visual Basic Module that is running OLE or ODE, You may need to interrupt the module". it beeps and I have to use "Ctrl+Alt+D el" to interrupt.
But If I send e-mail out , it is no problem.
I tried many times that if "Navigation Pane" is displayed, I have chance to come back to access after cancelling the email and closing outlook window.But when it is hided, the problem always happens.
I do not know if there is something to do with SendObject when hiding "Navigation Pane".
I tried to converse the Macro into VB Module and add Error Handling phrases. But it seemed the error window appears before Error Handling phrases run.
is there any way to avoid this cancellation error and keep "Navigation Pane" hide at the same time?
This time I use a Macro of "SendObject " to send report as Pdf format.
it is working well when I test it while "Navigation Pane" is displayed. But after I hide the "Navigation Pane", the problem appears:
If I cancel emailing by click "X" of outlook 2007 window,The system crashes. Access can not even be closed. The dialogue window shows"You can not exit Microsoft Office Access now", "If you're running A Visual Basic Module that is running OLE or ODE, You may need to interrupt the module". it beeps and I have to use "Ctrl+Alt+D el" to interrupt.
But If I send e-mail out , it is no problem.
I tried many times that if "Navigation Pane" is displayed, I have chance to come back to access after cancelling the email and closing outlook window.But when it is hided, the problem always happens.
I do not know if there is something to do with SendObject when hiding "Navigation Pane".
I tried to converse the Macro into VB Module and add Error Handling phrases. But it seemed the error window appears before Error Handling phrases run.
Code:
Option Compare Database '------------------------------------------------------------ ' EmailClient ' '------------------------------------------------------------ Function EmailClient() On Error GoTo EmailClient_Err DoCmd.OpenReport "Invoice", acViewPreview, "", "[BKID]=[Forms]![Booking]![BkID]", acNormal DoCmd.SendObject acReport, "Invoice", "PDFFormat(*.pdf)", Forms!Booking!Email, "", "", "Invoice # " & CStr(Forms!Booking!PaymentSales.Form!InvNum), Eval("""Hello "" & CStr([Forms]![Booking]![ContactName]) & "" , attached PDF is your invoice ."""), True, "" EmailClient_Exit: Exit Function EmailClient_Err: MsgBox Error$ Resume EmailClient_Exit End Function
Comment