Subform for current record only to show on report

rainymac

Registered User.
Local time
Today, 09:22
Joined
Nov 4, 2002
Messages
12
I have a form with a subform and a Report Preview cmd coded to open the report for only the current record. This is successful, however, the report shows the subform info for all the records.

I've tried to tinker with the code to do the same for the subform as it does for the form (to show only current record info), but no success yet.

Please help
 
I managed to do this by adding an hidden unbound field on the main form that holds the primary key field for the subform record(that I changed in the subforms current event using

Private Sub Form_Current()
Me.Parent.SubIDfld = Me.SubID
End Sub

Then in the recordsource in the subreport reference the hidden unbound field as criteria for the records.
 
Thank you very much to Fornatian for your help. I regret that I didn't get to use it though. As usual, after I have taken an issue & blown a huge bubble out of it, something simple occurs to me.

I was using my subform as the source for the subreport object. So I corrected this issue by making a new subreport, just as I did the subform for the main form. Each report shows only the info for each record and Looking good !

Now my only issue is that my code to preview just the current record with its current subreport records is still being ignored and is previewing all record reports. Without the subreport, the cmd works fine.

I really appreciate you folks for taking the time out to help others. This forum has been a great help. Hope I can return the favor sometime.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom