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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email from Access without Outlook 1

Status
Not open for further replies.

nikky

Programmer
Feb 7, 2002
80
US
Is it possible to have a form that sends and email automatically (without opening a mail program) if you use another email program than Outlook, like Eudora or Netscape Mail ?
 
Yes, use the MAPI/CDO interface. There is lots of documentation on it.

Gary
gwinn7
A+, Network+
 
If you're talking about email containing only text retrieved from database and/or database objects as attachments, check the SendObject method in your help file. It should work fine with the default email client on the computer.

Remember that SendObject has an annoying bug in Access 2000 - after sending one email, it won't do anything, not even throw an error message until Access is restarted.

To send independant elements (file attachments), you'll need CDO as Gary said. Do a search on Google for CDONTS.

Good luck


[pipe]
Daniel Vlas
Systems Consultant

 
davlas,

Okay I have a form "FA Request". Once data is submitted a report "Failure Analysis Report" appears containing the data. I have written a bunch of code to send the data in an email but it only works with Outlook. This is not sent as an attachment just as text in an email.

Here is a copy of the code:
===============================================================
stDocName = "Failure Analysis Report"
mytext = "Your request has been submitted." + Chr(13) + Chr(10)
mytext = mytext + "TRN:" + [TRN] + Chr(13) + Chr(10)
mytext = mytext + "NPIE:" + [NPIE] + Chr(13) + Chr(10)
mytext = mytext + "p/n:" + [p/n] + Chr(13) + Chr(10)
mytext = mytext + "Vendor:" + [Vendor] + Chr(13) + Chr(10)
mytext = mytext + "Vendor p/n:" + [Vendor p/n] + Chr(13) + Chr(10)
mytext = mytext + "Base Number:" + [Base Number] + Chr(13) + Chr(10)
mytext = mytext + "Serial Number:" + [Serial Number] + Chr(13) + Chr(10)
mytext = mytext + "Reference Designator:" + [Reference Designator] + Chr(13) + Chr(10)
mytext = mytext + "Instance:" + [Instance] + Chr(13) + Chr(10)
mytext = mytext + "Proto Number:" + [Proto Number] + Chr(13) + Chr(10)
mytext = mytext + "Lot Code:" + [Lot Code] + Chr(13) + Chr(10)
mytext = mytext + "Date Code:" + [Date Code] + Chr(13) + Chr(10)
mytext = mytext + "Area:" + [Area] + Chr(13) + Chr(10)
mytext = mytext + "OS:" + [OS] + Chr(13) + Chr(10)
mytext = mytext + "Latent Days:" + [Latent Days] + Chr(13) + Chr(10)
mytext = mytext + "Classcode:" + [Classcodes] + Chr(13) + Chr(10)
mytext = mytext + "Commodity:" + [Commodity] + Chr(13) + Chr(10)
CreateDate = Me![Case Creation].Value
mytext = mytext + "Case Creation Date:" + CreateDate + Chr(13) + Chr(10)
FailDate = Me![Date of Failure].Value
mytext = mytext + "Date of Failure:" + FailDate + Chr(13) + Chr(10)
Rem ExpectedClosure = Me![Expected Closure].Value
Rem mytext = mytext + "Expected Closure Date:" + ExpectedClosure + Chr(13) + Chr(10)
mytext = mytext + "Comments:" + [Comments] + Chr(13) + Chr(10)
mytext = mytext + "Failure Dump:" + [Failure Dump] + Chr(13) + Chr(10)

MsgBox mytext

Me.Refresh

DoCmd.SendObject acSendNoObject, , acFormatTXT, [NPIE] + "@company.com", "fa@company.com" + "," + , , "Failure Analysis Request-" + [p/n], mytext, False
DoCmd.OpenReport stDocName, acPreview, , "[TRN]= '" & Me!TRN & "'"
DoCmd.Close acForm, "FA Request"
=============================================================

I am trying to implement your suggestion, since it sounds like it will use the default email to send the message.

Here is what I have so far:
=============================================================
DoCmd.SendObject acSendReport, Report_FailureAnalysisRequest, acFormatTXT, [NPIE] + "@company.com", "fa@company.com" + "," + [email], , "Failure Analysis Request-" + [p/n], mytext, No
=============================================================

What am I missing? =)

Thanks for your help,
Christina
 
I believe you need the quotes surrounding the report name:

DoCmd.SendObject acSendReport, "Report_FailureAnalysisRequest", acFormatTXT, [NPIE] + "@company.com", "fa@company.com" + ";" + , , "Failure Analysis Request-" + [p/n], mytext, No

And try using the semicolon as list separator instead of comma.

And Chr(13)+Chr(10) can be successfully replaced by vbCrLf (in code, not in query expressions)

HTH


[pipe]
Daniel Vlas
Systems Consultant

[URL unfurl="true"]http://www.geocities.com/danvlas/AutoMail.html[/URL]
 
Okay one last question, I promise. =)

How do I get it to send only the last report and not a summary of ALL reports?

Thanks again!
Christina
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top