Email Payslip to individual employee

batowiise

Registered User.
Local time
Today, 22:52
Joined
Nov 9, 2010
Messages
17
Hi Everyone,

I have been employed in an IT Consulting firm and my first assignment is to enhance a payroll system (in access) to be able to send payslips to individual employees with their specific payslip through email.

The employee table has an email field and would like to send the emails to the email address with their payslip (which is a report).

Your help is much need and welcome.

Thanks in advance

Batowiise
 
I have watched the video and it looks similar to what i wanted to implement. I however encounter error when i try debugging. This is the code:

Function SendMyEmail()

'Declare variables
Dim MySet As ADODB.Recordset

Set MySet = New ADODB.Recordset
MySet.Open "qryEmailAddress", CurrentProject.Connection, adOpenStatic

Do Until MySet.EOF

[Forms]![Form1].[qIndexNumber].Value = MySet![Index Number]
[Forms]![Form1].[qEmail].Value = MySet!

DoCmd.SendObject acReport, "PaySlips", "MicrosoftExcelBiff8(*.xls)", [Forms]![Form2].[qEmail], "", "", "PaySlip", "Please find attached file", False, ""

MySet.MoveNext
Loop

End Function

When i start Debugging by stepping into, then i have an error message that says: "Run-time error 2450 Microsoft Office Access can't find the form 'Form1' referred to in a macro expression or Visual Basic code.

thanks
 
Can you upload a sample of your database.
 
Ive added a command button on your first form, this will take you to a form called frmSendEmail on the form there are 2 textbox each have been named, txtEmployee (Which refers to the employee number), txtEmail (which will hold the email address, which in your sample you have no email addresses). So when you check this it will run to the point it needs the email address.

I have then added a command button to the form which calls the Function you had, I have amended it slightly to use the form and fields.

Because this was made in an earlier version of Access I had to look at tthe References to remove the missing ones and select the version for 2007. You will have to check this once you download it to your PC.

I have a question you have decided to set this to use snap shot attachments, this means that every person who receives the email must have the snap shot viewer installed on there PC or they can't open it?

Attached returned database.
 

Attachments

Thanks very much, that was what i was fighting with. I however have some error. I did enter two emails for the first two employees. As usual, it starts by prompting with the DATE RANGE that is from the PaySlips Report. After filling in the date range another dialog/window pop-up for me to click either YES or NO.

When i clicked YES the following error message came up:

"Run-time error '2295'
Unknown message recipient(s); the message was not sent"

Should all the email fields be enter before running the procedure or what?

Thanks
 
In the docmd.sendobject line change the word at the end from True to False, this will then work, but it will require you to keep clicking send.

You don't need all the email addresses
 
I changed the DoCmd.SendObject to rather refer to a Query instead of a Report and put in a criteria that is [Forms]![Form1].[qIndexNumber]. It is now working perfectly.

The date range keeps coming up after every loop. I want it to come one.

Thanks
 
I will be very grateful if you could implement that for me since you have the FILE. I am i little bit confuse.

Thanks
 
Bob I have tested my version as I have suggested options to this thread, so I haven't ignored your comment. But lots of normal things to do here as well.

As far as the date options go, create a form and add 2 textbox then open the properties and name each textbox txtStart and txtEnd and format them to use date/time

Then select your query and go into design view and change the Between your start date to point to the form and it would be something like

Between [Forms]![frmSendEmail]![txtStartDate]And[Forms]![frmSendEmail]![txtEndDate]

Then save, then place some dates in your fields and run the program
 
Thanks soo soo much, every thing is now OK. You guys are very great keep it up.
 
I have two unbound text fields namely txtStartDate and txtEndDate on a form. I want to verify that txtEndDate is not less (earlier) than txtStartDate and when this condition is met, a message pops up notifying the user.

I have tried using the following code but am not getting the desired result.

txtEndDate.SetFocus
If txtEndDate.Text < txtStartDate then
Msg "Please rectify Date, End Date earlier than Start Date"
txtEndDate.SetFocus
exit sub
End If

Your help and support is much needed and welcome.
 
Try this in the After Update Event of the txtEndDate when you move out of the text box it will trigger


Private Sub txtEndDate_AfterUpdate()
If txtEndDate.Value < txtStartDate.Value Then
MsgBox "Please rectify Date, End Date earlier than Start Date"
txtEndDate.Value = ""
txtEndDate.SetFocus
Exit Sub
End If

End Sub
 
Hi Everyone,

I have been employed in an IT Consulting firm and my first assignment is to enhance a payroll system (in access) to be able to send payslips to individual employees with their specific payslip through email.

The employee table has an email field and would like to send the emails to the email address with their payslip (which is a report).

Your help is much need and welcome.

Thanks in advance

Batowiise

I wanted to do the same thing, but i wanted to send pdf pay slips which are the output of a payroll software, as an e-mail attachment.
is that possible?
 
Ive added a command button on your first form, this will take you to a form called frmSendEmail on the form there are 2 textbox each have been named, txtEmployee (Which refers to the employee number), txtEmail (which will hold the email address, which in your sample you have no email addresses). So when you check this it will run to the point it needs the email address.

I have then added a command button to the form which calls the Function you had, I have amended it slightly to use the form and fields.

Because this was made in an earlier version of Access I had to look at tthe References to remove the missing ones and select the version for 2007. You will have to check this once you download it to your PC.

I have a question you have decided to set this to use snap shot attachments, this means that every person who receives the email must have the snap shot viewer installed on there PC or they can't open it?

Attached returned database.

I tried to do the same with my project. It worked, however, I can not send the email automatically. I need to hit the send button each time an email is created. I am using MS Access 2013 and Outlook 2013.

Thank you and more power
 

Users who are viewing this thread

Back
Top Bottom