Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble formatting a dollar amount in a listbox

Status
Not open for further replies.

colezpapa

Programmer
Feb 26, 2007
86
US
I am loading a listbox via a recordset loop and an Additem.
What's happening is the Amount field is spilling over to several lines in the listbox. It looks like this...

JAC First NY Company $14
137
965.73

where the value should read like this....$14,137,965.73

I've enclosed the code I am using to populate the line.

Me.List35.AddItem Me.List35.Column(0) & rs("FAM_NUMBER") & " " & Me.List35.Column(1) & rs("FAM_NAME") & " " & Me.List35.Column(2) & CStr(rs("Amount"))
 




Hi,

Try this...
Code:
Me.List35.AddItem Me.List35.Column(0) & rs("FAM_NUMBER") & "   " & Me.List35.Column(1) & rs("FAM_NAME") & "   " & Me.List35.Column(2) & [b]Format(rs("Amount"),"$#,##0.00")[/b]

Skip,

[glasses] When a group touring the Crest Toothpaste factory got caught in a large cooler, headlines read...
Tooth Company Freeze a Crowd! and
Many are Cold, but Few are Frozen![tongue]
 
The comma is treated as a separator ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
One last thing....

Clipper had a space function for embedding spaces in a string. Is there a similar way to do that in VBA.....

I am trying to line up a name column in the listbox....
not all the account names are the same size...the data comes from a Mainframe and its not padded with spaces.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top