Andy_Khosravi@bcbsmn.com wrote:
: Sorry for the late response, I wrote the op just as I was leaving work
: yesterday.
: Thanks for the code example Bob. I'll be sure and give it a try.
Please note that the function provided *removes* the offending
characters:
[color=blue]
>'*******************************************
>'Purpose: Remove a list of unwanted
>' characters from a string
>'Coded by: raskew[/color]
while the code that you have shown insists that the user
correct his/her entry:
[color=blue]
> If Not IsNull(GroupNum) Or GroupNum <> "" Then
>'*********problem area below this line*********
> For i = 1 To Len(GroupNum)
> SpaceCheck = MID$(GroupNum, i, 1)
> If SpaceCheck = " " Or SpaceCheck = "-" Then
> Beep
> MsgBox "Please do not enter any spaces or dashes in the
> group number field."
> Exit Sub
> End If[/color]
The entry is refused, not corrected
Why not redimension SpaceCheck as Boolean and use something like
if SpaceCheck = GroupNum like "* *" or SpaceCheck = "*-*"
--thelma