Some questions re SendObject

A

ant1983

First some background. Ive created a Training Booking Database that the end
user will use to book clients on various training courses.

The main output (report) for the db is a report called
rptTrainingConfirmation which is basically just that. It runs off a query
and the Unique ID in that query is autTrainingSessionID. The criteria in
that field is "[Forms]![tblBooking subform1]![numTrainingSessionID]" as the
end user click the cmdEmailInvite button that opens the report, drags the
info in the report and then attached it to an email.

Now the questions:

1 - How can i make it so that it defaults to PDF? Heres the code:

Private Sub cmdEmailInvite_Click()
On Error GoTo Err_cmdEMailInvite_Click

Dim stDocName As String

stDocName = "Training Confirmation"
DoCmd.SendObject acReport, stDocName, , "", "", "", "Training
Confirmation" & numCourse, "Dear Delegate Blah Blah Blah"

Exit_cmdEMailInvite_Click:
Exit Sub

Err_cmdEMailInvite_Click:
MsgBox Err.Description
Resume Exit_cmdEMailInvite_Click

End Sub

2 - So the Subject Line reads "Training Confirmation:" - how do i get it to
say: "Training Confirmation: <<CourseName>> <<CourseStartDate>> to
<<CourseEndDate>>

3 - How do i get the "To" in the email address populated with the email
addy? (The email addy is a field in my db)

4 - Lastly... (And this is prob the most difficult)... Some courses have
Pre-Reading which is a pdf document the delegates would need to read before
they attend the training. Now when i designed the tables i noticed i could
add an attachment field to each course so i did that and then attached the
actual pdf doc to each course. How can i get access to also attach the pdf
to the email?
 
D

Daniel Pineault

1. What version of Access are you working with?

2.Try something like :
"Training Confirmation: " & [Forms]![tblBooking subform1].Form.[CourseName]
& " " & [Forms]![tblBooking subform1].Form.[CourseStartDate] & " to " &
[Forms]![tblBooking subform1].Form.[CourseEndDate]

3. If I understand the question properly, it would be the same method as for
2. Try something like:
[Forms]![tblBooking subform1].Form.[addy]

4. Sadly SendObject will not permit attachments (outside of Access object)
so you will have to use an alternate method to accomplish this. Outlook
automation can be used in this instance (many other methods are available).
See http://www.devhut.net/index.php?lang=en&pid=0000000013#OutlookAuto for a
sample automation function that you can use. The final input variable is
your attachment.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.



ant1983 said:
First some background. Ive created a Training Booking Database that the end
user will use to book clients on various training courses.

The main output (report) for the db is a report called
rptTrainingConfirmation which is basically just that. It runs off a query
and the Unique ID in that query is autTrainingSessionID. The criteria in
that field is "[Forms]![tblBooking subform1]![numTrainingSessionID]" as the
end user click the cmdEmailInvite button that opens the report, drags the
info in the report and then attached it to an email.

Now the questions:

1 - How can i make it so that it defaults to PDF? Heres the code:

Private Sub cmdEmailInvite_Click()
On Error GoTo Err_cmdEMailInvite_Click

Dim stDocName As String

stDocName = "Training Confirmation"
DoCmd.SendObject acReport, stDocName, , "", "", "", "Training
Confirmation" & numCourse, "Dear Delegate Blah Blah Blah"

Exit_cmdEMailInvite_Click:
Exit Sub

Err_cmdEMailInvite_Click:
MsgBox Err.Description
Resume Exit_cmdEMailInvite_Click

End Sub

2 - So the Subject Line reads "Training Confirmation:" - how do i get it to
say: "Training Confirmation: <<CourseName>> <<CourseStartDate>> to
<<CourseEndDate>>

3 - How do i get the "To" in the email address populated with the email
addy? (The email addy is a field in my db)

4 - Lastly... (And this is prob the most difficult)... Some courses have
Pre-Reading which is a pdf document the delegates would need to read before
they attend the training. Now when i designed the tables i noticed i could
add an attachment field to each course so i did that and then attached the
actual pdf doc to each course. How can i get access to also attach the pdf
to the email?
 

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