Link to home
Start Free TrialLog in
Avatar of Engtech05
Engtech05Flag for United States of America

asked on

How to send two different emails in access

I have a database that when the user is finished entering data the system is supposed to send two different emails. The problem is that access doesnt recognize the second call to send the second email. What I am doing to opening a report based on the users entered data, converting it to html then sending that html to outlook which in turn sends the email. Works great like I said for one but not the other.
I have attached the  code for the two email routines as well as the command button code.

I need to send two emails with different data at the same time.

Any help is greatly appreciated.
SQRSubmit.docx
Avatar of Randy Poole
Randy Poole
Flag of United States of America image

Your problem is in your CreateSQRMail Sub.
Set olApps = CreateObject("Outlook.Application")
Set olMails = olApp.CreateItem(olMailItem) ‘this is where the error occurs

Open in new window

You define olApps but try to create the mailitem using olApp.  Change it to:
Set olApps = CreateObject("Outlook.Application")
Set olMails = olApps.CreateItem(olMailItem) ‘this is where the error occurs

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial