You could also have a look here for an alternate solution that works with
any font:
http://www.lebans.com/justicombo.htm
BUG FIX: Feb 01,2002 The CreateIC call was failing on Win NT or higher
systems. I was checking the DC handle returned for >0 where it should have
been <>0!
New Ver 2.1 Justification.zip is a database containing functions to center
and right justify data for List and Combo Boxes.
Major changes for Version 2.1 are:
Use standard API's instead of functions exposed in Access EXE.
Handle Multiple Columns
One Function for both Center and Right Alignment
Support for controls on SubForms
Huge increase in function execution speed
Clean code with comments
New CboRowSeperator.zip is a database containing a functions to display
non selectable Row dividers in a Combo.
My personal thanks to Terry Kreft for his input and assistance with this
upgrade.
Name: Dan Rock
Comments:
Hi,
Just a little addition to your justification.zip
I wanted to show the right justified column in standard number format so i
replaced the below line and it works great!
Thank you much for your contributions to the programming community.
'let's trim the string - better safe than sorry
' strText = Trim$(strText)
strText = Trim$(Format(strText, "###,###.00"))
--
HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
Tony said:
Klatuu,
Thanks for the help. I experimented with, and modified the code, so that
it ended up like this:
"Format([tblTempAcidWaste].[QTY],Space(10-Len(Cstr([tblTempAcidWaste].[QTY])))
& 0) AS QTY "
and followed Bob's suggestion regarding a fixed font and it works well.
Now I just have to find a font that fits with the rest of the UI and work
on spacing. A couple of questions for you, if you don't mind.
1) May I assume that the 0 following the second instance of [IntField] is
a typo? Didn't work when I had it in there but does when it's removed
2) What does the 0 in Format do?
Again, thanks for the help; I appreciate it.
Tony
Klatuu said:
For the column that holds integers, format it so it is a fixed length:
SELECT [TextField], Format([IntField], Space(5 - Len(Cstr([IntField0)))
&
"0") FROM SomeTable;
You will have to adjust the column width property and the width of the
list
box to get the visual presentation you want.
:
Hi All,
I have a list box that displays two columns. One of the columns holds
text,
the other holds integers. What I'd like to do is left align the text
column
and right align the interger column. Anyone know if this can be done
and if
so, how?
Thanks & Ciao,
Tony