Ok Ruth, we are going to make this as easy as possible listen closely.
1. I want you to delete the button off of your form that you created.
2. Create a brand new button and when the wizard open just click Cancel.
3. Open the properties of the button and scroll down to the On Click event.
4. Click on the arrow to open the drop down box for the On Click Event and
select Event Procedure.
5. Click on the three little dots "..." to the right of the drop down box to
open the code window.
6. Between the Private Sub and End Sub place this piece of code in:
On Error GoTo EH
DoCmd.SendObject
EH:
If Err.Number = 2501 Then
MsgBox "This email message has not been sent. Message has been
cancelled."
End If
I just tested it and it works perfectly. I am not sure about what you did so
that is why I am suggesting to delete the old button and start fresh.
Also, I would to suggest (if you haven't already) to purchase one or two
books on Access. When I started out and even now, I buy them off of Amazon
really cheap and they are in nice shape. They can be from Access 2000 - 2003
because it's basically the same. 2007 is completely different so if that is
what you are using, it could explain why you are having the trouble your
having. The books are also a great reference tool. Also, there are a lot of
great websites like this one that is chock full of code and neat things you
can do in Access and it's all free and very accurate. I am not an expert or
even close with Access but I did learn a lot from these folks and save all
the code in a Word document for future use as well as a copy of all my
databases.
Hope this helps!!
:
Hi Stockwell43
I thought that making a macro in Access would be the same as in Excel, just
do the steps and it records it as you go along. when I go to make a macro,
it requires some coding... is there an easy way (hopefully like it is in
excel) to do this that I am missing?
--
Thank-you!
Ruth
:
Hi Ruth,
Glad to see at least your making some head wave. If button is driven by a
macro you created, take out what is in the "Object Name" field in the Macro
and you be fine.
:
Hi again
I tried to take out the command to send the report and the outlook does not
pop up now. What line(s) needs to be removed.
--
Thank-you!
Ruth
:
It is the current report that I want to be sent. I have the button on the
form. If it could send the current form, it would be even better, but from
what I understand, which may be incorrect, only a report can be sent out. So
I built a report, and it sends out the entire report, but I only want it to
send the current record.
--
Thank-you!
Ruth
:
For Output Format on your Macro select Rich Text Format. As far as a filter I
don't see one on the macro. Also, that code you have I not necessary for a
pre-existing report unless you are trying to do like Tony mentioned and send
only the information on the current record.
I think we need to find out some information first. Do you have a report
created in Access or are you trying to send ONLY the current record the user
is on? If it's a full report, I gave you explict instruction on how to create
the Macro that you should be 100% successful because access guide you through
the whole thing with no coding. If it's only the current record, I cannot
help you be cause I have never do that before.
:
Thank-you for your help, but I don't know what I did wrong as it does not work.
I went to the web site that Tony suggested. I am sorry, but I must be
missing something or mixing things up. I added the code:
Me.Filter = Morning Report![AIDX] & Forms![New Trip Report 1 to 1]![AIDX]
Me.FilterOn = True
To the report in the 'on open'
When I goto the form and click on the email button. The pop-up box to
select a file type comes up, once a selection is made, nothing happens,
Outlook does not even open anymore. What did I do wrong? How do I fix it?
--
Thank-you!
Ruth
:
After doing everything the hard way and not having any success, I used the
wizard to create a button to email a report via outlook. I know want to add
the codes so that it emails the current report only (the report that
corresponds to the form that the email button is on.
I think what you meant to say was that the report would contain only
the record that is on the form that the user is displaying.
For a page on how to print a report for a single record and how to
generate reports to attach to emails see the Emailing reports as
attachments from Microsoft Access page at
http://www.granite.ab.ca/access/email/reportsasattachments.htm
Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog -
http://msmvps.com/blogs/access/