peterslove53
asked on
How do i open a subform to a filtered record from another form
I am trying to open a subform to a specific filtered record (ID = ID from anotherform)
but i am not getting any filtered records even when i use the syntax below.
where "NotesAssignment" is the form having the subform i want filtered.
the two forms (mainform and NotesAssignment) have a common field (report_id and Ext_rept_urn )
DoCmd.OpenForm "NotesAssignment", acNormal, , "report_id='" & Ext_rept_urn & "'"
but i am not getting any filtered records even when i use the syntax below.
where "NotesAssignment" is the form having the subform i want filtered.
the two forms (mainform and NotesAssignment) have a common field (report_id and Ext_rept_urn )
DoCmd.OpenForm "NotesAssignment", acNormal, , "report_id='" & Ext_rept_urn & "'"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Figured out another route. Just making a split form and hiding the display region solves it
The code below will toggle between displaying filtered data and unfiltered data on a subform (and incidentally change the caption on the button that applies/removes the filter). It uses a literal for filtering, but you can easily swap in your code using a variable. Let me know if this needs more explanation. :)
PCG
<><>
If Me.btnFilterAdv.Caption = "Show Adv" Then 'records are unfiltered
Me.RevenuePreparationSubFr
Me.RevenuePreparationSubFr
Me.RevenuePreparationSubFr
Me.btnFilterAdv.Caption = "Remove Filter"
Else
'Me.RevenuePreparationSubF
Me.RevenuePreparationSubFr
Me.RevenuePreparationSubFr
Me.btnFilterAdv.Caption = "Show Adv"
End If
<><>