Email a report in Access 2007

S

StanTheMan

I can't email/publish/save_as a report from Access 2007 unless I use .snp. I
downloaded the pdf/xps add-on from MS but when I go to publish or email I get
an error message. It basically says "Can't save to output data to file you
have selected". Then it gives fives "excuses", one being that the file may be
open. Another about having enough disk space. I have plenty. Can you help me
out on this?
Thanks
Stan
 
D

derek

I can't email/publish/save_as a report from Access 2007 unless I use .snp. I
downloaded the pdf/xps add-on from MS but when I go to publish or email I get
an error message. It basically says "Can't save to output data to file you
have selected". Then it gives fives "excuses", one being that the file may be
open. Another about having enough disk space. I have plenty. Can you help me
out on this?
Thanks
Stan

If you use outlook then
this work for me

there is another way that does require out look but I have got it to
work yet
Public Sub SendOutlookMessage( _
email_ad As String, _
strEmailCCAddress As String, _
strEmailBccAddress As String, _
strSubject As String, _
strMessage As String, _
blnDisplayMessage As Boolean, _
Optional myAttachments As String)


'* Copy this code and paste it into a new Access
'* Module. Click Tools > References and make sure
'* that "Microsoft Office Outlook x.0 Object Library"
'* is checked.
'*
'* This subroutine sends an e-mail message through
'* MS Outlook. If the "blnDisplayMessage" parm is
'* set to "False", the message is placed in the
'* Outlook Outbox. "True" displays the message, and
'* user will have to click "Send" to send it.
'*
'* Ex.:
'*
'* SendOutlookMessage _
'* "(e-mail address removed)", _
'* "(e-mail address removed)", _
'* "(e-mail address removed)", _
'* "Subject", _
'* "Body of Message", _
'* False, _
'* "C:\My Documents\MyAttachmentFile.txt"

Dim myApp As New Outlook.Application
Dim myMsg As Outlook.MailItem
Dim objOutlookRecipient As Outlook.Recipient
Dim myAttach As Outlook.attachments
Dim blnOutlookInitiallyOpen As Boolean
Dim strProcName As String
Dim Path As String
Path = DLookup("variable", "var", "varname ='GenusExport'")
On Error Resume Next
Set myMsg = myApp.CreateItem(olMailItem)
Set myAttach = myMsg.attachments
With myMsg
myAttach.Add Path & "1_Silviculture_Activity.txt"
myAttach.Add Path & "2_Silvicutlure_stratum_History.txt"
myAttach.Add Path & "3_Silvicutlure_Stocking_Status_History_I.txt"
myAttach.Add Path & "4_Silvicutlure_Stocking_Status_History_S.txt"
myAttach.Add Path & "5_Silvicutlure_Survey_Pest_Infestion.txt"
myAttach.Add Path & "6_Silvicutlure_Survey_Species.txt"

.Subject = " Genus import files"

.Body = "Here are the Genus upload tables generated from SAP." &
Chr(13) & _
"Notes:" & Chr(13) & "1) These files are comma delimited." & Chr(13)
& _
"2) Using this import may produce a double activity in Genus." &
Chr(13) & _
"If you have any problems please contact (e-mail address removed)" &
Chr(13) & _
"Thank You" & Chr(13) & Chr(13) & _
" your name"

.To = email_ad
.Display
DoEvents
End With
End Sub
 
S

StanTheMan

Thanks for your response but since I seldom use Access you guys are beyond my
knowledge. You say, "Copy code and paste into new Access Module". I am lost
on this meaning. Also, when I open Access 2007, there is no "Tools" tab.
Is it possible to get more clarification on your instructions?
Thanks
Stan
 
D

derek

I can't email/publish/save_as a report from Access 2007 unless I use .snp. I
downloaded the pdf/xps add-on from MS but when I go to publish or email I get
an error message. It basically says "Can't save to output data to file you
have selected". Then it gives fives "excuses", one being that the file may be
open. Another about having enough disk space. I have plenty. Can you help me
out on this?
Thanks
Stan

sorry I thought you wanted a button that when pushed would email a
report.

Your problem may mean

1) The report is actually open ie you saved the report then opened it
in pdf to see if it worked and then did not close it then when you run
it again it can't replace it because it still open in the back ground.

2) When you generate the report you are forgetting something and it is
not closing the file properly. Ie there is no end of file that why it
thinks you don't have enough room.

3) Be careful look at the path where you stored the report ie some
functions in Access (especially when working in third party apps )
still need the old DOS (8 character naming). Strange but true but try
linking to a dbase format file c:\mydata2007.mdb

Don't put weird character in your path name or file name.

c:\myreport@xxx\payroll.pdf

Be careful how you name your files. ie don't rule out leaving spaces
and multiple . in file name which should work but not always
c:\my reports\payroll.pdf or example myfile.10.txt
try
c:\My_Reports\payroll_10.pdf

do not know if this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top