Validate input field to filter out certain characters

S

Smiley

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 ?
 
C

Carl Rapson

Smiley said:
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 ?

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
 
S

Smiley

Hi Carl,

Thank you.

Carl Rapson said:
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
 
M

missinglinq via AccessMonster.com

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
 
Top