473,224 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

Emailing a file using access

Hello,
I am using access 2000 and I am trying to email a csv file. I have
only used the docmd.sendobject command but you can only email objects
that are within the access database ( as far as I can tell anyway). I
need to email a file that is not in my database. Is there another way
I can send an email without using sendobject that would allow me to do
this. Thanks for any help.

Regards,
Bill Mahoney
Nov 12 '05 #1
3 4914
bill mahoney wrote:
Hello,
I am using access 2000 and I am trying to email a csv file. I have
only used the docmd.sendobject command but you can only email objects
that are within the access database ( as far as I can tell anyway). I
need to email a file that is not in my database. Is there another way
I can send an email without using sendobject that would allow me to do
this. Thanks for any help.

Regards,
Bill Mahoney


One way is to reference the Outlook object (assuming that is what you
are using:) and send the email using code (which also allows
attachments)... do a web search for examples.
--
regards,

Bradley
Nov 12 '05 #2
Pat
If you're on an NT-based machine (NT, 2K, XP) it doesn't get any easier
than using CDONTS. The machine must be running the SMTP service and have
access to the internet. You will also need to add a reference to the CDO
library within Access. After this, it's as simple as:

Dim oEMail As New CDONTS.EMail

oEMail.From "an*****@anydomain.com"
oEMail.To "yo*******@yourdomain.com"
oEMail.BodyFormat = CdoBodyFormatText
oEMail.Body = "Insert some useful text here"
oEMail.Importance = CdoHigh
oEMail.AttachFile "C:\filename.txt"
oEMail.Send

Or, if you access to an SMTP server, you might try this CDO routine. You
will still need a reference to the CDO library.

Sub SendEmail()
Const MailSender as String = "sender @ yourdomain.com"
Const MailRecipient as String = "recipient @ anotherdomain.com"
Const MailCCRecipient as String = "cc @ anotherdomain.com"
Const MailSubject as String = "Here's an email with an attachment"
Const MailBody as Strnig = "See the attachment"

Dim iMsg as New CDO.Message
Dim iConf as New CDO.Configuration
Dim Flds as New CDO.Fields
Dim strAttachment as String

strAttachment = "C:\somefile.txt"

With Flds
.Item(cdoSMTPServer) = "ip address or name of smtp server"
.Item(cdoSMTPServerPort) = 25 ' typically
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPConnectionTimeout) = 200
.Item(cdoSMTPAuthenticate) = cdoNTLM
End With

With iMsg
Set .Configuration = iConf
.To = MailRecipient
.CC = MailCCRecipient
.From = MailSender
.Subject = MailSubject
.TextBody = MailBody
.AddAttachment (strAttachment)
.MDNRequested = True 'return receipt on
.Send
End With

End Sub
For a great overview of the many options for email with Access check out
Tony Toews'
website:
http://www.granite.ab.ca/access/email.htm

HTH
Pat
"bill mahoney" <bi***@alcottgroup.com> wrote in message
news:fa**************************@posting.google.c om...
Hello,
I am using access 2000 and I am trying to email a csv file. I have
only used the docmd.sendobject command but you can only email objects
that are within the access database ( as far as I can tell anyway). I
need to email a file that is not in my database. Is there another way
I can send an email without using sendobject that would allow me to do
this. Thanks for any help.

Regards,
Bill Mahoney

Nov 12 '05 #3
"Pat" <no*****@ihatespam.bum> wrote in message news:<Sl********************@fe2.texas.rr.com>...
If you're on an NT-based machine (NT, 2K, XP) it doesn't get any easier
than using CDONTS. The machine must be running the SMTP service and have
access to the internet. You will also need to add a reference to the CDO
library within Access. After this, it's as simple as:

Dim oEMail As New CDONTS.EMail

oEMail.From "an*****@anydomain.com"
oEMail.To "yo*******@yourdomain.com"
oEMail.BodyFormat = CdoBodyFormatText
oEMail.Body = "Insert some useful text here"
oEMail.Importance = CdoHigh
oEMail.AttachFile "C:\filename.txt"
oEMail.Send

Or, if you access to an SMTP server, you might try this CDO routine. You
will still need a reference to the CDO library.

Sub SendEmail()
Const MailSender as String = "sender @ yourdomain.com"
Const MailRecipient as String = "recipient @ anotherdomain.com"
Const MailCCRecipient as String = "cc @ anotherdomain.com"
Const MailSubject as String = "Here's an email with an attachment"
Const MailBody as Strnig = "See the attachment"

Dim iMsg as New CDO.Message
Dim iConf as New CDO.Configuration
Dim Flds as New CDO.Fields
Dim strAttachment as String

strAttachment = "C:\somefile.txt"

With Flds
.Item(cdoSMTPServer) = "ip address or name of smtp server"
.Item(cdoSMTPServerPort) = 25 ' typically
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPConnectionTimeout) = 200
.Item(cdoSMTPAuthenticate) = cdoNTLM
End With

With iMsg
Set .Configuration = iConf
.To = MailRecipient
.CC = MailCCRecipient
.From = MailSender
.Subject = MailSubject
.TextBody = MailBody
.AddAttachment (strAttachment)
.MDNRequested = True 'return receipt on
.Send
End With

End Sub
For a great overview of the many options for email with Access check out
Tony Toews'
website:
http://www.granite.ab.ca/access/email.htm

HTH
Pat
Thanks for the help Pat, it worked great.

Regards,
Bill

"bill mahoney" <bi***@alcottgroup.com> wrote in message
news:fa**************************@posting.google.c om...
Hello,
I am using access 2000 and I am trying to email a csv file. I have
only used the docmd.sendobject command but you can only email objects
that are within the access database ( as far as I can tell anyway). I
need to email a file that is not in my database. Is there another way
I can send an email without using sendobject that would allow me to do
this. Thanks for any help.

Regards,
Bill Mahoney

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bob-O | last post by:
Need your help in sending an email message with an attachment in my VB.Net program. Sending a body message is no problem. I don't know how to use the attachment property in an emai Following is...
10
by: MLH | last post by:
I print to a device that creates a PDF. Knowing the filename, how can I then embed the PDF into the body text of an OutLook Express outbound email & send to a specified address in a table? I want...
2
by: Chuck | last post by:
I have a database that has a table in it with employee information (name, dob, email, etc). This is joined to a table that has tasks that are assigned to each individual that has a recurring date....
5
by: Colin Anderson | last post by:
I discovered, with great excitement, this article http://www.davison.uk.net/vb2notes.asp when researching methods for emailing from Access via Notes. Unfortunatly, when I run this I get a...
3
by: Strasser | last post by:
In Access2000 mass emailing worked perfectly (very powerful tool!). Doesn't work when using XP version of both Access and Outlook, even though I checked the box to ensure that I was sending the...
2
by: Wayne | last post by:
I am experiencing an intermittent problem when emailing snapshot reports using Sendobject. Outlook opens with the snapshot of the report attached but when I click the "Send" button on the Outlook...
4
by: Salad | last post by:
Hi: I have the following line: DoCmd.SendObject acSendReport, "TestReport", _ "SnapshotFormat (*.snp)", _ "joeblow@nowhere.com", , , "Report Test", _ "Does it open correctly?", True I have...
2
by: Tim Hunter | last post by:
I have two questions regarding emailing from Access. My first question relates to how many email addresses is too much. I have a client who wants to email 1500 people at once. Is this possible or...
8
by: marjbell | last post by:
I have a Access database of email addresses that I would like to mass email to customers. Can Access be used through Outlook? or can it just be done with Access? I know it is possible to use...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.