Report of Individual Record with Related Fields

  • Thread starter Thread starter Les Coover
  • Start date Start date
L

Les Coover

TableA 1 to many> TableB 1 to many> TableC
Referential Integrity Enforced, Cascade Update/Delete

Form has two subfroms. Print Record Command
button on form. As long as first subform has
the first record selected the hardcopy is correct
(Subform with correct associated SUBSUBFORM
records). However, when subsequent subform
records are selected the current view "jumps
back" to the first subform record when the
print command button is clicked. I have
struggled with this for many hours to no avail.

Do I need to create a report to do this? How
to I create a report that will be "synchronized"
to the current view of my form? I only need
that current view. If I use the Print Screen
key and paste the copy into Word I get what
I want, but isn't there a better way to do this?

Thanks,

Les
 
Yes, you need to use a report, and just build sub-reports to mirror you
forms layout.
Do I need to create a report to do this? How
to I create a report that will be "synchronized"
to the current view of my form?

You might have to "code" the record source for the sub-reports.

You can use the on-open event of the sub-report


strSql = "select * from tblChild where main_id = " & forms!MainForm!ID

or, perhaps

strSql = "select * from tblChild where main_id = " &
forms!MainForm.MySubfromTableB!ID

me.RecordSouce = strSql

If the whole report can be correctly driven from the ONE main record, and
the "master/link child" fields..then you need NONE of the above.

And, the code to print only the current record in a report is:

me.Refresh
docmd.OpenReport "yourReport",,,"id = " & me.id
 
Thank you Albert for the help.

In the database I have tblAgencies 1 to many > tblDivisions
1 to many > tblAgents

I can make a report that will list Agencies with all related
divisions in the agency and for each division all related agents.

So here's the problem. What I really want is just a "snapshot"
of a particular scenario. The form provides this as when a
particular division is selected only the agents for THAT division
are shown (but there's the hardcopy problem). So if I make
the report it will be lengthier than I need.

Second problem. The advantage of the form is that it is easy
to quickly find an Agency and get associated information. Now
if I want a hardcopy I have to go to the report scroll through
until I find the agency and then print that particular page.

Can you help me get started on this by showing me how I
can jump directly from the form to the record and then
print a "snapshot".

Thanks,

Les
 
Back
Top