Printing Only Selected Sections of Report

D

Duck

I have a form which I am developing for an optometric firm. The form
is used to generate invoices for client orders. The form is one
continuous form but I have it divided into four sections with several
controls in each section. The sections are for Frames, Lenses,
Contact Lenses, and Misc. I also have four check boxes which I use to
activate/deactivate all the controls in each individual section of the
form.

I want to generate an invoice from the form which will only print out
the values from the sections that are active when the form is
complete. I want to think that I can create a subreport for each
section and make the section not print if it's corresponding check box
is not checked.

I don't quite know how to accomplish this, and also how to avoid gaps
in the final report (invoice), if some of the subreports are not
printed.
 
B

bhipwell via AccessMonster.com

Duck,

You have two options to go about solving your issue:

1) You can create one form with all your applicable fields, text boxes,
images, etc. When and if a particular "section" is not required, you can
generate some simple VB code to move all the objects upward on the form,
eliminating the potential gap issue. The problem here is that depending on
the number of objects, the coding can be very lengthy. For example:

If [Frames] = "No" and [Misc] = "No" Then
Me.LensesPrice.Top = 2200
Me.LensesQuanity.Top = 2400
Me.LensesBrand.Top = 2600
Else
If [Frames] = "Yes" and [Misc] = "No" Then
Me.LensesPrice.Top = 3200
Me.LensesQuanity.Top = 3400
Me.LensesBrand.Top = 3600
Else

And so on and so forth for every possibility.

2) Easier option. For each "section" of information you have, Lenses, Frames,
Contacts, Misc., create a subreport. When placing them on the main report,
reduce the vertical height to nearly nothing (.041 or smaller in height) so
they appear as horizontal lines on the report. Make sure the cangrow
property is set to yes and the visibility property is set to no. Then simple
code will make the applicable sections appear when needed while only leaving
a gap of a fraction of a inch, perhaps less than 1/32. Not noticable unless
you plan on having many, many subreports. And even in the case of many, many
subreports, strategic use of page breaks and their visibility can be used.

If [Frames] = "Yes" and [Misc] = "No" Then
Me.FramesSubreport.Visible = True
Me.MiscSubreport.Visible = False
Else

And so on and so forth.

Hope this helps,

B
 

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