Can the function Format() do

G

Guest

Hi everybody,

let's look at the 1st statement:

? Format(21, "0000")
it returns "0021" <-- in debug window

I want to raise a question, look at the 2nd statement:
?Format("hello everybody", 20)
it returns hello everybody <-- that's all, no tailing space

But code in the Format("hello everybody", 20), I expect it will return --
"hello everybody "

I mean I want to keep the tailing spaces in above sentence, such like the 1st statement, it will fill with leading "0", according to the Format(, "0000") parameter indicated.

Maybe any another functions can do the same?

Thanks & Regard!
 
K

Ken Snell

Try this:

Left("hello everybody" & Space(20), 20)

--

Ken Snell
<MS ACCESS MVP>


myBasic said:
Hi everybody,

let's look at the 1st statement:

? Format(21, "0000")
it returns "0021" <-- in debug window

I want to raise a question, look at the 2nd statement:
?Format("hello everybody", 20)
it returns hello everybody <-- that's all, no tailing space

But code in the Format("hello everybody", 20), I expect it will return --
"hello everybody "

I mean I want to keep the tailing spaces in above sentence, such like the
1st statement, it will fill with leading "0", according to the Format(,
"0000") parameter indicated.
 
G

Guest

works fine, thanks!

Ken Snell said:
Try this:

Left("hello everybody" & Space(20), 20)

--

Ken Snell
<MS ACCESS MVP>



1st statement, it will fill with leading "0", according to the Format(,
"0000") parameter indicated.
 

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

Similar Threads


Top