Can the function Format() do

  • Thread starter Thread starter Guest
  • Start date Start date
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!
 
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.
 
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.
 
Back
Top