Hello all,
I would say I am a bad intermediate level database person when it comes to VBA code (I'm self taught from the internet).
I have a payroll database and we want to create a docmd that will automatically email payslips to each employee. One email/ One Pdf per employee
I've used the design wizard in Access 2013 report options for a mail report but it will not autopopulate the email address when it opens outlook.
The default code is:
Could anyone suggest a way to change this code to auto populate an email address that is shown on the form where the command button is placed?
My form(PayslipSingle) shows employee number (EmplNo), name(EmplName), and email address (txtemail) as separate fields. Data is pulled from my table named Employees, and it is shown on my report named PayrollPayslipSingle.
This process would take me manually pushing the button about 400+ times as that is how many employees we have. As a stretch goal I was wondering if it is possible to code a macro that would run this process through the whole table of employees sending one email to each for only one button click???
Appreciate any help I can get, again I apologize as I am no expert on VBA.
I would say I am a bad intermediate level database person when it comes to VBA code (I'm self taught from the internet).
I have a payroll database and we want to create a docmd that will automatically email payslips to each employee. One email/ One Pdf per employee
I've used the design wizard in Access 2013 report options for a mail report but it will not autopopulate the email address when it opens outlook.
The default code is:
Code:
Option Compare Database
Private Sub cmdSendEMail_Click()
Call SendMyEmail
End Sub
Private Sub Mail_Report_Click()
On Error GoTo Err_Mail_Report_Click
Dim stDocName As String
stDocName = "PayrollPayslipSingle"
DoCmd.SendObject acReport
Exit_Mail_Report_Click:
Exit Sub
Err_Mail_Report_Click:
MsgBox Err.Description
Resume Exit_Mail_Report_Click
Could anyone suggest a way to change this code to auto populate an email address that is shown on the form where the command button is placed?
My form(PayslipSingle) shows employee number (EmplNo), name(EmplName), and email address (txtemail) as separate fields. Data is pulled from my table named Employees, and it is shown on my report named PayrollPayslipSingle.
This process would take me manually pushing the button about 400+ times as that is how many employees we have. As a stretch goal I was wondering if it is possible to code a macro that would run this process through the whole table of employees sending one email to each for only one button click???
Appreciate any help I can get, again I apologize as I am no expert on VBA.
Last edited: