Link to home
Start Free TrialLog in
Avatar of Derek Brown
Derek BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Text Modify

I have a field on form "A" with can have any of the following values

FD30, FD30S, None, FD60, FD60S, FD120 and FD120S

I want to get any one of these values and auto enter it into another none related form but without the "S" on the end leaving any of the following.

FD30, None, FD60,  and FD120

In other words get the value from form "A" strip off the "S" and paste into Form "B". I have the transfer it's just getting rid of the "S"
SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
well, there is only ONE "S"
I agree but -
but without the "S" on the end
Implies the "S" means something on the end that it doesn't mean somewhere else in the code.  We may be seeing the complete code list so in that case taking out any "S" would work but if a new pair of codes gets added and they have an embedded "S", stripping only the ending "S" would be preferable.
In the following example, replace the string literal "FD30S" with the name of the source control/field.
target = StrReverse(Replace(StrReverse("FD30S"),"S", vbNullString,1,1))

In this case, target depends on the context/method of the data move.  If assigning a value in VBA code, it will likely be the control.value property.  If assigning in an update or insert query, it will be the name of the field receiving the data
Avatar of Derek Brown

ASKER

One accurately answered my question the other gave a better answer than required.

Great

Thank you both