D
Dale Fye
I've got a shortcut menu that I'm using for all of my reports. It includes a
print option, a Send as PDF option, and a close option.
Because of the limitiation of the SendObject method to send a filtered
report, I've written some code to save the report as a temporary file,
automate Outlook, attach the file, display the message, and delete the temp
file. Generally, this will only occur with a single record in the report, so
I could get the [Title] value associated with that record by setting a
reference to the report, and then looking at the value of the control in the
report. However, when the report has multiple records, I cannot do this, so
I need to concatenate the list of [Title] values into the filename.
I've tried the following, but the recordset that the RecordSource property
returns is all the records in the table.
Set rs = CurrentDb.OpenRecordset(Screen.ActiveReport.RecordSource)
'rs.Filter = screen.ActiveReport.Filter
While Not rs.EOF
strFileName = strFileName & "-" & rs("Title")
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
I tried adding the Filter line, but that doesn't seem to do it either,
although it does give me the ID values associated with the filtered records.
I could use that, parse the string, and DLOOKUP() to get the [Title] field
associated with each record in the report, but that seems like an awful lot
of work.
Anybody have any ideas?
print option, a Send as PDF option, and a close option.
Because of the limitiation of the SendObject method to send a filtered
report, I've written some code to save the report as a temporary file,
automate Outlook, attach the file, display the message, and delete the temp
file. Generally, this will only occur with a single record in the report, so
I could get the [Title] value associated with that record by setting a
reference to the report, and then looking at the value of the control in the
report. However, when the report has multiple records, I cannot do this, so
I need to concatenate the list of [Title] values into the filename.
I've tried the following, but the recordset that the RecordSource property
returns is all the records in the table.
Set rs = CurrentDb.OpenRecordset(Screen.ActiveReport.RecordSource)
'rs.Filter = screen.ActiveReport.Filter
While Not rs.EOF
strFileName = strFileName & "-" & rs("Title")
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
I tried adding the Filter line, but that doesn't seem to do it either,
although it does give me the ID values associated with the filtered records.
I could use that, parse the string, and DLOOKUP() to get the [Title] field
associated with each record in the report, but that seems like an awful lot
of work.
Anybody have any ideas?