How to create a VBA code to create an email in MS Access with email address from multiple forms?

I created a macro through the macro builder, but I have a few issues that I’m hoping to resolve by creating the email through vba.

Issue 1: Unable to add the signature block
Issue 2: The email addresses are being pulled from forms, but if one of the forms is blank the macro stops

TO: Forms!frmFOL![FOL Email] & "; " & Forms!frmFSL![FSL Email]
CC: Forms!frmFSL![FSL Email] & "; " &
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


pls try

Sub CreateMail()

   Dim OlApp As Outlook.Application
   Dim ObjMail As Outlook.MailItem

   Set OlApp = Outlook.Application
   Set ObjMail = OlApp.CreateItem(olMailItem)

   ObjMail.To = Nz(Forms!frmFOL![FOL Email], "") & "; " & Nz(Forms!frmFSL![FSL Email], "")
   ObjMail.CC = Nz(Forms!frmFSL![FSL Email], "") & "; " & ""
   ObjMail.Subject = "YourSubject"
   'You now have the default signature within ObjMail.HTMLBody.
   'Add this after adding strHTMLBody
   ObjMail.HTMLBody = "YourBodyText" & ObjMail.HTMLBody

   'ObjMail.Send 'send immediately or
   'ObjMail.close olSave 'save as draft
   'Set OlApp = Nothing

End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kbay808Author Commented:
Sorry for the delay.  Thanks for your help
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.