UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

2 Pages V   1 2 >  
Reply to this topicStart new topic
> Exporting a Report to Word file to e-mail    
 
   
quest4
post Jul 8 2008, 12:55 PM
Post #1

UtterAccess Ruler
Posts: 1,884
From: Cleveland, OH



Good afternoon, I am trying to have a report save to a file that can be opened after it is e-mail to someone. I have tried several types in Output To, like snapshot and rich text and HTML, but they all want me to select a program to open them and so they are no good. Is there a way that I could export the report to Word and be saved as a file in My Documents? I figure that way I can then compress it and send it and it will open easily. I am using Access2000 with Windows XP Pro. My mail, if it is important, would be Roadrunner Web Mail. An thoughts or ideas here will be deeply appreciated. Thank you in advance for any assistance.
Go to the top of the page
 
+
theDBguy
post Jul 8 2008, 01:02 PM
Post #2

Access Wiki and Forums Moderator
Posts: 47,901
From: SoCal, USA



Have you tried using the SendObject method?
Go to the top of the page
 
+
quest4
post Jul 8 2008, 01:10 PM
Post #3

UtterAccess Ruler
Posts: 1,884
From: Cleveland, OH



Thanks for the reply and as I stated yes I have and I have problems opening the saved document, as I stated, snapshot won't open and rich tex and html don't know what to open with. Rich text looks great if you tell it to use Word. The people who will be using this have very littel computer knowledge so the more automated the better. I do have a DAO procedure for doing this thruogh Outlook and and our mail sever, but this is going to be through and ISP and so I will try to get this to do as much as I can. Thanks again.
Go to the top of the page
 
+
HiTechCoach
post Jul 8 2008, 01:27 PM
Post #4

UtterAccess VIP
Posts: 18,394
From: Oklahoma City, Oklahoma



QUOTE
... as I stated, snapshot won't open and rich tex and html don't know what to open with.

That may not be Access issue but a Windows file association issue. Are you sure that the file name has the correct extension ( .snp, .rtf, or .htm)

Do you have the snapshot viewer installed to view a snapshot file ( .snp extension)?

How are you trying to open the file? Are you just double-clicking on it in Explorer? If not try this to verify the file association is correct.

Are you trying to open the file with VBA code? If yes, then what code are you using?
Go to the top of the page
 
+
quest4
post Jul 8 2008, 02:16 PM
Post #5

UtterAccess Ruler
Posts: 1,884
From: Cleveland, OH



Thanks again for the response. I just tried that SendObject with a snapshot and I recieved it in my e-mail and it opened alright. But this is going to be done on an different computer and there is no Outlook on that one, but there is roadrunner web mail and that is why I kind of looked at creating a file to e-mail. I am not sure how to get this into RR's web mail. It would be great if I could use it. Thanks.
Go to the top of the page
 
+
theDBguy
post Jul 8 2008, 03:29 PM
Post #6

Access Wiki and Forums Moderator
Posts: 47,901
From: SoCal, USA



Sorry I missed that detail earlier...

When using the OutputTo method, are you doing something like:

DoCmd.OutputTo acOutputReport, "yourreport", acFormatSNP, "c:\documents and settings\yourprofile\my documents\report.snp"

Hope that helps...
Go to the top of the page
 
+
quest4
post Jul 8 2008, 03:44 PM
Post #7

UtterAccess Ruler
Posts: 1,884
From: Cleveland, OH



Thanks again for the response, theDBug. I think I have read too much code, but where wouold I put that code? Currently I am using a macro to print the report and then something like send object and then a quick select query to clean up things. Thanks again.
Go to the top of the page
 
+
theDBguy
post Jul 8 2008, 06:51 PM
Post #8

Access Wiki and Forums Moderator
Posts: 47,901
From: SoCal, USA



If I understand you correctly, you cannot use SendObject because you have no mail client installed on the machine, that's why you had to use web mail.

If you want to use a macro, use the OutputTo Action and put the location where you want to save the file in the proper parameter/argument for the command.

Hope that helps...
Go to the top of the page
 
+
HiTechCoach
post Jul 8 2008, 07:09 PM
Post #9

UtterAccess VIP
Posts: 18,394
From: Oklahoma City, Oklahoma



QUOTE
... But this is going to be done on an different computer and there is no Outlook on that one, but there is roadrunner web mail ...

You probably can use SMTP to send the email. I use it with ISP's that offer web based emaill.

Something like:
CODE
' SEND EMAIL VIA SMTP USING CDOEX/CDOSYS
Sub prcSendMail(pstrFrom,pstrTo,pstrCC,pstrBCC,pstrSubject,pstrBody)
  Const cstrSMTPServer = "NAMEOFYOURSMTPSERVER"
  Const cintCDOSendUsingPort = 2
  Dim objConfig, objMsg

  If (Len(pstrFrom & "") > 0) And (Len(pstrTo & "") > 0) And (Len(pstrSubject & "") > 0) And (Len(pstrBody & "") > 0) Then
    Set objConfig = CreateObject("CDO.Configuration")
    objConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cintCDOSendUsingPort
    objConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = cstrSMTPServer
    objConfig.Fields.Update
    Set objMsg = CreateObject("CDO.Message")
    Set objMsg.Configuration = objConfig
    objMsg.From = pstrFrom
    objMsg.To = pstrTo
    If Len(pstrCC & "") > 0 Then objMsg.CC = pstrCC
    If Len(pstrBCC & "") > 0 Then objMsg.BCC = pstrBCC
    objMsg.Subject = pstrSubject
    objMsg.HTMLBody = pstrBody
    objMsg.Send
    Set objMsg = Nothing
    Set objConfig = Nothing
  End If
End Sub


Hope this helps ...
Go to the top of the page
 
