Right Justify ListBox Column

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

    Accepted Solution

    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)))
    LVL 1

    Author Closing Comment

    by:Lawrence Salvucci
    Thank you very much!
    LVL 47

    Expert Comment

    by:Dale Fye (Access MVP)
    glad to help.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now