Originally Posted by
ItsMe
I am not used to using acFormatPDF. Nowadays Access can email directly without having adobe software installed on the client. I am not hip to the Docmd EMail thing yet. I believe there is a way you can get it all into one line. If not, you can automate saving to disc and then tell your Docmd email to add as an attachment.
Regardless, the file is going to a temp folder, whether it is in Outlook Program files via a one line Docmd or somwhere you dictate. And you still need to resolve the issue of your query not working.
The code I provided there is just to help you explore some ways of doing things. You were placing criteria into an Access query and dedicating this qury to a couple of forms. It seems you may be able to create a better approach. You just need to get a couple things out of the way first.
If you need help with that code, just ask me. If you need to try a different aproach, I may not be able to help. I will still try, but I don't yet see how you plan to email anything to anybody.
Thanks - I do need you help.
To give you an idea - to get emails sent when the staff make a new booking it is unfiltered - a tempvar collects the ID number of the school, makes a new teacherID and inserts the SchoolID in the table.
That way the booking and teacher are related to the school.
Once the fill out the booking form they click a button of save and email (or save and don't email)
I use this to get it done - note I have a different named report with the same query and info. Because the form is unfiltered this all works well.
The code I use is:
Code:
If IsNull(Me.TeacherEmail) ThenMsgBox "You require an email in the teacher email field to email the school"
Else
On Error GoTo ErrorHandler
DoCmd.SendObject acReport, "rptNewBookingEmail", "PDFFormat(*.pdf)", TeacherEmail, SchoolEmail, , "School Performance Tours - Booking Confirmation", , True
DoCmd.Close acForm, "frmBookingNew", acSaveYes
ErrorHandler:
Select Case Err
Case 2501
MsgBox "You have cancelled the email"
End Select
End If
Because I have in the criteria of the report forms!frmNewBooking!TeacherID
It only pulls the same record information in the pdf before it sends it off to the client.
When the staff go to open an already made booking just to edit/change details about it they can click a button on this form that does the same thing. This works if just going through the records on the form unfiltered.
I have a search form that searches through schools and their corresponding bookings. When they click on the booking it opens the frmBookingEdit form and they can edit the booking previously made. From here if they click the button that send the pdf as an email the pdf of that report has type instead of the record.
I've tested this. Since the form is pulling the one record - forms!frmBookingEdit!TeacherID will not pick up the record that I have brought up using the search form.
I've tried making a tempvar so that when you click the button it gets the TeacherID (visible on the form) and saves the value (or at least tries and I get an error)
I tried replacing the criteria in the report query with the tempvar (which would be TeacherID) but with no luck and the same result.