KeaganQuilty
06-29-2001, 08:39 AM
On my Main Form I have an option group that determines which of three subforms are displayed. I am currently changing the SourceObject property of the subform window to display them. All three subforms have a "Category" field, and I was wondering if there is any way of applying a filter to the form before it is displayed.
Keagan Quilty
Kilbride, Newfoundland
D-Fresh
06-29-2001, 09:18 AM
I'm not sure if this is what you're looking for but you could create 3 seperate subforms and set the visible property to false. Then depending on which option you select, set the particular subforms visible property to true. Hope this helps.
Doug
KeaganQuilty
06-29-2001, 09:50 AM
No. That's not the problem I'm having.
In VBA Code, you can do this.
Dim strWhere as string
Dim strFormName as string
strWhere = "Category = '" & cboCategories & "'"
strFormName = "frmPollingData"
Docmd.OpenForm strFormName,acFormDS,,strWhere
What I do now is this.
Select Case grpScope
Case 1
subFormWindowName.SourceObject = "frmPollingData"
Case Else
.......
End Select
Is ther eany way of filtering the SourceObject with the wherecondition of the DoCmd?
Keagan Quilty
Kilbride, Newfoundland
D-Fresh
06-29-2001, 10:08 AM
Okay, after you set the source for the subform window, do the following...
Me![SubFormName].Form.Filter = strWhere
Me![SubFormName].Form.FilterOn = True
This will set the filter of the subform to your where criteria. Hope this helps.
Doug