Report from Form w/ SubForm

  • Thread starter Thread starter jcrewgrrrl
  • Start date Start date
J

jcrewgrrrl

Got a simple db w/ 2 tables that have a one-to-many relationship. The
one table is incident info. The many table is recommendation(s) for the
incident. The unique id is trc_id (autonumber). It it what joins the
two tables.



I have a form showing incident info. There is a subform showing each
recommendation for the incident.



Currently, I have trc_id on the form but it is not visible. As that
field is the only unique identifier for incidents and attaches all
recommendations to the incident, my thought is to create a filter on
that field that passes to the query which drives the report.



I'd like my user to be able to print all recommendations for an incident
from the form. I'm just not sure where to start. Guidance please?



Thanks in advance!

jcrewgrrrl
 
jcrewgrrrl said:
Got a simple db w/ 2 tables that have a one-to-many relationship. The
one table is incident info. The many table is recommendation(s) for the
incident. The unique id is trc_id (autonumber). It it what joins the
two tables.

I have a form showing incident info. There is a subform showing each
recommendation for the incident.

Currently, I have trc_id on the form but it is not visible. As that
field is the only unique identifier for incidents and attaches all
recommendations to the incident, my thought is to create a filter on
that field that passes to the query which drives the report.

I'd like my user to be able to print all recommendations for an incident
from the form.

Create a report (based a query that joins the two tables on
the trc_id field) that displays all incidents and all their
recommendations. Once that is working, add a command button
to your form to print the report (the button wizard will
generate most of the code in the button's Click event). If
needed modify the wizard generated code to look like:

strDoc = "name of report"
strWhere = "trc_id = & Me.txttrc_id
DoCmd.OpenReport strDoc, acViewPreview,,strWhere

This will filter the report to the incident for the
currently displayed record on the form.
 
Back
Top