[AccessD] Format a numeric column in a list box?

Heenan, Lambert Lambert.Heenan at AIG.com
Thu May 13 08:23:20 CDT 2004


I think you'll have to do a couple of things.

1/ The font used in the list/combo will have to be non-proportional, like
Courier New. Then you can figure out how many digits will display in the
list.

2/ In the query that populates the list you'll need to pad your numeric
string with spaces. A function something like...
(Air code)
Function strPad(nLen as Integer, nNumber as Long) as String
Dim strResult as String
	strResult = Cstr(nNumber)
	strResult = String( nLen -  Len(strResult," ") & strResult
	strPad = strResult
End Function

HTH

Lambert

> -----Original Message-----
> From:	Jim Hewson [SMTP:JHewson at karta.com]
> Sent:	Thursday, May 13, 2004 8:38 AM
> To:	Access Developers discussion and problem solving
> Subject:	RE: [AccessD] Format a numeric column in a list box?
> 
> 
> To piggyback on this thread, I have a question.
> How can you format a numeric column to align on the right?
> I want numbers to look like numbers - not text.
> This would apply to the list box and combo box.
> Thanks,
> Jim
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Charlotte
> Foust
> Sent: Wednesday, May 05, 2004 2:57 PM
> To: Access Developers discussion and problem solving
> Subject: RE: [AccessD] Format a numeric column in a list box?
> 
> 
> Listbox rows are essentially strings.  You need to use the Format$()
> function to convert the value to a string in the query if you want a
> single decimal place in the list.
> 
> Charlotte Foust 
> 
> -----Original Message-----
> From: Paul Baumann [mailto:Paul.Baumann at rtctech.com] 
> Sent: Wednesday, May 05, 2004 11:36 AM
> To: accessd at databaseadvisors.com
> Subject: [AccessD] Format a numeric column in a list box?
> 
> 
> I have a list box in which one of the fields is a number with one
> decimal place. The table that the value is coming from is set to one
> decimal place. I have set the format for the column in the query that
> selects the data for the list box to one decimal place. But, when I open
> the form the column in the list box displays 2 decimal places.
> 
> I am running out of hair to pull out.
> 
> Paul Baumann
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com



More information about the AccessD mailing list