can't email report as attachment when opened via vba

Mr.K

Registered User.
Local time
Today, 03:36
Joined
Jan 18, 2006
Messages
104
Hi; I have a report which when opened via the Database Window can be easily sent as an email attachment in various formats using the menu File->Send to... etc..

However, when I open the same report via VBA with:
Code:
DoCmd.OpenReport "rptRegistrationList", acPreview
the attachment that gets created is all weird. It looks nothing like the report (more like a datasheet view) and it displays no data. Also in this second scenerio when I try to "Send to as attachment" the choice of FileFormats is all different and for example the Snapshot Format is not even listed.

What am I doing wrong?
 
how are you trying to send the report from the preview window? Are you right-clicking and selecting sendtp from there?, or some other method

you are maybe sending the form you used to open the report, or the underlying query in vba, not the report.
 
gemma-the-husky said:
how are you trying to send the report from the preview window? Are you right-clicking and selecting sendtp from there?, or some other method

you are maybe sending the form you used to open the report, or the underlying query in vba, not the report.

I'm using the menubar button: send report as an attachment. This button works fine when I open the report through the db window, but it doesn't when I open the report via vba. I think you're right about sending the underlying query - it looks like that is what happens. Why does it happen and how can I fix it?
 

Users who are viewing this thread

Back
Top Bottom