Validation data filtering by fields (1 Viewer)

dim

Registered User.
Local time
Yesterday, 22:32
Joined
Jul 20, 2012
Messages
54
Hi

I have a form where I need to verify if two specific fields [Field1] AND [Field2] are filtered.
In the other words I need a code something like:

If me.field1 AND me.field2 are filtered Then
Msgbox "Filter is On"
Else
Msgbox "Filter is Off"
End If

Can you help please?
Thank You!
 

Ranman256

Well-known member
Local time
Yesterday, 22:32
Joined
Apr 9, 2015
Messages
4,337
Code:
If not isNull(me.field1) AND not isNull(me.field2) Then
   Me.filter = "[field1]='" & me.field1 & "' and [field2]=" & me.field2
   Me.filterOn=true
Else
     Me.filterOn=false
End if
 

moke123

AWF VIP
Local time
Yesterday, 22:32
Joined
Jan 11, 2013
Messages
3,913
I think I'm reading the question differently than Ranman.

If you are looking to test whether the form filter is on or off you can test for the filterOn property which will return either true or false.

Code:
msgbox FilterON

If you want to test whether a particular field is included in the filter string you could check if it is included in the string

Code:
If InStr(1, Me.Filter, "YourField") Then
MsgBox "Yes"
Else
MsgBox "No"
End If

HTH
 

Users who are viewing this thread

Top Bottom