My Assistant
![]() ![]() |
|
|
Apr 22 2011, 06:19 PM
Post
#1
|
|
|
UtterAccess Addict Posts: 170 |
Hello UA,
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 KR |
|
|
|
Apr 22 2011, 06:41 PM
Post
#2
|
|
|
Access Wiki and Forums Moderator Posts: 48,645 From: SoCal, USA |
Hi KR,
Check out the Filter property. You might end up with something like: If Me.Checkbox = True Then Me.Filter = "FieldName='open'" Else Me.Filter = "FieldName='closed'" End If Me.FilterOn = True Hope that helps... |
|
|
|
Apr 22 2011, 07:00 PM
Post
#3
|
|
|
UtterAccess VIP Posts: 4,162 From: Washington, USA |
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 Else [Form_YourSubFormName].FilterOn = False End If HTH, Daniel |
|
|
|
Apr 24 2011, 03:36 AM
Post
#4
|
|
|
UtterAccess Addict Posts: 170 |
Guys thanks for the info. That was exactly what I was looking for!
~KR |
|
|
|
Apr 24 2011, 10:44 AM
Post
#5
|
|
|
UtterAccess VIP Posts: 4,162 From: Washington, USA |
Glad to help! (IMG:style_emoticons/default/smile.gif)
Cheers, (IMG:style_emoticons/default/cheers.gif) Daniel |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 20th June 2013 - 03:39 AM |