Using Check boxes to select reports

G

Guest

I am a noobie, I have built a database that has 1 form getting it's
information from 1 table. this form sends the information to several reports
and autofills the information from the table to the fields in each report.

what I would like to do is (without having to learn VB) make check boxes in
the form that allow the user to choose the reports they want to print, and
have a print button that will control it all.

with that in mind, I would like the check boxes to only allow the currently
information in the form (and the coresponding report) to print once they are
selected.

Any suggestions?

Paul M
 
A

Allen Browne

You will need to learn some VBA to achieve the interface you describe.

For an example of how to create an option group so the user can select one
to print, open the Northwind sample database that installs with Access. Open
the form named Sales Report Dialog in design view, and examine how it is set
up.

For an example of how to limit the report to just the record selected in
your form, see:
Print the record in the form
at:
http://allenbrowne.com/casu-15.html
 
G

Guest

Allen,

this did help some, though the Northwind database has alot to offer, there
is nothing that helps me.

example... if I have 7 (seven) check boxes and each one controls (when
checked) if a report is printed or not, I want to be able to check 5 out of
the 7 and have the print button print only those with the current information
being viewed.

like I said, the Northwind Data base was little or no help, but the
information you supplied was 10 times more helpful.

Paul M

P.S. the code you had one your web site did teach me a little about VB
 
A

Allen Browne

Okay, you want to be able to select multiple reports to print, not a report
in an option group (as Northwind does.)

Your code will need to OpenReport for each checkbox that is checked. This
example assumes a check box named "chkReport1", and - if checked -
"Report1" is to open, limited to the value in the ID (Number field) in the
form, when you click the command button named "cmdPreview":

Private Sub cmdPreview_Click()
Dim strWhere As String
Dim lngMode As Long

lngMode = acViewPreview
strWhere = "[ID] = " & Me.[ID]

If Me.chkReport1 = True Then
DoCmd.OpenReport "Report1", lngMode, , strWhere
End If

If Me.chkReport2 = True Then
DoCmd.OpenReport "Report2", lngMode, , strWhere
End If

'etc.
End Sub

If you wanted the reports to print instead of previewing, change line 2 to:
lngMode = acViewNormal
 
G

Guest

If there were one word to describe how helpful this information was, I don't
think it exists on this planet.

AWESOME, FANTASTIC, PERFECT AND ON TARGET!

Thank you Allen Browne for this more then just useful information, I don't
know what I would have done without it.

Warmest Regards,

Paul M

Allen Browne said:
Okay, you want to be able to select multiple reports to print, not a report
in an option group (as Northwind does.)

Your code will need to OpenReport for each checkbox that is checked. This
example assumes a check box named "chkReport1", and - if checked -
"Report1" is to open, limited to the value in the ID (Number field) in the
form, when you click the command button named "cmdPreview":

Private Sub cmdPreview_Click()
Dim strWhere As String
Dim lngMode As Long

lngMode = acViewPreview
strWhere = "[ID] = " & Me.[ID]

If Me.chkReport1 = True Then
DoCmd.OpenReport "Report1", lngMode, , strWhere
End If

If Me.chkReport2 = True Then
DoCmd.OpenReport "Report2", lngMode, , strWhere
End If

'etc.
End Sub

If you wanted the reports to print instead of previewing, change line 2 to:
lngMode = acViewNormal
--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Paul M said:
this did help some, though the Northwind database has alot to offer, there
is nothing that helps me.

example... if I have 7 (seven) check boxes and each one controls (when
checked) if a report is printed or not, I want to be able to check 5 out
of
the 7 and have the print button print only those with the current
information
being viewed.

like I said, the Northwind Data base was little or no help, but the
information you supplied was 10 times more helpful.

Paul M

P.S. the code you had one your web site did teach me a little about VB
 

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