Can anyone please help me with the following madness in Access 2003
(2000 file format). I am using 2 similar funtions, the first which
works fine to save reports as snapshots:
On Error Resume Next
DoCmd.OutputTo A_REPORT, Forms!FrontPage!RptName, "Snapshot Format
(*.snp)", , False
and the second which is giving me the problem, to email reports as
snapshots:
'On Error Resume Next
DoCmd.SendObject acSendReport, Forms!FrontPage!RptName, "Snapshot
Format"
End Function
Both these functions are linked to appropriate buttons on a custom
menu bar.
When opened,the reports that are either being saved or sent as email
attachments send their report names to the Forms!Frontpage!RptName
textbox which is then used as the object name in the functions.
For a reason which is beyond me the second function refuses to name
the attached report in Outlook to the name I am giving it from the
textbox and instead names it using the name of a totally unrelated
query in my database, "Q_DataQuery". If I delete the query from the
database, it still uses its name.
If I rename the Forms!Frontpage!RptName textbox to
Forms!Frontpage!RptName2 the function produces an error (as expected)
saying that it can't find the textbox, so it is definitely looking at
the textbox to get the object name, but then not using that name as
the email attachment name. If I use "ManagementRpt" (one of the
report names) as the object name in the function and try to attach
that report to an email, the report name in the email is still
"Q_Dataquery"!
Added to all this, I have to push the "Send" button in Outlook 2003
twice in fairly quick succession to get the email to send.
Either I've really missed something or there's a major bug here
somewhere. Any help would be appreciated.