View Full Version : Email Single Record


patf
08-22-2002, 09:06 PM
I am a newbie and am wanting to email SINGLE record from my Form's Command Button to a Report, but get all records. Can successfully print one record using Print Command button to the same Report, but not email. Any posts on this all have "bits & pieces" answers. Can anyone give me the complete answer? I am trying to use SendObject

Hayley Baxter
08-23-2002, 02:04 AM
Will this single record you want to email always go to the same email address? or would you want to change the email?

patf
08-25-2002, 04:20 PM
Hayley,

The single record will go to the email address of the current record, written in a field called (EMAIL). Whatever record I am on when pressing the command button, the email wants to go to the correct email address, just that all records want to go. Below is my code on the Command Button called Email_Quik.

Private Sub Email_Quik_Click()
On Error GoTo Err_Email_Quik_Click

Dim stDocName As String

stDocName = "Quik"
DoCmd.SendObject acReport, stDocName, acFormatRTF, (EMAIL), , , "Licenses", "The attached file shows the details of Licenses issued to your company as of this date. Please contact us if you have any queries."

Exit_Email_Quik_Click:
Exit Sub

Err_Email_Quik_Click:
MsgBox Err.Description
Resume Exit_Email_Quik_Click

End Sub

I greatly appreciate your interest.

Hayley Baxter
08-27-2002, 03:11 AM
I can get the current record to send to the specified email address however on clicking the cmd button it want to appear as email address then http email address again. I do not have this set up in this way from the table so can't understand why access wants to throw the last part in. If you can get the second part corrected then the sample I was working on will work for you and you're more than welcome to have it.

Hay

patf
08-27-2002, 04:08 PM
Hayley,

I have no problem with the email address, just that it wants to send records for every entry. I would love to see your sample and see if it solves my problem because if so, I can extend that solution to other reports.

Hayley Baxter
08-28-2002, 12:35 AM
The sample can be found here in this post but you will see there is still problems with using this method ie it opens http when using the cmdbutton I don't have an answer for this but you might be able to work that part out and use this.

http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=33648

Hay