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

Reading A File and Emailing it's Contents

Status
Not open for further replies.

WhtChoklat

Technical User
Jul 11, 2003
20
0
0
US
I am trying to email a file that I am generating from a report. The file is being created successfully, but I am getting an error when I try to read the information or email it, I am not sure where the error is occuring. Here is my coding:

Dim txtTO, txtCC, txtBCC, txtSubject, txtMessage, message As String
Dim outFile, filename, date1, path, ext As String
Dim f, ts

MyDate = Date
date1 = Format(MyDate, "mmm d yyyy")
path = pathname
ext = ".rtf"
filename = "Minutes_" + date1
outFile = path + filename + ext
DoCmd.OutputTo acOutputReport, "Minutes - Report", acFormatRTF, outFile, False

Set f = outFile
Set ts = f.OpenAsTextStream(ForWriting, TristateUseDefault)
message = ts.ReadAll
ts.Close

txtTO = "riche@pjm.com"
txtCC = ""
txtBCC = ""
txtSubject = "Today's CMB Minutes"
txtMessage = message
DoCmd.SendObject acSendReport, "Minutes - Report", acFormatRTF, txtTO, txtCC, txtBCC, txtSubject, txtMessage, False

I hope someone can help me or at least point me in the right direction. Thanks in advance
 
Duplicate from thread222-601952...WhtChoklat please just post an update of where you are at in your original thread so that all solutions stay on the same track and people know what has been tried. Please post this update of your code back in your original thread and also included what the text of the error is that you are getting and use the debugger to see what line the error is pointing you to.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top