email current record from a form

S

SylvieB

Hi all
I need help with the following. From a button on the form, the user would
click on it and be able to email the record he's looking at as an attachment.
I just need Outlook to display and the user can fill out the recipient's
email address himself. How do I do that?
thank you very much anyone for any help you can provide.
 
S

Scott Lichtenberg

Sylvie,

There are two issues here. The first - emailing from Access - is relatively
easy. Look at the help text for the SendObject command. You can send a
form with the acSendForm option. The code below will do the trick.

DoCmd.SendObject acSendForm, Me.Name

However, there is a catch. The SendObject command will convert and output
all records in the form's recordsource. If you are browsing through a form
with 500 records, all of them will be sent. The way around this is to use
the Filter and FilterOn properties. By filtering your form so that it shows
only one record, you can then email just the one record.

Me.Filter = "KeyField = " & Me!KeyField
Me.FilterOn = True
DoCmd.SendObject acSendForm, Me.Name
Me.FilterOff = True

Hope this helps.
 
S

SylvieB

Thank you so much Scott. Yes, your code works; Your help is greatly
appreciated.
Have a great day!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top