Hello,
I have the following code to send a report via outlook.
Private Sub OLEUnbound238_Click()
DoCmd.SendObject ObjectType:=acSendReport, ObjectName:="Statement One Player", OutputFormat:=acFormatHTML, To:=Me!Email, Subject:="Rob Nickels Tennis", MessageText:="This is a friendly reminder that payment for tennis classes is now due. Kindly remember that payment for tennis classes are due by the 7th. Please find attached your invoice. Thank you.", EditMessage:=False
DoCmd.Close acForm, "E-mail Statement?", acSaveYes
DoCmd.OpenForm "Client Information Main Info Form", acNormal
End Sub
This works great if Outlook is not currently open, but if Outlook is open then I receive an error messgae and the e-mail does not get sent.
My question is this. Can I add some VB code to the above code that closes outlook IF it is already open?
I am using Access 2003.
Thanks in advance,
Rob
I have the following code to send a report via outlook.
Private Sub OLEUnbound238_Click()
DoCmd.SendObject ObjectType:=acSendReport, ObjectName:="Statement One Player", OutputFormat:=acFormatHTML, To:=Me!Email, Subject:="Rob Nickels Tennis", MessageText:="This is a friendly reminder that payment for tennis classes is now due. Kindly remember that payment for tennis classes are due by the 7th. Please find attached your invoice. Thank you.", EditMessage:=False
DoCmd.Close acForm, "E-mail Statement?", acSaveYes
DoCmd.OpenForm "Client Information Main Info Form", acNormal
End Sub
This works great if Outlook is not currently open, but if Outlook is open then I receive an error messgae and the e-mail does not get sent.
My question is this. Can I add some VB code to the above code that closes outlook IF it is already open?
I am using Access 2003.
Thanks in advance,
Rob