H
hdfixitup
I have an Unbound text box that searches a table for typed in records. I am
using the After Update event with the following code:
Private Sub Search_AfterUpdate()
On Error GoTo Search_AfterUpdate_Err
Me.Search = Replace(Me.Search, " ", "")
Me.Search = Replace(Me.Search, "-", "")
Me.Search = Replace(Me.Search, ".", "")
Search_AfterUpdate_Exit:
Exit Sub
Search_AfterUpdate_Err:
MsgBox Err.Description
Resume Search_AfterUpdate_Exit
End Sub
Everything works fine, but I would like to combine my three lines of code to
one line of code.
I tried using OR: Me.Search = Replace(Me.Search, " " Or "-" Or ".", "") and
got a Type Mismatch Error. What am I doing wrong or do I need to use three
separate lines of code? If I had other characters such as "," or "/" or "+",
is there some character that gets all keyboard characters other than
wildcards? Any ideas?
Thanks in advance.
using the After Update event with the following code:
Private Sub Search_AfterUpdate()
On Error GoTo Search_AfterUpdate_Err
Me.Search = Replace(Me.Search, " ", "")
Me.Search = Replace(Me.Search, "-", "")
Me.Search = Replace(Me.Search, ".", "")
Search_AfterUpdate_Exit:
Exit Sub
Search_AfterUpdate_Err:
MsgBox Err.Description
Resume Search_AfterUpdate_Exit
End Sub
Everything works fine, but I would like to combine my three lines of code to
one line of code.
I tried using OR: Me.Search = Replace(Me.Search, " " Or "-" Or ".", "") and
got a Type Mismatch Error. What am I doing wrong or do I need to use three
separate lines of code? If I had other characters such as "," or "/" or "+",
is there some character that gets all keyboard characters other than
wildcards? Any ideas?
Thanks in advance.