Printing individual reports

B

bladelock

My query look like this:

Catergory V Factor Countfield Action VP
EQ1 Tax 10 Done Tim .P
EQ1 Untax 11 Pending Tim .P
EQ2 Tax 9 Done Sam .S
JW1 Tax 11 Done John .T
JW3 Tax 8 Pending John .T


How can I get my report to print each VP on a different (SNP) file, without
doing it three times. Example:

An SNP file with just Tim .P with 2 records
An SNP file with just Sam .S with 1 record
An SNP file with just John .T with 2 records

I want to get them out individual, to their respectible VP
Thanks
 
P

philip260

My query look like this:

Catergory V Factor Countfield Action VP
EQ1 Tax 10 Done Tim .P
EQ1 Untax 11 Pending Tim .P
EQ2 Tax 9 Done Sam .S
JW1 Tax 11 Done John .T
JW3 Tax 8 Pending John .T

How can I get my report to print each VP on a different (SNP) file, without
doing it three times. Example:

An SNP file with just Tim .P with 2 records
An SNP file with just Sam .S with 1 record
An SNP file with just John .T with 2 records

I want to get them out individual, to their respectible VP
Thanks

Go to design view in access report and group on VP field. and then
force new page after each section
 
R

Rob Parker

You will need to set up some code to do this. And, since you want the
output as .snp files, you will need to use the SendObject method to generate
them, you will need a filter applied to your report to limit it to each
particular VP in turn (since the SendObject method does not support a Where
clause, which is the standard method of limiting a report's recordsource in
the OpenReport method). See the article at
http://support.microsoft.com/kb/299016/en-us for details.

The basic code, except for the filter, will be along these lines:

Public strFilter as String

Private Sub cmdSnpReports_Click()
Dim rst As DAO.Recordset
Dim strSQL As String

strSQL = "SELECT DISTINCT VP FROM qryYourQueryName;"

Set rst = CurrentDb.OpenRecordset(strSQL)
rst.MoveFirst
Do While Not rst.EOF
strFilter = "VP = '" & rst!VP & "'"
DoCmd.SendObject acSendReport, "rptYourReportName", acFormatSNP ...
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
End Sub

HTH,

Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top