Pulling information from master/detail tables for report

  • Thread starter Thread starter Jacques Steinman
  • Start date Start date
J

Jacques Steinman

The heading basically says it all. I have finished the master and detail
tables and forms. Now I need to be able to print a report based on my
selection from the master table, obviously including the corresponding info
from the detail table.

I'd like to be able to do my selections from within a new form. Any
suggestions?


ps: Thanks for all the help so far. You guys have been a big help.
 
Actually, the approach for reports is near identical to a form.

Simply build your report based the "main" parent table, and for the details,
create a sub-report..and then drop that sub-report into the report (place it
in the details section...it will "grow" for each set of child records.

So, just like a form automatic displays the child records, the report will
do the same.

To print the current record (and the child details) that you looking at, you
can launch the report to the ONE record you are looking at with the
following code:


if me.dirty = true then
me.dirty = false
endif
' the above code forces a disk write of our data since that's what the
report is going to be based on

docmd.OpenReport "nameOfReport",acViewPreview,,"id = " & me!id

Replace "id" with the name of your primary key field (main form).
 
Back
Top