kennykee said:
Actually it like this:
All the [Measurements] in the records
30mm X 100mm
20 X 50
20mm X 15mm
30 X 15
Note: some users will put "mm" and some will not put.
I dont want user to put "mm" in these [measurement], so how remove the
character "mm" if user inserts the character "mm" using afterupdate
event?
It would have been better to ask the actual question in the first place.
There are a couple of things you could do:
1. Use the text box's KeyPress event to examine each key the user
presses and not accept any except numbers, spaces, and the letter "X".
That's easy to do, but it still won't guarantee that the entry is in the
correct format.
2. In the control's AfterUpdate event, examine the value that was
entered and delete all characters except numeric digits, spaces, and the
"X" character. You would probably also want to use the control's Exit
event to verify that the (adjusted) entry conforms to the pattern
"<number> X <number>". That is, you want to make sure that it consists
of three tokens, of which the first and third are numbers and the second
is an "X". If it doesn't, you would cancel the event to keep the focus
in the control.
You'd probably also want to verify the format in the form's BeforeUpdate
event, so that a record can't be saved unless the field conforms.