T
Ted
i use the following vba code in a button on the mainform ("Screening Log
(Review Only)" in my a2k application:
Private Sub FilterDates_Click()
On Error GoTo Err_FilterDates_Click
With Me.[DaysView].Form
If .FilterOn Then
.FilterOn = False 'Turn the filter off.
lngGreen = RGB(0, 150, 0)
Me.FilterDates.ForeColor = lngGreen
Else
.Filter = "[DateOfVisit] >= Date()"
.FilterOn = True
lngRed = RGB(225, 0, 0)
Me.FilterDates.ForeColor = lngRed
End If
End With
If Me.FilterDates.ForeColor = lngRed Then
Me.FilterLbl.Visible = True
Me.Close.Visible = False
Me.NavigationButtons = False
Else
Me.FilterLbl.Visible = False
Me.Close.Visible = True
Me.NavigationButtons = True
End If
Exit_FilterDates_Click:
Exit Sub
Err_FilterDates_Click:
MsgBox Err.description
Resume Exit_FilterDates_Click
End Sub
the button is intended to limit the user's ability to view records in a
nested/child subform (called 'DaysView') which had 'DateOfVisit' earlier than
"today's", or to put it another way, the intent is to view only records in
'DaysView' dated "today" and after. the rest is pretty much "there" for the
interested reader to see for himself.
the point of this posting is attributable to what i feel is a quirky way
that the applcation behaves when you click the filter button a 2nd time, i.e.
to remove the filter from the 'DaysView' subform. what i mean by that is that
even if your cursor is positioned on a control in the subform, when you
'unfilter' it, the next thing the user sees is that he's been transported to
the first control on the "Screening Log (Review Only)" main form and that the
main form is displaying the first record in the database's data. this is kind
of a hassle for the user, since, he or she needs to manually locate the
appropriate record in the database in order to be able to view its subform's
data. does this make sense? does it have some way to shortcircuit that
behavior?
thanks in advance,
when the filter is activated i want a label appearing above the filtering
button (both of which are sitting on the mainform) to appear and for the
filterinng buttons text to display in red.
(Review Only)" in my a2k application:
Private Sub FilterDates_Click()
On Error GoTo Err_FilterDates_Click
With Me.[DaysView].Form
If .FilterOn Then
.FilterOn = False 'Turn the filter off.
lngGreen = RGB(0, 150, 0)
Me.FilterDates.ForeColor = lngGreen
Else
.Filter = "[DateOfVisit] >= Date()"
.FilterOn = True
lngRed = RGB(225, 0, 0)
Me.FilterDates.ForeColor = lngRed
End If
End With
If Me.FilterDates.ForeColor = lngRed Then
Me.FilterLbl.Visible = True
Me.Close.Visible = False
Me.NavigationButtons = False
Else
Me.FilterLbl.Visible = False
Me.Close.Visible = True
Me.NavigationButtons = True
End If
Exit_FilterDates_Click:
Exit Sub
Err_FilterDates_Click:
MsgBox Err.description
Resume Exit_FilterDates_Click
End Sub
the button is intended to limit the user's ability to view records in a
nested/child subform (called 'DaysView') which had 'DateOfVisit' earlier than
"today's", or to put it another way, the intent is to view only records in
'DaysView' dated "today" and after. the rest is pretty much "there" for the
interested reader to see for himself.
the point of this posting is attributable to what i feel is a quirky way
that the applcation behaves when you click the filter button a 2nd time, i.e.
to remove the filter from the 'DaysView' subform. what i mean by that is that
even if your cursor is positioned on a control in the subform, when you
'unfilter' it, the next thing the user sees is that he's been transported to
the first control on the "Screening Log (Review Only)" main form and that the
main form is displaying the first record in the database's data. this is kind
of a hassle for the user, since, he or she needs to manually locate the
appropriate record in the database in order to be able to view its subform's
data. does this make sense? does it have some way to shortcircuit that
behavior?
thanks in advance,
when the filter is activated i want a label appearing above the filtering
button (both of which are sitting on the mainform) to appear and for the
filterinng buttons text to display in red.