Linking a sub report with unbound fields

MarionD

Registered User.
Local time
Today, 03:47
Joined
Oct 10, 2000
Messages
425
Hi there,

Is there any way to link a sub report to a main report with unbounf fields?

I have a form where I put in Person _ID and Month end Date. By a button I print a report noting different detail for the Month. At the bottom I need to print a summary for the year per person. I have tried using year(MEdate), naming the unbounf filed MEDATE. Also on the Sub-Reprot I have the same unbound field (using the stored Month end Date).

Now although the fields display correctly, the sub-report still shows all records for the Person_ID instead of only the ones from the current year.

Thanks for Advice (in Advance)
M
 
How and when are the unbound fields in the report being set? I could imagine something like:

Code:
Me.NameOfUnBoundField = Forms!NameOfForm!FieldName

in the report open. Is that how? Also please post a screen shot of how you have the link fields set up.
 
Both the Main Report and the subreport are based on tables which have a date stored in them (called Arbdatum). On the Report I have an unbound field with the contents set as =year(arbdatum).

Also in the Sub Report I have the same field "Arbdatum" and an unbound field with control source =year(Arbdatum)

Now I want to link the Contents of the subreport to this field in the mainreport.
 
It doesn't appear that you can use the link fields for this but in the attached test database I did have some luck setting the subreports filter in the on load event of the main report. The code is:

Code:
Private Sub Report_Load()

Me.rptChild.Report.Filter = "Year(arbdatum) = " & Me.ArbdatumYr
Me.rptChild.Report.FilterOn = True


End Sub

Here rptChild is the name of the subreport control and ArdatumYr is the name of the unbound textbox on the main report that has =year(arbdatum) as a control source.
 

Attachments

WOW! Thanks a Million Steve.....works like a charm!
 

Users who are viewing this thread

Back
Top Bottom