Filter data in subform with buttons on mainform.

GoodLife22

Registered User.
Local time
Today, 14:36
Joined
Mar 4, 2010
Messages
86
Please see the demo. I am not sure how to describe things sometimes, but the demo will make it more clear.

I have a form [frm_MAIN] with a subform [frm_HISTORY] which each tied to 2 different tables. The tables and forms are linked by a field called [CLIENT] When I have the frm_MAIN open there is a combo field called [cmboCLIENT] which lists my clients.

When frm_MAIN opens, nothing is in the subform yet. Once I select my client from the dropdown [cmboCLIENT] the subform will then show all records associated with that client in a datasheet view.

I want to add a couple buttons onto the [frm_MAIN] which will allow me to filter certain data types in the subform below. My subform is named [frm_HISTORY] and I only want to filter the field [COLOR].

I have never done this and I am not that great with VB so I was hoping some one could show me how with one of my buttons. I will try the rest from there.


 

Attachments

Last edited:
With Me.frm_HISTORY.Form
.Filter = "[COLOR] = Blue"
.FilterOn = True
End With
 
I may not have done this correct but I did...

Private Sub Command10_Click()
With Me.frm_HISTORY.Form
.Filter = "[COLOR] = Blue"
.FilterOn = True
End With
End Sub


And when I execute I get a "Enter Parameter Value" error.
 

Users who are viewing this thread

Back
Top Bottom