Robbe1991
11-25-2015, 07:09 AM
Hey guys,
i want to make a nice "Search Field" in my Endlessform.
So i have an Endlessform with Customers for example.
How it should work: I put down a Textfield, if I type in "sm" every Customer with "sm" in the Name shows up and the other Customers vanish.
I did that already with a search button and an InputBox what worked perfect it looked like that:
Private Sub Befehl23_Click()
Dim Response As String
Response = InputBox("Witch studies are you looking for?", "Search")
If Response = Null Or Response = "" Then
DoCmd.ApplyFilter, 1=1
Else
DoCmd.ApplyFilter, "Customername = '" & Response & "'"
End if
Now the new Version with the instant Textfield search should maybe look something like that:
Private Sub Text89_Change()
Dim Response As String
Dim Counter As Long
Response = Text89.Value
Counter = Len(Response)
Me.Filter = "left(Customername, 1) = '& Response &'"
Me.FilterOn = True
End Sub
It works when i put down strings instead of Variables so iam pretty sure the hole " ' & thing is the Problem, but i couldn't figure it out by trying...or iam just blind right know. Probably have to do some requerys as well?
I just started with access and VBA and yes iam reading books, but it would speed up things if you could help right here, because theres so much to read about^^
thanks a lot
Greetings
Robbe
i want to make a nice "Search Field" in my Endlessform.
So i have an Endlessform with Customers for example.
How it should work: I put down a Textfield, if I type in "sm" every Customer with "sm" in the Name shows up and the other Customers vanish.
I did that already with a search button and an InputBox what worked perfect it looked like that:
Private Sub Befehl23_Click()
Dim Response As String
Response = InputBox("Witch studies are you looking for?", "Search")
If Response = Null Or Response = "" Then
DoCmd.ApplyFilter, 1=1
Else
DoCmd.ApplyFilter, "Customername = '" & Response & "'"
End if
Now the new Version with the instant Textfield search should maybe look something like that:
Private Sub Text89_Change()
Dim Response As String
Dim Counter As Long
Response = Text89.Value
Counter = Len(Response)
Me.Filter = "left(Customername, 1) = '& Response &'"
Me.FilterOn = True
End Sub
It works when i put down strings instead of Variables so iam pretty sure the hole " ' & thing is the Problem, but i couldn't figure it out by trying...or iam just blind right know. Probably have to do some requerys as well?
I just started with access and VBA and yes iam reading books, but it would speed up things if you could help right here, because theres so much to read about^^
thanks a lot
Greetings
Robbe