D
Dwayne Conyers
In the code segment below, we create an RTF file from a dB query and attach
it to an e-mail. We would like to give the attachment a dynamic name (e.g.,
the variable "foobar") but the SendObject action doesn't support naming...
unless we are misreading the arguments. How can we attach a name to the
object?
<!--
Private Sub Combo7_BeforeUpdate(Cancel As Integer)
On Error Resume Next
foo = Combo7.Value
bar = Combo7.Text
foobar = Trim(bar) & ".doc"
newSQL = "SELECT Report_Types.report_type, Agency_Codes.Agency_Code,
[DHS Reports].Report_Number, classification.classification, [DHS
Reports].Subject, [DHS Reports].Reference, [DHS Reports].Source_Descriptor,
[DHS Reports].Summary, [DHS Reports].Detail, [DHS Reports].Significance,
[DHS Reports].Actions_FU, [DHS Reports].Miscellaneous, [DHS
Reports].Preparer, status.status_text, [DHS Reports].Contact, [DHS
Reports].DOI, [DHS Reports].Release, [DHS Reports].[Report Loc],
reporting.Reporting INTO temp FROM (((([DHS Reports] LEFT JOIN Report_Types
ON [DHS Reports].Report_Type_Key = Report_Types.rpt_type_id) LEFT JOIN
Agency_Codes ON [DHS Reports].Agency_Code_Key = Agency_Codes.ag_cd_id) LEFT
JOIN classification ON [DHS Reports].Classification =
classification.classID) LEFT JOIN reporting ON [DHS Reports].Reporting =
reporting.rptg_id) INNER JOIN status ON [DHS Reports].Status =
status.statusID WHERE ((([DHS Reports].ID)=" & Trim(Str(foo)) & "));"
DoCmd.RunSQL newSQL
DoCmd.SendObject acOutputReport, "e-mail", acFormatRTF, , , , bar,
foobar, True
End Sub
it to an e-mail. We would like to give the attachment a dynamic name (e.g.,
the variable "foobar") but the SendObject action doesn't support naming...
unless we are misreading the arguments. How can we attach a name to the
object?
<!--
Private Sub Combo7_BeforeUpdate(Cancel As Integer)
On Error Resume Next
foo = Combo7.Value
bar = Combo7.Text
foobar = Trim(bar) & ".doc"
newSQL = "SELECT Report_Types.report_type, Agency_Codes.Agency_Code,
[DHS Reports].Report_Number, classification.classification, [DHS
Reports].Subject, [DHS Reports].Reference, [DHS Reports].Source_Descriptor,
[DHS Reports].Summary, [DHS Reports].Detail, [DHS Reports].Significance,
[DHS Reports].Actions_FU, [DHS Reports].Miscellaneous, [DHS
Reports].Preparer, status.status_text, [DHS Reports].Contact, [DHS
Reports].DOI, [DHS Reports].Release, [DHS Reports].[Report Loc],
reporting.Reporting INTO temp FROM (((([DHS Reports] LEFT JOIN Report_Types
ON [DHS Reports].Report_Type_Key = Report_Types.rpt_type_id) LEFT JOIN
Agency_Codes ON [DHS Reports].Agency_Code_Key = Agency_Codes.ag_cd_id) LEFT
JOIN classification ON [DHS Reports].Classification =
classification.classID) LEFT JOIN reporting ON [DHS Reports].Reporting =
reporting.rptg_id) INNER JOIN status ON [DHS Reports].Status =
status.statusID WHERE ((([DHS Reports].ID)=" & Trim(Str(foo)) & "));"
DoCmd.RunSQL newSQL
DoCmd.SendObject acOutputReport, "e-mail", acFormatRTF, , , , bar,
foobar, True
End Sub