Thanks Rodhem, I thought I was on the right path, but there must be something wrong with my code. I always get nothing back as the result. Below shows my sub and function. Can you see the problem?
Sum in 'Test' form
Sub TestField_AfterUpdate()
Dim InputVal As String
InputVal = FindSpecialChar(Me.TestField)
MsgBox "The new value is: " & InputVal
End Sub
Function in 'GeneralMod' module
Public Function FindSpecialChar(InputVal As String)
Dim BadCharPos As Integer, NewValue As String, SpecialChar As String
Dim ExitBtn As Variant
SpecialChar = " "
Step = 0
Do Until SpecialChar = ""
Step = Step + 1
Select Case Step
Case 1
SpecialChar = "#"
Case Else
SpecialChar = ""
End Select
If SpecialChar = "" Then
GoTo ExitFunc
End If
Do
BadCharPos = InStr(1, InputVal, SpecialChar)
If BadCharPos > 0 Then
Mid(InputVal, BadCharPos) = " "
End If
Loop Until BadCharPos = 0
Loop
ExitFunc:
End Function