Always display one decimal place

randommetalguy

Registered User.
Local time
Today, 15:03
Joined
Nov 25, 2008
Messages
52
This should be an easy fix but I cannot solve this:

I want to have all values in a list box show 1 decimal place. I can get it to look like this: 4.90, 5.00, 5.10 and like this 4.9, 5, 5.1, but I need it to look like this 4.9, 5.0, 5.1.

My table has the following properties:
Field Size - Double
Decimal Places - 1

My control has the following properties:
Format - Fixed Number
Decimal Places - 1

Thanks for your help
 
I've change the format of the list box control to 0.0;0.0;0.0

and when you select "5" from the list "5.0" is placed in the list box.

But I want it to say "5.0" when it is in the list as well.
 
Maybe I need to play around with the SQL code:

'Query tblCordInfo to return all available cord diameters matching the selected manufacturer
strCordDiameterSQL = "SELECT DISTINCT tblCordInfo.CordDiameter FROM tblCordInfo "
strCordDiameterSQL = strCordDiameterSQL & "WHERE tblCordInfo.CordManufacturer = '" & cboFreeCordManufacturer & "'"
strCordDiameterSQL = strCordDiameterSQL & " ORDER BY tblCordInfo.CordDiameter;"

'Put the results in cboFreeCordDiameter
Me.cboFreeCordDiameter.RowSource = strCordDiameterSQL

The cord diamters are showing up as
4.9
5
5.1

Is there some way to adjust the SQL to get 5.0 to display in the list box?
 
Assume that your list is populated from field1 in table1 then you would format it like so in the control properties row source

SELECT Format(Table1.Field1,"#0.0") FROM Table1;


Brian
 
I've changed to:

'Query tblCordInfo to return all available cord diameters matching the selected manufacturer
strCordDiameterSQL = "SELECT DISTINCT FORMAT(tblCordInfo.CordDiameter, '#0.0') FROM tblCordInfo "
strCordDiameterSQL = strCordDiameterSQL & "WHERE tblCordInfo.CordManufacturer = '" & cboFreeCordManufacturer & "'"
strCordDiameterSQL = strCordDiameterSQL & " ORDER BY tblCordInfo.CordDiameter;"

and now I get a message: Orderby clause conflicts with distinct clause


This has been resolved, I simply removed DISTINCT and I'm still generating the correct list
 
Last edited:

Users who are viewing this thread

Back
Top Bottom