Link to home
Start Free TrialLog in
Avatar of Juan Velasquez
Juan VelasquezFlag for United States of America

asked on

Problem formatting a string

I am trying to format the following strings using the format function Format( Cstr(Format([ChargeNumber])),"00000000\.00\.00\.00\.000")

Input String                                  Desired Output                 Actual Output
18006350037100000              18006350.03.71.00.000    18006350.03.71.00.000
1800565125710032A              18005651.25.71.00.32A    1800565125710032A

As you can see, the first input string is formatted properly, however the second string is not being formatted.
         
Avatar of HainKurt
HainKurt
Flag of Canada image

because it is not numeric...
Avatar of cfEngineers
cfEngineers

try
"00000000\.00\.00\.00\.00#"
or
"00000000\.00\.00\.00\.00_"

trying to remember
you can use something like this (not tested)

Mid(ChargeNumber,1,8) & "." & 
Mid(ChargeNumber,9,2) & "." & 
Mid(ChargeNumber,11,2) & "." & 
Mid(ChargeNumber,13,3)
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada 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
ah yes the @ good catch HainKurt
Avatar of Juan Velasquez

ASKER

Thanks.  That's what I was looking for.  I had checked help in Access 97 but I saw no mention of using @.