Solved Why is my Filter not working?

cheberdy

Member
Local time
Today, 10:37
Joined
Mar 22, 2023
Messages
77
I want to find a record in a form. To do this, you enter a number and press a button. I have this filter code, but it does not seem to work. I already debugged it and the values are correct

Code:
Private Sub Befehl18_Click()
Dim number As String


number = Textfield1.Value
If Not IsNull(number) Then
Me.Filter = number
Me.Filter = True


End If


End Sub
 
Your filter needs to be something like

“somefield =“ & number
 
1) Filtering means hiding everything that does not meet the filter condition, i.e. where the application of the filter condition results in False.
Code:
Me.Filter = True
With ALL True, there can be no data reduction.
@CJ_London shows you the right direction.

2) You don't just have to define a filter, you also have to actively use it.
Code:
Me.FilterOn = True
 
I want to find a record in a form. To do this, you enter a number and press a button. I have this filter code, but it does not seem to work. I already debugged it and the values are correct

Code:
Private Sub Befehl18_Click()
Dim number As String


number = Textfield1.Value
If Not IsNull(number) Then
Me.Filter = number
Me.Filter = True


End If


End Sub
How is Access meant to know which field to search for that value?
Have you even looked up how to use a filter? :(

 
I want to find a record in a form. To do this, you enter a number and press a button. I have this filter code, but it does not seem to work. I already debugged it and the values are correct
i also suggest reading a good material about MS Access.
it's hard programming blindly.
 
i also suggest reading a good material about MS Access.
it's hard programming blindly.
Well there is always Google?
Either way you would still have to search, be it book or search engine.
 

Users who are viewing this thread

Back
Top Bottom