D
Dave Fernandez
I have been working a similar problem, with limited
success. Here is what I got to work. It is based on the
form showing data already in the database.
1. Create a query with search criteria based on the form
and selecting the information for the e-mail
2. Create a report from the query to get formatting and
text.
3. In the click event procedure for a button on the form:
Dim fs, f, ts
Dim inputx As String
Dim filespec As String
filespec = "C:\temp\holdadvice.txt"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.CreateTextFile(filespec, True)
f.Close
Set f = Nothing
DoCmd.OutputTo acOutputReport, "ShippingAdviceA", "MS-
DOS Text ", filespec
Set f = fs.OpenTextFile(filespec, 1, TristateFalse)
inputx = CStr(f.ReadAll)
f.Close
Set f = Nothing
Set fs = Nothing
DoCmd.SendObject , , , , , , "Shipping
Advice",inputx,yes
The above a) runs the report out to a text file. b) reads
the text file into a string variable. c) puts the data
from the text file into the message body (sending "no
object")
This works as far as it goes. But I still have a
big "gotcha". When I run the routine more than once, it
will not bring up Notes. No error message is produced.
Let me know if you have any luck.
success. Here is what I got to work. It is based on the
form showing data already in the database.
1. Create a query with search criteria based on the form
and selecting the information for the e-mail
2. Create a report from the query to get formatting and
text.
3. In the click event procedure for a button on the form:
Dim fs, f, ts
Dim inputx As String
Dim filespec As String
filespec = "C:\temp\holdadvice.txt"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.CreateTextFile(filespec, True)
f.Close
Set f = Nothing
DoCmd.OutputTo acOutputReport, "ShippingAdviceA", "MS-
DOS Text ", filespec
Set f = fs.OpenTextFile(filespec, 1, TristateFalse)
inputx = CStr(f.ReadAll)
f.Close
Set f = Nothing
Set fs = Nothing
DoCmd.SendObject , , , , , , "Shipping
Advice",inputx,yes
The above a) runs the report out to a text file. b) reads
the text file into a string variable. c) puts the data
from the text file into the message body (sending "no
object")
This works as far as it goes. But I still have a
big "gotcha". When I run the routine more than once, it
will not bring up Notes. No error message is produced.
Let me know if you have any luck.