+
quest4
post Jul 9 2008, 09:01 AM
Post #10

UtterAccess Ruler
Posts: 1,884
From: Cleveland, OH



Thanks you HiTech for that response, you seem to understand what I am trying to do. I do have one last dumb question, do I put this in as a modual or as a sub in the report. Basically where am I putting this? Thanks again for the help and do I have to turn on any references? Thanks again for all of the help.
Go to the top of the page
 
+
quest4
post Jul 9 2008, 12:00 PM
Post #11

UtterAccess Ruler
Posts: 1,884
From: Cleveland, OH



I do now have a couple of questions, first do I find of the name of my sMTP Server? Is the the PC that will have the dbase on it? Where do i put the e-mail address? Where do I put the from? I looking at this I really don't see a format like snapshot. And one last thing, do I put this in as a module and in the macro use run code or just how do I do this? thanks again for the help.
Go to the top of the page
 
+
quest4
post Jul 9 2008, 01:07 PM
Post #12

UtterAccess Ruler
Posts: 1,884
From: Cleveland, OH



Oh another dumb question, with the SMTP server, do I want the IP address or the name? Thanks again.
Go to the top of the page
 
+
theDBguy
post Jul 10 2008, 10:26 PM
Post #13

Access Wiki and Forums Moderator
Posts: 47,901
From: SoCal, USA



I'm not sure if an IP address will work, but the name of your RoadRunner SMTP Server will definitely work.

Hope that helps...
Go to the top of the page
 
+
teabags
post Sep 10 2010, 02:23 PM
Post #14

UtterAccess Veteran
Posts: 419
From: Ireland



QUOTE (HiTechCoach @ Jul 9 2008, 01:09 AM) *
You probably can use SMTP to send the email. I use it with ISP's that offer web based emaill.

Something like:
CODE
' SEND EMAIL VIA SMTP USING CDOEX/CDOSYS
Sub prcSendMail(pstrFrom,pstrTo,pstrCC,pstrBCC,pstrSubject,pstrBody)
  Const cstrSMTPServer = "NAMEOFYOURSMTPSERVER"
  Const cintCDOSendUsingPort = 2
  Dim objConfig, objMsg

  If (Len(pstrFrom & "") > 0) And (Len(pstrTo & "") > 0) And (Len(pstrSubject & "") > 0) And (Len(pstrBody & "") > 0) Then
    Set objConfig = CreateObject("CDO.Configuration")
    objConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cintCDOSendUsingPort
    objConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = cstrSMTPServer
    objConfig.Fields.Update
    Set objMsg = CreateObject("CDO.Message")
    Set objMsg.Configuration = objConfig
    objMsg.From = pstrFrom
    objMsg.To = pstrTo
    If Len(pstrCC & "") > 0 Then objMsg.CC = pstrCC
    If Len(pstrBCC & "") > 0 Then objMsg.BCC = pstrBCC
    objMsg.Subject = pstrSubject
    objMsg.HTMLBody = pstrBody
    objMsg.Send
    Set objMsg = Nothing
    Set objConfig = Nothing
  End If
End Sub


Hope this helps ...

Hello,

I copied your sub in to my module.

Private Sub cmdSend_Click()
prcSendMail
End Sub

But I get arguement not optional error (using access 2003).

Any ideas where I am going wrong?

Thank you.

This post has been edited by teabags: Sep 10 2010, 02:24 PM
Go to the top of the page
 
+
theDBguy
post Sep 10 2010, 02:44 PM
Post #15

Access Wiki and Forums Moderator
Posts: 47,901
From: SoCal, USA



Hi teabags,

In case HiTechCoach is not watching this thread...

The proper use of that function is something like:

Private Sub cmdSend_Click()
prcSendMail "FromAddress", "ToAddress", "CCAddress", "BCCAddress", "Subject", "EmailBody"
End Sub

Hope that helps...
Go to the top of the page
 
+
teabags
post Sep 10 2010, 02:48 PM
Post #16

UtterAccess Veteran
Posts: 419
From: Ireland



QUOTE (theDBguy @ Sep 10 2010, 08:44 PM) *
Hi teabags,

In case HiTechCoach is not watching this thread...

The proper use of that function is something like:

Private Sub cmdSend_Click()
prcSendMail "FromAddress", "ToAddress", "CCAddress", "BCCAddress", "Subject", "EmailBody"
End Sub

Hope that helps...

Hello,

I forgot that I had to pass arguements in the brackets, rookie mistake (IMG:style_emoticons/default/kickbutt.gif)

Thank you.
Go to the top of the page
 
+
theDBguy
post Sep 10 2010, 03:42 PM
Post #17

Access Wiki and Forums Moderator
Posts: 47,901
From: SoCal, USA



Hi,

(IMG:style_emoticons/default/yw.gif)

We all make mistakes some times. Good luck with your project.
Go to the top of the page
 
+
richard93312
post Sep 17 2010, 11:27 AM
Post #18

UtterAccess Member
Posts: 36
From: Bakersfield, Ca. USA



I am looking at the code and I don't see where the user name and password is authenticated. Did I miss something?
Go to the top of the page
 
+
theDBguy
post Sep 18 2010, 01:37 PM
Post #19

Access Wiki and Forums Moderator
Posts: 47,901
From: SoCal, USA



Hi Richard,

Check out this link for the additional steps to include authentication.

Hope that helps...
Go to the top of the page
 
+
richard93312
post Oct 7 2010, 11:23 AM
Post #20

UtterAccess Member
Posts: 36
From: Bakersfield, Ca. USA



Thank you. Now sending email with attachments via SMTP.
Go to the top of the page
 
+

2 Pages V   1 2 >
Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th May 2013 - 08:42 AM