Link to home
Start Free TrialLog in
Avatar of Fordraiders
FordraidersFlag for United States of America

asked on

vba routine possibly need to update query stripping leading zeros

I have an update query
that i only need to execute on a field
IF the length of the string is 10 characters long.

This code will strip a LEADING ZERO
UPDATE Table1 SET Table1.Cust_Id = Mid(Cust_Id,2,100)
WHERE (((Table1.Cust_Id) Like "0*"));

Open in new window


Example: data
Cust_ID(text field)

0888884833
0869888896
0840316020
080588806477   <---   code will not work on this field
0827588867
0888841820


OUTPUT:
888884833
869888896
840316020
080588806477   <---   code will not work on this field
827588867
888841820
SOLUTION
Avatar of YZlat
YZlat
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
Avatar of Fordraiders

ASKER

thanks , worked perfect !
Why are you stripping the leading zeros?  This is most likely an ID field from another application.  The leading zero has meaning.  You wouldn't strip the leading zero off of zip code or SSN I hope.