Rename caption using code

G

Guest

I am using the following which is called in a cmdBtn sub
Private Sub SendEmail()

On Error GoTo Err_SendEmail

Dim strEmail1 As String
Dim strMailSubject As String
Dim strMsg As String
Dim strDoc As String
strDoc = "Flight_Summary_for_Flight_" & FlightID.Value
strEmail1 = "(e-mail address removed)" & vbNullString
strMailSubject = "Flight Summary for Flight " & FlightID.Value
strMsg = "I am attaching the latest Flight Summary Report."
DoCmd.Rename strDoc, acReport, "rptForEmail"
DoCmd.SendObject acSendReport, "Flight_Summary_for_Flight_" &
FlightID.Value, acFormatSNP, strEmail1, , , strMailSubject, strMsg,
True
DoCmd.Rename "rptForEmail", acReport, strDoc

Exit_SendEmail:
Exit Sub

Err_SendEmail:
MsgBox Err.Description
Resume Exit_SendEmail

End Sub

This does indeed change the name of the report, but does not change the name
in the email attachment. So I am thinking I need to change the caption, but
can't find the right syntax.

Teach me to fish! Thanks for the help.
Pax, M
 
J

Jeff Boyce

Have you looked into the .Caption property? (check Access HELP)

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

I had looked there before posting. But, I did go back at your suggestion.
My problem was I was not opening the report before trying to change the
caption. Once that was changed, it worked great. Thanks for making me think!
 

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

Similar Threads


Top