Aligning Text

S

scott

I am using

Right$("0000" & [MyField], 4)

This is making sure my phone # is 4 digits long.

The problem is that when I do this...the column is aligned to the left
of the cell.

The rest of the fields are aligned to the right of the cells.

How can I get this column back to being aligned to the right?

Thanks,
Scott
 
K

Ken Snell

Use this:

CInt(Right$("0000" & [MyField], 4))

That will "force" the format to an integer (numeric) format and then it will
align to the right.
 
D

Douglas J. Steele

Um, if you convert it to an integer, you'll lose the leading zeros.

Scott: Use the Format property of the text box: set it to "0000" (without
the quotes)

--
Doug Steele, Microsoft Access MVP



Ken Snell said:
Use this:

CInt(Right$("0000" & [MyField], 4))

That will "force" the format to an integer (numeric) format and then it will
align to the right.

--
Ken Snell
<MS ACCESS MVP>

scott said:
I am using

Right$("0000" & [MyField], 4)

This is making sure my phone # is 4 digits long.

The problem is that when I do this...the column is aligned to the left
of the cell.

The rest of the fields are aligned to the right of the cells.

How can I get this column back to being aligned to the right?

Thanks,
Scott
 
D

Douglas J. Steele

You're right that that's probably better, since Scott should really be using
text fields for his phone numbers, and that would be
the only way to ensure text fields align properly.

(I forgot to mention to Scott that to use the Format property, he wouldn't
use the Right$() expression)

--
Doug Steele, Microsoft Access MVP



Ken Snell said:
Or, you could set the Alignment property of the textbox to Right.

--
Ken Snell
<MS ACCESS MVP>

Douglas J. Steele said:
Um, if you convert it to an integer, you'll lose the leading zeros.

Scott: Use the Format property of the text box: set it to "0000" (without
the quotes)

--
Doug Steele, Microsoft Access MVP



Ken Snell said:
Use this:

CInt(Right$("0000" & [MyField], 4))

That will "force" the format to an integer (numeric) format and then
it
will
align to the right.

--
Ken Snell
<MS ACCESS MVP>

I am using

Right$("0000" & [MyField], 4)

This is making sure my phone # is 4 digits long.

The problem is that when I do this...the column is aligned to the left
of the cell.

The rest of the fields are aligned to the right of the cells.

How can I get this column back to being aligned to the right?

Thanks,
Scott
 

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