Simple Extracter Coding!!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How to extract certain alphabet in a field?
eg

[Fruit] = "I like Papaya"

How to extract the alphabets "paya" to another field [Last] using code?

Any solutions?

Thanks in advance

Kennykee
 
kennykee said:
How to extract certain alphabet in a field?
eg

[Fruit] = "I like Papaya"

How to extract the alphabets "paya" to another field [Last] using
code?

Any solutions?

You don't give enough information. Are you saying you want to look
specificall for a particular literal value, like "paya"? Or do you want
the last 4 characters of whatever is in [Fruit]? Or what?

Also, do you want to remove "paya" from [Fruit] when you put it in
[Last], or just leave it there?
 
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?

Dirk Goldgar said:
kennykee said:
How to extract certain alphabet in a field?
eg

[Fruit] = "I like Papaya"

How to extract the alphabets "paya" to another field [Last] using
code?

Any solutions?

You don't give enough information. Are you saying you want to look
specificall for a particular literal value, like "paya"? Or do you want
the last 4 characters of whatever is in [Fruit]? Or what?

Also, do you want to remove "paya" from [Fruit] when you put it in
[Last], or just leave it there?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
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.
 
Back
Top