pad left text field

C

carol

pls advise how i would go about adding a specified
character to the left of a text field so that all entries
are 6 characters in length. example....current entries as
follows: 678, 3456, 123456 and need to be updated to
000678, 003456, 123456. would like to accomplish this in
an update query. thx.
 
T

Tom Ellison

Dear Carol:

One way to do it that I prefer:

RIGHT("000000" & YourValue, 6)

Add 6 zeros on the left, then take the right-most 6 characters.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
D

Dejan

You can use Format function:

Format (strSomeString, "000000")
If strSomString is '123' the result of given Format
function will be '000123'.

For UPDATE query, type the Format function in the Update
row for the field you want to update. It is good idea to
put filed name in brackets , like Format
([MyFieldName],"000000")

:)
 

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