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

Need to email current record 1

Status
Not open for further replies.

chuckbjr

IS-IT--Management
May 30, 2003
5
US
I built a database and would like to add a button to my form that will email the Current Record. I got the button setup through the wizard and it works fine - except when I execute it gives me every record in my database. Any help would greatly appreciated.

Thanks.
c b j
 
Thanks for the reply, but that thread doesn't help me. Not only wasn't his post replied to directly, the code that was posted as someone saying they figured it out is no different than what I have right now that yields all of my records. I am emailing a report, and I've been messing with his code and variations on it for a half hour now and I'm still where I started.

I'm beginning to think if I should try and find a way to limit my results from a query, but still I'll leave this thread open if anyone can help.

Thanks.
c b j
 
Here is a sample of sending an email with attachment:

This assumes that each record in your table has unique ID.

1.Create a query that contains the information you want to send
2.Open the query in design view and enter in the criteria section under your primary key field this: [Forms]![YourFormName]![YourUniqueFieldName]
3.Create a report based off your query.
4. Make sure the unique id is on your form, it can be hidden if wanted.
5.Add a command button to your form.
6. Select the command button in design view - go to the properties box slect the 'On Click' event.
7 In the 'On Click' event put this in the code window:

DoCmd.SendObject acSendReport, "NameofYourReport", "FormatYouWantForReport", "YourEmailAddress", , , "TitleforEmailMessage", "TextofEmailMessage", False

Now - which ever record you are currently viewing in on the form - when the user pushes the button - a report with that record's information will be sent to the e-mail address.
 
Beautiful. That's exactly what I was looking for!

Thanks!

c b j
 
I want to do something similar. My form contains the ID and company name. I would like to put the record ID as well as the company name on the subject of the email.

What I'm trying to do is to know what the company name and ID is when the record is emailed.

Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top