473,785 Members | 2,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.sendobjec t 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 4949
bill mahoney wrote:
Hello,
I am using access 2000 and I am trying to email a csv file. I have
only used the docmd.sendobjec t 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*****@anydom ain.com"
oEMail.To "yo*******@your domain.com"
oEMail.BodyForm at = CdoBodyFormatTe xt
oEMail.Body = "Insert some useful text here"
oEMail.Importan ce = CdoHigh
oEMail.AttachFi le "C:\filename.tx t"
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.c om"
Const MailCCRecipient as String = "cc @ anotherdomain.c om"
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.Configurati on
Dim Flds as New CDO.Fields
Dim strAttachment as String

strAttachment = "C:\somefile.tx t"

With Flds
.Item(cdoSMTPSe rver) = "ip address or name of smtp server"
.Item(cdoSMTPSe rverPort) = 25 ' typically
.Item(cdoSendUs ingMethod) = cdoSendUsingPor t
.Item(cdoSMTPCo nnectionTimeout ) = 200
.Item(cdoSMTPAu thenticate) = 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***@alcottgr oup.com> wrote in message
news:fa******** *************** ***@posting.goo gle.com...
Hello,
I am using access 2000 and I am trying to email a csv file. I have
only used the docmd.sendobjec t 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*****@ihates pam.bum> wrote in message news:<Sl******* *************@f e2.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*****@anydom ain.com"
oEMail.To "yo*******@your domain.com"
oEMail.BodyForm at = CdoBodyFormatTe xt
oEMail.Body = "Insert some useful text here"
oEMail.Importan ce = CdoHigh
oEMail.AttachFi le "C:\filename.tx t"
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.c om"
Const MailCCRecipient as String = "cc @ anotherdomain.c om"
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.Configurati on
Dim Flds as New CDO.Fields
Dim strAttachment as String

strAttachment = "C:\somefile.tx t"

With Flds
.Item(cdoSMTPSe rver) = "ip address or name of smtp server"
.Item(cdoSMTPSe rverPort) = 25 ' typically
.Item(cdoSendUs ingMethod) = cdoSendUsingPor t
.Item(cdoSMTPCo nnectionTimeout ) = 200
.Item(cdoSMTPAu thenticate) = 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***@alcottgr oup.com> wrote in message
news:fa******** *************** ***@posting.goo gle.com...
Hello,
I am using access 2000 and I am trying to email a csv file. I have
only used the docmd.sendobjec t 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
341
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 an excerpt from the program Imports System.Web.Mai Imports System.Web.HttpServerUtilit Imports System.Diagnostics Public Class Emailin Inherits System.Web.UI Pag
10
5572
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 recipient addressees to see the report in the body text window of their email when they open it. I was thinking also about attaching the PDF file to the eMail for those having "text only" email software. I need to automate both of these tasks from...
2
1965
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. For example, Joe must take an annual CPR class, Bob needs to take his Hearing Test, Ann must take her Eye Exam. The task table keeps the completed date in it, while the form that displays it calculates the next due date (using dateadd). So, as...
5
7386
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 Run-time error. When I run it on an XP machine it crashes, but on an NT box it just generates an unknown error, handled by the error handler. I have debugged and stepped through the code and have narrowed the issue to the point at which the...
3
2367
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 email. Any ideas? Thanks in advance.
2
1507
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 toolbar it only works intermittently ie. sometimes the email is sent and others nothing happens. Using File/Send on the Outlook menu bar also works intermittently. However if I use the keyboard shortcut: Ctrl + Enter it works every time and the...
4
2600
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 a report called TestReport. I dropped an image control in the report, and imported a .BMP file into it as the report's background, and sent it to back. I then dropped my fields on top of the image.
2
2241
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 smart? what would be a reasonable number? My second question is related to emailing customers who have an anniversary or a Birthday. Is it possible to personalize each email with a name? TIA Tim
8
4196
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 MailMerge for snailMail.
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9953
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.