T
Trillium97
Hi. I'm using Accesss 2003.
I have a form with a combo box in the form header. The user must select a
workorder before records are shown. The after update event on this combo
box sets a filter on the data to this workorder. We want to minimize coding,
so we want the user to do further filters by using the filter by form (rarely
will they use that button) or the filter by selection (they will use this
button often) icons that are on the standard tool bars. They all like this
and it works great. The problem I'm having is when they remove the filter.
The icon that looks like a little funnel (standard toolbar icon) is either
labeled "Apply Filter" or "Remove Filter" depending on which way it will go.
It toggles between the two. This is all normal.
here's my event code (pardon some of the mess I've been debugging it)
Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
Select Case ApplyType
Case Is = acShowAllRecords '0
If Me.SelectWorkorder > "" Then
Me.Filter = "WONumber = '" & Me.SelectWorkorder & "'"
Else
Me.SelectWorkorder .SetFocus
MsgBox "Please select a workorder", vbOKCancel + vbInformation,
"Need selection"
End If
Cancel = True
Case Is = acApplyFilter '1
MsgBox "applying filter: " & Me.Filter
End Select
End Sub
What I want is that if the user clicks Apply Filter, let it do its filter.
If the user clicks Remove Filter, set the filter to the workorder instead of
really showing all the records.
What I'm gettting is that ApplyType is always set to 1, no matter what. This
event always fires on the click of that button, and it always tells me
ApplyFilter is 1. But the tool works properly, it either applies the filter
or shows all records, and I can't figure out how to capture the Remove Filter
before it shows all the records so I can reset the filter to the workorder
and quit confusing the users.
Any suggestions please?
I have a form with a combo box in the form header. The user must select a
workorder before records are shown. The after update event on this combo
box sets a filter on the data to this workorder. We want to minimize coding,
so we want the user to do further filters by using the filter by form (rarely
will they use that button) or the filter by selection (they will use this
button often) icons that are on the standard tool bars. They all like this
and it works great. The problem I'm having is when they remove the filter.
The icon that looks like a little funnel (standard toolbar icon) is either
labeled "Apply Filter" or "Remove Filter" depending on which way it will go.
It toggles between the two. This is all normal.
here's my event code (pardon some of the mess I've been debugging it)
Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
Select Case ApplyType
Case Is = acShowAllRecords '0
If Me.SelectWorkorder > "" Then
Me.Filter = "WONumber = '" & Me.SelectWorkorder & "'"
Else
Me.SelectWorkorder .SetFocus
MsgBox "Please select a workorder", vbOKCancel + vbInformation,
"Need selection"
End If
Cancel = True
Case Is = acApplyFilter '1
MsgBox "applying filter: " & Me.Filter
End Select
End Sub
What I want is that if the user clicks Apply Filter, let it do its filter.
If the user clicks Remove Filter, set the filter to the workorder instead of
really showing all the records.
What I'm gettting is that ApplyType is always set to 1, no matter what. This
event always fires on the click of that button, and it always tells me
ApplyFilter is 1. But the tool works properly, it either applies the filter
or shows all records, and I can't figure out how to capture the Remove Filter
before it shows all the records so I can reset the filter to the workorder
and quit confusing the users.
Any suggestions please?