How to right justify text in a listbox column.

C

cr113

How do I right justify text in a listbox column? I tried padding with
spaces but it just seems to strip them off.
 
T

Tom van Stiphout

On Sat, 6 Mar 2010 10:56:12 -0800 (PST), cr113 <[email protected]>
wrote:

Yes you can. Here is an example using the Northwind sample database. I
created a new form with a listbox on it, and set the RowSource to:
SELECT [Customers].[ID], Space$(30-len([Customers].[Company])) &
[Customers].[Company] FROM [Customers];
Then I set the font to a non-proportional one, e.g. Consolas
That's all.

-Tom.
Microsoft Access MVP
 
C

cr113

Yes you can. Here is an example using the Northwind sample database. I
created a new form with a listbox on it, and set the RowSource to:
SELECT [Customers].[ID], Space$(30-len([Customers].[Company])) &
[Customers].[Company] FROM [Customers];
Then I set the font to a non-proportional one, e.g. Consolas
That's all.

-Tom.
Microsoft Access MVP

I also forgot to mention that I'm not using a row source. I'm
populating the table manually. I tried padding with spaces and using a
non-proportional font but that didn't work.
 
T

Tom van Stiphout

The obvious suggestion would be to first add your items to a table.

This would also work:
Me.myList.AddItem ("1;" & Chr$(1) & Space$(30) & "aaa")
Me.myList.AddItem ("2;" & Chr$(1) & Space$(30) & "bbb")

-Tom.
Microsoft Access MVP

Yes you can. Here is an example using the Northwind sample database. I
created a new form with a listbox on it, and set the RowSource to:
SELECT [Customers].[ID], Space$(30-len([Customers].[Company])) &
[Customers].[Company] FROM [Customers];
Then I set the font to a non-proportional one, e.g. Consolas
That's all.

-Tom.
Microsoft Access MVP

I also forgot to mention that I'm not using a row source. I'm
populating the table manually. I tried padding with spaces and using a
non-proportional font but that didn't work.
 

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