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

Implementing a button for the "Send to"

Status
Not open for further replies.

Bmstenner

Technical User
Jul 22, 2002
88
AU
I would like to create a button that when clicked, emails the generated report to a fixed person, instead of having to click on "File, sent to, mail recipent" once the report is generated, as this leaves a security problem.

Does anyone know how this would be achieved? if someone could offer me some assistance it would be greatly appreciated, thanks for your time, paitence and help.


Brendan.
 
You need to use
Code:
DoCmd.SendObject...
in the
Code:
OnClick
event of your button. So to send the rptMyReport to Bart and Milhouse, the syntax would be:

Code:
DoCmd.SendObject acSendReport, "rptMyReport", acFormatRTF, "Simpson, Bart", "Van Houten, Milhouse", , "Report delivery", "Here's your report"

Beware - SendObject in Access 2000 can fail unexpectedly (and without error messages) if your message text is too long. Check out for more info. An alternative and more feature-rich solution (that lets you specify different senders, add voting buttons and set message importance) can be found at
Hope this helps. [pc2]
 
Thanks for that!, looks great!!!..

One more thing, in the database, when I am looking at a report, and i try to open it, i get an error saying

"the specified field 'Date' could refer to more than one table listed in the FROM clause of your SQL statement."

do you know where this is edited??

thanks for the help on my last question, much appreciated.


brendan
 
Open the report in design view and view the Properties window for the whole report. Under the Data tab there'll be a field called Record Source - this is where you edit where the data is coming from. [pc2]
 
Hi mp9,

I have looked through the source information and found that the table it is pointing to the correct table, I am still getting the same error in regards to SQL, if I look at the SQL statement it shows the following:

SELECT [Tbl Employee Name].ID, [Tbl Discrepancies].*, [Tbl Discrepancies].Date
FROM [Tbl Employee Name] INNER JOIN [Tbl Discrepancies] ON [Tbl Employee Name].ID = [Tbl Discrepancies].EmployeeID
WHERE ((([Tbl Discrepancies].Date)=Date()));

If I remove the [Tbl Discrepancies].Date it does not display the error, basically what is supposed to happen, when (in the main switchboard) you select "print discrepancies" it will put the data from the table into a report and print it, it will print the report with null data.

Thanks for your help and support so far,


Brendan
 
I think you need to put square brackets around Date to avoid confusion with Jet reserved words, i.e.

Code:
SELECT [Tbl Employee Name].ID, [Tbl Discrepancies].*, [Tbl Discrepancies].[Date]
FROM [Tbl Employee Name] INNER JOIN [Tbl Discrepancies] ON [Tbl Employee Name].ID = [Tbl Discrepancies].EmployeeID
WHERE ((([Tbl Discrepancies].[Date])=Date()));
[pc2]
 
Ok, I edited this in the SQL statement, it saves ok, but the same error appears when trying to open the Report, so I am guessing something else is not right.

Any more ideas???

Thanks for your help once again,

Brendan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top