Apr 22 2011, 06:19 PM
I wish to filter a sub-form column to only show purchase orders that are open or all purchase orders (open or closed) by selecting a checkbox on the main form. I see from the database examples that are out there at MSDN how to do this with a macro expression but I would like to do this with VBA since I am not to confident with my macro expression design yet.
Any links or ideas would be great. I have done some extensive searching and have not found the coding structure required to do this yet. Thanks
Apr 22 2011, 06:41 PM
Check out the Filter property. You might end up with something like:
If Me.Checkbox = True Then
Me.Filter = "FieldName='open'"
Me.Filter = "FieldName='closed'"
Me.FilterOn = True
Hope that helps...
Apr 22 2011, 07:00 PM
You can try this, by using the Filter() option of the Subform;
In the OnClick Event of the Checkbox;
Dim chkPurchased As String
If Me.Check1.Value = True Then
chkPurchased = "[Purchased]='Open'"
[Form_YourSubFormName].Filter = chkPurchased
[Form_YourSubFormName].FilterOn = True
[Form_YourSubFormName].FilterOn = False
Apr 24 2011, 03:36 AM
Guys thanks for the info. That was exactly what I was looking for!
Apr 24 2011, 10:44 AM
Glad to help!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here