WhereCondition in a subform

KeaganQuilty

Registered User.
Local time
Today, 05:38
Joined
Jun 28, 2001
Messages
51
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
 
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
 
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
 
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
 

Users who are viewing this thread

Back
Top Bottom