Add Zeros to Value

S

Syd

I need help with this one. I have a query field that looks
like: Product_Num: IIf(IsNull([F4]),Null,CStr([F4])) which
contains text values to which I'd like to add 0 zeros
(i.E:) 1, 3, 5, 22, 45 to change them to 01, 03, 05, 022,
045.

I have it working okay with this expression:
Product_Number: [Plant] & Format([Product_Num],"000"),
this give kind of what I want to end up with.

However, if the value in the Product_Num field has an
underscore say like: 23_1, I get an errror" message. If
the number looks numeric even if it's text (i.e:) 23, 25,
45, it works fine. The underscore kills it!

Any ideas for a work around???????

Thanks,
 
J

John Vinson

I need help with this one. I have a query field that looks
like: Product_Num: IIf(IsNull([F4]),Null,CStr([F4])) which
contains text values to which I'd like to add 0 zeros
(i.E:) 1, 3, 5, 22, 45 to change them to 01, 03, 05, 022,
045.

How about just

IIf(IsNull([F4]),Null,"0" & CStr([F4]))
 
S

Syd

Thanks, John.

It worked well...

-----Original Message-----
I need help with this one. I have a query field that looks
like: Product_Num: IIf(IsNull([F4]),Null,CStr([F4])) which
contains text values to which I'd like to add 0 zeros
(i.E:) 1, 3, 5, 22, 45 to change them to 01, 03, 05, 022,
045.

How about just

IIf(IsNull([F4]),Null,"0" & CStr([F4]))



.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top