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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to email only one record in a form

Status
Not open for further replies.

kmdru

Technical User
Oct 14, 2001
2
0
0
US
Hi There!

In my database at work, the staff fill in a particular form, and when it is completed, I want to have a command button in the form so they can email the form to someone else. I tried using the DoCmd.SendObject function to send the form, but it sends all the records in the form! What am I missing? What do I need to do to send only the active form/record? Any assistance/information would be greatly appreciated

kmdru
 
On your data entry form, create a button committed to the following macro:

RunCommand, SaveRecord
OpenReport, PrintPreview WHERE [RecordNr]=[Forms]![DataEntry]![RecordNr]
SendObject
Close

The condition in OpenReport limits the output to the record showing currently on your form.
In SendObject, you can add default e-mail addresses and choose a suitable format, such as RTF. If you set 'Allow Message edits' to 'no', the e-mail will be sent automatically, while 'yes' allows the user to edit the message before sending.

Regards, Gion
 
Thanks Gion!

I had no idea it was so easy. It worked like a charm. The only problem now is that when I mail it as RTF, the information is scattered about on the pages. But I can work on that, or try other formats.

Thanks again for your help.

kmdru
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top