-----Original Message-----
Hi,
There are 2 events which may come in usefull here. The On Filter and On
Apply Filter.
The On Filter event fires when the user goes into Filter mode. In this
event, you could set a global variable to indicate that a filter has been
set. The Apply Filter event fires when you apply a filter. In here you could
set your glabal variable to indicate that the filter has been applied.
The 2 events also have arguments - FilterType for On Filter and ApplyType
for On Apply Filter. Using both of these arguments together will indicate
what filter view the user went into (filter by form or advanced) and if a
filter was applied. Look in the help files for more info on how to use
these. Anyway an example is as follows:
--------------------------
' Global Variable in General Declarations section
Dim blnInFilterByForm As Boolean
Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
' Set global variable to indicate that a filter has been applied/removed
' Either way, the form is no longer in Filter-By- Form Mode
blnInFilterByForm = False
End Sub
Private Sub Form_Filter(Cancel As Integer, FilterType As Integer)
' Check to see which filter view the user has gone to
If FilterType = acFilterByForm Then
' Set the global variable to indicate that the user is viewing the
form in Filter-By-Form mode
blnInFilterByForm = True
End If
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
' See if the F1 key was pressed
If KeyCode = vbKeyF1 Then
' Check to see if in Filter-by-Form mode
If blnInFilterByForm Then
' Display a message box
MsgBox "Pressing F1 Key while in Filter-by- Form mode."
End If
' Reset the keycode so that help isnt displayed
KeyCode = 0
End If
End Sub
--------------------------
I havnt tested the code avbove so i hope it works ok.
Good luck!
Neil.
.
Thanks Neil, that all makes a lot of sense, i can