Link to home
Start Free TrialLog in
Avatar of Bevos
Bevos

asked on

Trim Leading 0s from percentage input mask

Hello, I have a column in an Access table saved as a text field with a percentage input mask 999\%;;_.  Users have been entering data in this fashion 001 for 1%.  Can I trim the leading 0s from this field in any way?

Thank you,
Bevo
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

You can use the Trim() function ... in an Update query ...

mx
Make a backup first.

Example:

UPDATE Table1 SET Table1.YourField = Trim([YourField]);


mx
I don't think the trim function takes care of zeros.

Perhaps this:

iif(isnumeric([yourfield]),trim(cstr(cdec([Yourfield]))),[YourField])
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
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
Avatar of Bevos
Bevos

ASKER

Yep, silly me numeric fixes everything quickly and easily
I agree...change the datatype to numeric.  Even if you have to change it back to a string, that should clear the zeros.  The only issue is if you have non-numeric data
Why work that hard?

UPDATE tblWhatever SET tblWhatever.PercentText = CInt([PercentText]);

The underlying field remains text.
CInt() or CLng() will whack leading zero.

My 2¢