Hello Guys,
I am trying to send emails with the DoCmd.SendObject method. I understand the concept but would like to know how I can tweak it a little.
Here is my code:
Code:
Of Course, it is giving me an error message of "Compile error: Expected Function or variable" for this "varObjName = DoCmd.OpenReport("Rpt_LCARenew", acViewPreview, , Employee = "& rs!Employee &")
"
How can I create a variable to hold the report name as a DoCmd object so that it will attach the report of that person and email that person, etc?
Thank you for your help
I am trying to send emails with the DoCmd.SendObject method. I understand the concept but would like to know how I can tweak it a little.
Here is my code:
Code:
Code:
Private Sub cmdEmail_Click()
Dim db As DAO.Database
Dim rs As Recordset
Dim varObjName As Variant
Set db = CurrentDb
Set rs = db.OpenRecordset("Qry_EngineerLicRenewal-Emails", dbOpenDynaset, dbSeeChanges)
varObjName = DoCmd.OpenReport("Rpt_LCARenew", acViewPreview, , Employee = "& rs!Employee &")
DoCmd.SendObject acSendReport, varObjName, acFormatPDF, "email", , , "SendObject Email Test", "This is just a test to see what how it looks", True
End Sub
"
How can I create a variable to hold the report name as a DoCmd object so that it will attach the report of that person and email that person, etc?
Thank you for your help