Hi,
I am on MSAccess 2000 and I want to valid a field before going on to next
field when user inputting data.
My so call validation is just change certain input characters into space or
just remove such character.
For example, if user input abcd's or abc@erews, I want the final data look
like either abcds or abcd s for abc@erews will look like abc erews or
abcerews.
Anyone any idea ?
Carl Rapson - 17 May 2007 16:33 GMT
> Hi,
>
[quoted text clipped - 9 lines]
>
> Anyone any idea ?
Use the KeyPress event to filter out any characters that are not allowed.
Alternatively, you could use the AfterUpdate event to scan the entire string
and replace/remove the characters you don't want.
Carl Rapson
Smiley - 18 May 2007 21:16 GMT
Hi Carl,
Thank you.
>> Hi,
>>
[quoted text clipped - 15 lines]
>
> Carl Rapson
missinglinq - 18 May 2007 22:22 GMT
This code prevents certain characters from being entered. In this case, it's
A and B, but you can replace the 65 and 66 with the ASCII code for any
character you wish.
Private SubYourTextBoxName_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 65, 66
KeyCode = 0
End Select
End Sub

Signature
There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000