Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter From Main Form 3

Status
Not open for further replies.

pbundrant

Technical User
Feb 24, 2002
51
US
Hi,

Can someone please tell me the code for a command button(on main form) to filter a subform(query based), Progress field for the number 100?

Access 2010

TYIA,
Patty
[ponytails]
 
Several ways to do it. You can set the sub filter property, change the source query, or use a master child link.

Using the filter it would be something like

dim subfrm as access.form
dim strFilter as string
set subFrm = me.nameofsubformcontrol.form
subfrm.filter = "Progress = 100"
subfrm.filteron = true
 
Thanks, I'll see if it works tomorrow.

Have a good one!

Patty
 
MajP,

Well I put the code in the on click event, it doesn't work.

Private Sub cmdFilter100Percent_Click()

Dim subfrm As Access.Form
Dim strFilter As String
Set subfrm = Me.cmdFilter100Percent.Form
subfrm.Filter = "Progress = 100"
subfrm.FilterOn = True

End Sub

Any other suggestions?

Patty [ponytails]
 
What is the name of the subform's control ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Not sure what you're referring to by subform's control?

Main Form: frmDataEntryForm
Main Form Command Button: cmdFilter100Percent

Sub Form: frmLianzi_MDR_Form_Updates
Sub Form Field to be filtered: Progress
 
So, replace this:
Set subfrm = Me.cmdFilter100Percent.Form
with this:
Set subfrm = Me.frmLianzi_MDR_Form_Updates.Form

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you!!!

You are so cool!
Yes, I messed it up to begin with.

Thanks so much y'all,
Patty
 
Hi, me again,

How can I change this to exclude the 100 and include everything else under and the nulls?

subfrm.Filter = "Progress = 100"

something like "Progress < 100 or """
that doesn't work.

TYIA,
Patty
 
Did you try:
"Progress < 100 OR Progress IS NULL"


Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top