How to print mainform and subform together?

J

jck

I designed a form with a main form on top and a subform at the bottom. The
main form is automatically populated by data from a query whereas the subform
is linked to a blank table for data entry. When I printed the form, only the
main form showed up in the printout. The subform didn't. I tried various
property options but nothing worked. Could someone tell me what was wrong?

I read some answers here that said we're not supposed to print from forms.
But I have been printing out forms for ages. Although I haven't worked with a
mainform/subform situation. I'm designing this form for multiple users and I
want to keep the steps as simple as possible. I want the users to be able to
print out a hard copy after filling out the form. Also, is there a way to
insert page break so one record will print on one page?

I'm not a programer so I don't know code designs. I'm using Access 2003.
I'll really appreciate it if someone can help me with these.

JCK
 
J

John W. Vinson

I designed a form with a main form on top and a subform at the bottom. The
main form is automatically populated by data from a query whereas the subform
is linked to a blank table for data entry. When I printed the form, only the
main form showed up in the printout. The subform didn't. I tried various
property options but nothing worked. Could someone tell me what was wrong?

I read some answers here that said we're not supposed to print from forms.
But I have been printing out forms for ages. Although I haven't worked with a
mainform/subform situation. I'm designing this form for multiple users and I
want to keep the steps as simple as possible. I want the users to be able to
print out a hard copy after filling out the form. Also, is there a way to
insert page break so one record will print on one page?

I'm not a programer so I don't know code designs. I'm using Access 2003.
I'll really appreciate it if someone can help me with these.

JCK

Forms are designed for onscreen use; Reports are designed for printing.
Neither does the other's job at all well.

You can open a Form in design view and choose File... Sava As and save it as a
Report. However, a Report and Subreport may not get you the ideal appearance,
especially if you have multiple child records on the subform. Instead you can
use a Report's Sorting and Grouping to display the mainform data on a section
header, and the subform data in the detail section. This will not be a
challenge for the user since - with a bit of help from the form wizard - you
can put a command button on the form to print the form's data on the saved
report.
 
R

Rick Brandt

John said:
Forms are designed for onscreen use; Reports are designed for
printing. Neither does the other's job at all well.

You can open a Form in design view and choose File... Sava As and
save it as a Report. However, a Report and Subreport...[snip]

Just wanted to point out that when you have a form with a subform and "Save
as" a report. You end up with ONE new report based on the main form and
that main report will have within it a reference to your original subfFORM,
not to a new subreport. You have to separately "Save As" a report all of
the subforms, and then you have to change the main report to reference those
instead of the subforms.

I got burned by that long ago when I opened the report in design view and
started making changes to what I thought was a new subreport only to
discover I was actually messing with my subform object.

John is absolutely correct that most cases of data edited via form/subform
do not need to be printed with report/subreport, but rather with grouping
levels in a single report.
 
J

jck

Thanks for your help! I tried the Save as in the form yesterday and only
mainform was printed in report. I'm not quite sure how to work with the
Sorting and Grouping function in report as John suggested. I'll see whether I
can figure it out and report back.

Thanks very much for the answers! This is the first time I asked a question
here and I love the support!

JCK

Rick Brandt said:
John said:
Forms are designed for onscreen use; Reports are designed for
printing. Neither does the other's job at all well.

You can open a Form in design view and choose File... Sava As and
save it as a Report. However, a Report and Subreport...[snip]

Just wanted to point out that when you have a form with a subform and "Save
as" a report. You end up with ONE new report based on the main form and
that main report will have within it a reference to your original subfFORM,
not to a new subreport. You have to separately "Save As" a report all of
the subforms, and then you have to change the main report to reference those
instead of the subforms.

I got burned by that long ago when I opened the report in design view and
started making changes to what I thought was a new subreport only to
discover I was actually messing with my subform object.

John is absolutely correct that most cases of data edited via form/subform
do not need to be printed with report/subreport, but rather with grouping
levels in a single report.
 
J

jck

Okay, I tried the Save as in the form. The report still comes out with only
main form showing. I tried to put the subform into detail section and it
didn't work because the report still linked to the query that populated the
main form, not the subform. I tried to use Save as for the separate subform
and I couldn't. Access wouldn't let me to save it as a report. I also tried
the Sorting and Grouping function. It only shows fields from the main form so
I wasn't sure how I could use it to pull those fields from the subform in.
What did I miss?

I'm using Access 2003. I'm not sure whether that makes a difference.

I'm back to where I was: I can print the mainform without any problem in
either Form or Report but not the subform. Any tips will be appreciated.

JCK
 
J

John W. Vinson

Okay, I tried the Save as in the form. The report still comes out with only
main form showing. I tried to put the subform into detail section and it
didn't work because the report still linked to the query that populated the
main form, not the subform. I tried to use Save as for the separate subform
and I couldn't. Access wouldn't let me to save it as a report. I also tried
the Sorting and Grouping function. It only shows fields from the main form so
I wasn't sure how I could use it to pull those fields from the subform in.
What did I miss?

Create a Query joining the *tables* (not the forms) upon which the main and
subform are based. Use this query as the basis of the report. Use a criterion
like

=Forms!yourmainform!controlname

to display just the results related to the form's primary key.

Use the Report's sorting and grouping feature to group by the primary key of
the parent table; make the header and/or footer visible. Put the mainform
fields in the header, and the subform fields in the detail section.

Launch this report from the form; put a line

DoCmd.RunCommand acCmdSaveRecord

prior to launching the report in order to save the current form's data to
disk.
 

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