Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

E-mail current record from Form

Status
Not open for further replies.

onemiland

Programmer
May 29, 2004
18
US
I'm beginning to see there are tons of ways to e-mail from access...
I have a db of 200+ clients with thier info, I would like to click on a button from the client form in that record to send an e-mail with thier data in the message, ie Name, address, other info.

The message would be in text format and not a snapshot.
Thanks for your help.
 
Use the SendObject command and create a string with the data from the form or table record as a paragraph for the actual message portion of the email. This string variable when completed would then be used as a parameter in the command and appear in the body of the email.

When I say create a string with the data the following is an example. The yellow highlight is the syntax for the SendObject command.:

Code:
Dim vMsgString as String
[COLOR=white red]vMsgString[/color] = "Name:  " & Me![Name] & vbCrLf & "Address: " & _
Me![Address] & vbCrLf & "CityStZip: " & Me![City] & _
", " & Me![State] & "   " & Me![ZipCode]
[i][highlight]DoCmd.SendObject [objecttype][, objectname][, outputformat][, to][, cc][, bcc][, subject][, [COLOR=white red]vMsgString[/color]][, editmessage][, templatefile][/highlight][/i]

Post back with any questions.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Yeah, that does help. Now, the e-mail message is going to be based off the current record.

Do I base the command button off of a qry?

Thanks for your help
 
If all of the information for the email is on the form as bound controls then you don't have to do anything with looking it up in a table. It is all available by just referencing the data in the controls. Even if you have to create controls that are invisible but are bound to fields that you want to use in the email that's okay. Just make them small, invisible, and push them up in the corner someplace out of the way. You can still then use the control reference to build your message and even use them as email addresses.

Hope this helps you.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top