Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I send email automatically from MSAccess using vba code

Status
Not open for further replies.

natatbh

Programmer
Dec 18, 2002
81
US
Using vba code I create a .txt file from one of the tables in my data base. I want to email this file automatically every day. I would like to do this using strictly vba code without having to depend on any email program like Outlook. I also want the email to be sent every day automatically without having to interact manualy with any program. Please let me know how this can be done and if you thind it can't be done I would appreciate any alternative ideas.
Thanks!
natatbh
 
Instead of creating a txt file, create a StringVariable having the same structure and use SendObject. It will use the default email client (at least it should).

Other ways: SMTP using Easymail or JMAIL objects, Winsock and a lot of API...

HTH

[pipe]
Daniel Vlas
Systems Consultant

 
Thanks danvlas,

I don't get what youre trying to tell me. First of all what do you mean by a StringVariable. I want to send a txt file.
Second, by default it uses outlook and my default email client
is not outlook. Any more specific information please let me know.
natabh
 
You can use SENDOBJECT to call you default email program and send the email.
There are some problems with this, for example if you use Netscape Mail, (not Netscape Messenger), the email address won't come thru.
syntax example
DoCmd.SendObject acSendReport, "ReportName", acFormatRTF, Email!Email, , , "Subject Text", , 0

this sends an access report as a rtf attachment to the address email!email and puts "Subject Text" in the subject line

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top