Format

S

Shawn C

I am in need of sample format code that will take a numeric value and convert
it to a text string the begins with a letter and is always 8 spaces long. For
example, 1 would convert to R0000001 and 828 would convert to R00000828.

Help!
 
K

KARL DEWEY

I am making a couple of assumptions.
- First you do not care about the right part of the data that starts with a
letter as your example dropped '001' from the right to add the 828.
- Second you made a typing error in 'R00000828' as it is 9 characters long.
- Third that the second field will always be an integer or a text field
without any puncuation.

Results: Left([Field1], 8 - Len([Field2]) & [Field2]
 
J

Jerry Whittle

In a query:

Padded: "R" & String(8-Len(CStr([TheNumberField])),"0") & [TheNumberField]
 
S

Shawn C

Perfect!
--
Shawn C


Jerry Whittle said:
In a query:

Padded: "R" & String(8-Len(CStr([TheNumberField])),"0") & [TheNumberField]
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


Shawn C said:
I am in need of sample format code that will take a numeric value and convert
it to a text string the begins with a letter and is always 8 spaces long. For
example, 1 would convert to R0000001 and 828 would convert to R00000828.

Help!
 

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