Change Report Title before Emailing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

On the cmdUpdate_Click button, the record is appended to the permanent file,
a report is generated and emailed, and the form is cleared for the next
record.

I would like to append the date to the report title. The date currently
prints as part of the subject line of the email, but I do not want the
recipient to have to change/edit the document name.

I posted on the Report page but have not received a reply.
 
On the cmdUpdate_Click button, the record is appended to the
permanent file, a report is generated and emailed, and the form
is cleared for the next record.

I would like to append the date to the report title. The date
currently prints as part of the subject line of the email, but I
do not want the recipient to have to change/edit the document
name.

I posted on the Report page but have not received a reply.
Use the form's Open Event to set
me.caption = "ReportFilename " & format(now(),"yyyymmdd")
 
On the cmdUpdate_Click button, the record is appended to the permanent file,
a report is generated and emailed, and the form is cleared for the next
record.

I would like to append the date to the report title. The date currently
prints as part of the subject line of the email, but I do not want the
recipient to have to change/edit the document name.

I posted on the Report page but have not received a reply.



You could rename the report just before you send it, then rename it
back to the original name after it's sent.
..
Private Sub cmdUpdate_Click()

' Do any updating or whatever you need here

Dim strName As String
strName = "OriginalReportName"

Dim strNewName As String
strNewName = Format(Date(),"mm/dd/yyyy") & strName

On Error GoTo Err_Handler

' Rename the report to include the date
DoCmd.Rename strNewName, acReport, strName

' Do your emailing stuff here

Exit_cmdUpdate_Click:
' Reset Report name back to the original
DoCmd.Rename strName, acReport, strNewName
Exit Sub

Err_Handler:
Resume Exit_cmdUpdate_Click

End Sub

You may need to add additional error handling.
 
Back
Top