Here is what I am trying to do - i have a report in MS access called "DocProcurement". it is based off of a query. the query can have many records in it. the report shows all records from the query. i want to open the report one record at a time from the query (based on email address), save it, and send the report in email. The report should only have the info from one record in the query, then move on to the next record, create it and send it out, etc... Here is what i have: - Sub CreateEachEmail()
-
-
Dim Rst As ADODB.Recordset
-
Dim FaxNumber As String
-
Dim PhoneNumber As String
-
Dim SendFaxTo As String
-
Dim x As Integer
-
Dim Msg As String
-
Dim numToEmail As Integer
-
Dim UserName As String
-
Dim blnClosed As Boolean
-
Dim address As String
-
Dim Atest As ClassEmailFunctions
-
Dim strEmail As String
-
-
-
x = 0
-
-
Set Rst = New ADODB.Recordset
-
With Rst
-
.Open "qryFaxList", cnn, adOpenStatic
-
.MoveFirst
-
While Not (.EOF Or x = numToEmail)
-
-
-
Do Until x = numToEmail Or .EOF
-
FaxNumber = Rst![CAFax]
-
PhoneNumber = Rst![CAPhone]
-
SendFaxTo = Nz(Rst![CAName], "CLOSING AGENT")
-
address = Rst![CAEmail]
-
-
-
If Rst![NumberOfDocs] < 1000 Then
-
-
Else
-
GoTo RS_MoveNext
-
End If
-
-
-
strEmail = address
-
-
Set Atest = New ClassEmailFunctions
-
-
Atest.ToAdd (strEmail)
-
Atest.Subject = "IMPORTANT DOCUMENTS REQUIRED"
-
Atest.Body = "PLEASE SEE ATTACHED REPORT FOR DOCUMENTS REQUIRED"
-
-
DoCmd.OpenReport "DocProcurement", acViewPreview, "", , acNormal
-
DoCmd.Close acReport, "DocProcurement"
-
DoCmd.OutputTo acReport, "DocProcurement", "RichTextFormat(*.rtf)", "C:\Temp\DocProcurement.rtf", False, "", 0
-
-
Atest.Attachment = ("C:\Temp\DocProcurement.rtf")
-
-
Atest.Send
-
-
RS_MoveNext:
-
-
.MoveNext
-
' x = x + 1
-
Loop
-
-
-
.Close
-
End With
0 934 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Joe User |
last post by:
Hi all....I have a feeling this is going to be one of those twisted query
questions, but here it goes anyways....
I want to generate a report that shows the chronology of events (represented
by...
|
by: Justin Koivisto |
last post by:
I am trying to create a report that displays a name of an advertising
source and count of the number of times it was hit between certain date
ranges. The data is split between two different...
|
by: Greg |
last post by:
I'm fairly new to access (using 2002) and am setting up a DB for work.
along with each record the user also needs to make a flow diagram
(previously, these reports were composed in word and they...
|
by: ghadley_00 |
last post by:
MS Access Create form / report with multiple pages using different
background images
Hi,
Would like to have users fill out a multipage form, and then click a
print button, which pulls up the...
|
by: MLH |
last post by:
I have a source query (qryITSLetterList) feeding rows containing name,
addr, city, state, zip and VehicleID to a report (rptITSnotices). The
query may contain 1-to-5 records resulting in 1-to-5...
|
by: kevinj |
last post by:
Greetings,
I am creating a "stoplight" type report that is based on the number of days between dates, the field will be highlighted in red, yellow, or green. I am able to change the background...
|
by: seawolf |
last post by:
Is there a way to create a numbering for the Details in an Access 2003 Report. For instance, if a report has 12 records that make up the Details in a report, can these be numbered, i.e., 1, 2, 3, 4,...
|
by: KiwiGenie |
last post by:
I have a form which lists selected records, there could be anything from 1 record to all records selected. I want to output a report for each record as HTML. I want each file to take its name from a...
|
by: maxx429 |
last post by:
Hi all,
I am posting this question for a co-worker. She knows very little about Access but has been asked to create some reports. One the requirements is that the report contain a Pie Chart...
|
by: cowboyjunkey |
last post by:
This is what I want to do:
Each report page will list some details about a sample (like time
sampled, where, who sampled) and below it a chart showing the
distribution of the sample (i.e....
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
| |