Printing Specific Subforms Records

S

szczmj70

I have a subform that is linked to a report that I will run for 2003 Access.
When it runs and prints out, I receive a print-out for each record that is
found in the subform, (ie. 1 record = 1 page. 15 records = 15 pages) How can
I limit the report to printing out 1 page for all the files listed and linked
together?
 
J

John W. Vinson

I have a subform that is linked to a report

How is the *subform* linked to the report? Do you mean that your report
actually references the form object, or is the Report based on the same table
as the Subform? What is the Recordsource property of the report, and how are
you opening the report?
that I will run for 2003 Access.
When it runs and prints out, I receive a print-out for each record that is
found in the subform, (ie. 1 record = 1 page. 15 records = 15 pages) How can
I limit the report to printing out 1 page for all the files listed and linked
together?

Since we have no way to know what "files listed" means all I can say is "use
an appropriate query as the recordsource for the report". Do you want to see
one page with fifteen rows? or just one particular record? if so which?

John W. Vinson [MVP]
 
S

szczmj70

John W. Vinson said:
How is the *subform* linked to the report? Do you mean that your report
actually references the form object, or is the Report based on the same table
as the Subform? What is the Recordsource property of the report, and how are
you opening the report?


Since we have no way to know what "files listed" means all I can say is "use
an appropriate query as the recordsource for the report". Do you want to see
one page with fifteen rows? or just one particular record? if so which?

John W. Vinson [MVP]

The report is based on the same table as the report. I only access the
report to print off the records, so I setup a function button that when I
click on it, it asks we what item number I would like to print and then it
prints it out. I never see the report in this view.

As for the files listed, these are the titles of the documents pertaining to
individual boxes. Each box contains its own specific titles of documents.
Through this I want to see one page with 15 rows.

Any help you can give is appreciated. Thx.
 
J

John W. Vinson

The report is based on the same table as the report.

As the *subform*, do you mean?
I only access the
report to print off the records, so I setup a function button that when I
click on it, it asks we what item number I would like to print and then it
prints it out. I never see the report in this view.

Please post the code behind the button. I can't see it from here said:
As for the files listed, these are the titles of the documents pertaining to
individual boxes. Each box contains its own specific titles of documents.
Through this I want to see one page with 15 rows.

And what DO you see instead? What is the Recordsource of the report?
Any help you can give is appreciated. Thx.

John W. Vinson [MVP]
 
S

szczmj70

1.) Yes, subform is what I meant to say.


2.) Here is the code listed behind the print-option:

Private Sub Print_Box_Click()

DoCmd.Echo False
' Open the report in Preview mode.
DoCmd.OpenReport "R: Box Label", acViewPreview
DoCmd.PrintOut acPages, 1, 3, acHigh, 1, False
DoCmd.Close ' Close the report.
DoCmd.Echo False

End Sub

3.) I see the records that I want, but instead of just getting one page with
all the document titles, I receive pages for all the document titles listed.
And each of the pages that prints out still contains all of the document
titles, not separate files.

4.) The record source is a Query for a label that is attached to the front
of my box.

Sorry if these answers aren't helpful, I'm still learning this program.
 
S

szczmj70

1.) Yes, subform is what I meant to say.


2.) Here is the code listed behind the print-option:

Private Sub Print_Box_Click()

DoCmd.Echo False
' Open the report in Preview mode.
DoCmd.OpenReport "R: Box Label", acViewPreview
DoCmd.PrintOut acPages, 1, 3, acHigh, 1, False
DoCmd.Close ' Close the report.
DoCmd.Echo False

End Sub

3.) I see the records that I want, but instead of just getting one page with
all the document titles, I receive pages for all the document titles listed.
And each of the pages that prints out still contains all of the document
titles, not separate files.

4.) The record source is a Query for a label that is attached to the front
of my box.

Sorry if these answers aren't helpful, I'm still learning this program.
 
J

John W. Vinson

1.) Yes, subform is what I meant to say.


2.) Here is the code listed behind the print-option:

Private Sub Print_Box_Click()

DoCmd.Echo False
' Open the report in Preview mode.
DoCmd.OpenReport "R: Box Label", acViewPreview
DoCmd.PrintOut acPages, 1, 3, acHigh, 1, False
DoCmd.Close ' Close the report.
DoCmd.Echo False

End Sub

3.) I see the records that I want, but instead of just getting one page with
all the document titles, I receive pages for all the document titles listed.
And each of the pages that prints out still contains all of the document
titles, not separate files.

Well... you know what a "Document Title" is and what "files" are in your
context. We don't! It appears that you are opening a report based on a query
which returns all records. If you want just a specific box, you will either
need to change the Query so that it references your form for a criterion, or
add a WhereCondition to the OpenReport line: something like

DoCmd.OpenReport "R: Box Label", acViewPreview, _
WhereCondition := "[BoxNo] = " & Me!txtBoxNo

where BoxNo should be name of the field identifying the specific label you
want printed, and txtBoxNo is the name of a control on the Form containing the
value of the box number that you want.
 
S

szczmj70

John,

Thank you for the help. What you stated makes sense. Sorry for throwing out
the random file names.

John W. Vinson said:
1.) Yes, subform is what I meant to say.


2.) Here is the code listed behind the print-option:

Private Sub Print_Box_Click()

DoCmd.Echo False
' Open the report in Preview mode.
DoCmd.OpenReport "R: Box Label", acViewPreview
DoCmd.PrintOut acPages, 1, 3, acHigh, 1, False
DoCmd.Close ' Close the report.
DoCmd.Echo False

End Sub

3.) I see the records that I want, but instead of just getting one page with
all the document titles, I receive pages for all the document titles listed.
And each of the pages that prints out still contains all of the document
titles, not separate files.

Well... you know what a "Document Title" is and what "files" are in your
context. We don't! It appears that you are opening a report based on a query
which returns all records. If you want just a specific box, you will either
need to change the Query so that it references your form for a criterion, or
add a WhereCondition to the OpenReport line: something like

DoCmd.OpenReport "R: Box Label", acViewPreview, _
WhereCondition := "[BoxNo] = " & Me!txtBoxNo

where BoxNo should be name of the field identifying the specific label you
want printed, and txtBoxNo is the name of a control on the Form containing the
value of the box number that you want.
 

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