Choosing a report based on field in subform

G

Guest

I am creating a database based on certain safety procedures for particular
areas of the business. In my main form I am using combo boxes to choose the
area and floor of the business and receiving the related data in the embedded
subform. One field in the subform is a Safety Procedure Number. From this
subform, I would like to print/preview a report that matches this Safety
Procedure Number. Is this possible?
 
G

Guest

I can think of a couple of different ways.

1. Create a report for each procedure and launch the report using the
procedure number. for example

DoCmd.OpenReport Me.txtProcNum.Value & "Report", acViewPreview

2. If all reports are the same regardless of the procedure number change the
criteria of the report when launched.
 
J

John Vinson

I am creating a database based on certain safety procedures for particular
areas of the business. In my main form I am using combo boxes to choose the
area and floor of the business and receiving the related data in the embedded
subform. One field in the subform is a Safety Procedure Number. From this
subform, I would like to print/preview a report that matches this Safety
Procedure Number. Is this possible?

Sure. Simply base the Report on a Query which uses the Safety
Procedure Number as a criterion:

=[Forms]![Mainformname]![Subformcontrol].Form![txtSPN]

This assumes that your main form is named Mainformname; that it
contains a Subform Control named Subformcontrol; and that on the form
within that subform there is a textbox named txtSPN. The form must be
open and the desired record on the subform must be selected (active)
for this to work.

John W. Vinson[MVP]
 

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