Right Justify ListBox Column

Posted on 2014-08-16
Medium Priority
Last Modified: 2014-08-17
Can a specified column in a listbox in access 2007 be right justified?
Question by:Lawrence Salvucci
  • 2
LVL 49

Accepted Solution

Dale Fye earned 2000 total points
ID: 40265669
The short answer is no.  But by setting the listbox font to one of the non-proportional fonts (Courier, Consolas, ...) and padding the column with spaces on the left, you can achieve this effect.  I frequently do it when I want to display numeric values in the list.

Select Right(Space(10) & Format([numberField], "#,###.00"), 10) as [PaddedNumber]
FROM yourTable

The key here is that if you want to use that column in your subsequent code, you need to make sure you Trim( ) off all of the spaces and then convert it back to a number, something like:

dblNumber = Val(Trim(me.lstTest.Column(0)))

Author Closing Comment

by:Lawrence Salvucci
ID: 40265689
Thank you very much!
LVL 49

Expert Comment

by:Dale Fye
ID: 40266019
glad to help.

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have had my own IT business for a very long time. I started mostly with hardware and after about a year started to notice a common theme. I had shelves with software boxes -- Peachtree, Quicken, Sage, Ouickbooks -- and yet most of my clients were…
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question