Hi Guys,
I use Access 2007. I cant seem to work out thge best way to make this code work. Two issues really.
Firstly if email2 or email3 do nat have any data, my code crashes, so need to rewrite it so that it still works even without email2 or email3 having data.
Secondly I dont seem to know if I can use acExportQualityPrint in this code somewhere so as to avoid a lossy PDF being sent. I know it can be put if you use in OpenReport, But i really want to send it rather than save it.
I attach the code below and would appreciate any tweaks to it if not too time consuming.
Thanks
I use Access 2007. I cant seem to work out thge best way to make this code work. Two issues really.
Firstly if email2 or email3 do nat have any data, my code crashes, so need to rewrite it so that it still works even without email2 or email3 having data.
Secondly I dont seem to know if I can use acExportQualityPrint in this code somewhere so as to avoid a lossy PDF being sent. I know it can be put if you use in OpenReport, But i really want to send it rather than save it.
I attach the code below and would appreciate any tweaks to it if not too time consuming.
Thanks
Code:
Option Compare Database
'------------------------------------------------------------
' Proc_112221
'
'------------------------------------------------------------
Function Proc_112221()
On Error GoTo Proc_112221_Err
With CodeContextObject
DoCmd.GoToRecord , "", acNext
DoCmd.GoToRecord , "", acPrevious
DoCmd.OpenReport "InvoiceEmail", acViewPreview, "", "[Invoice No]=[Forms]![Invoices]![Invoice No]"
DoCmd.SendObject acReport, "", "PDFFormat(*.pdf", .Email, .Email2, .Email3, "Hello", "Dear Sir Hello", True, ""
End With
Proc_112221_Exit:
Exit Function
Proc_112221_Err:
MsgBox Error$
Resume Proc_112221_Exit
End Function