Listbox results to show 3 decimals

YNWA

Registered User.
Local time
Today, 06:33
Joined
Jun 2, 2009
Messages
905
Hi,

I have a list box that is fed by a query. I have fields that are stored in the table as numbers (Type is Double and Standard Number with 3 decimal places).

In the tables I see the numbers 10.000 which is correct, in the query is see 10.000 again correct, however the list box on the form only shows 10.00?

Any ideas?
Thanks
 
List box values display left justified as text so in your listbox rowsource you need to format the value

format([myValue],'0.000')

To right justify a quick way is to use the space function

Space(15-len(format([myValue],'0.000')) & format([myValue],'0.000')
 
List box values display left justified as text so in your listbox rowsource you need to format the value

format([myValue],'0.000')

To right justify a quick way is to use the space function

Space(15-len(format([myValue],'0.000')) & format([myValue],'0.000')

If my row source of listbox reads:

Code:
SELECT QRY_SearchAll11.priceCostID, QRY_SearchAll11.Client AS [Client Name], QRY_SearchAll11.contract_ManualID AS [Contract ID], QRY_SearchAll11.MeterRef AS [MPAN/MPRN], QRY_SearchAll11.Current_All_Units AS [AU ppkWh], QRY_SearchAll11.Current_Day_Units AS [DU ppkWh], QRY_SearchAll11.Current_Night_Units AS [NU ppkWh], QRY_SearchAll11.Current_EveningWeekend AS [E/W U ppkWh], QRY_SearchAll11.Current_DailyCapacityCharge AS [DC p/KVA], QRY_SearchAll11.Current_MonthlyCapacityCharge AS [MC £/KVA], QRY_SearchAll11.Current_DailySmartMeter AS [SM/DC p/day], QRY_SearchAll11.Current_DailyStandingCharge AS [SC p/day], QRY_SearchAll11.Current_ClimateLevy AS CCL
FROM QRY_SearchAll11
ORDER BY QRY_SearchAll11.contract_ManualID;

Where do I put this other code?
 
Curious to know what gas/elec has to do with boutiques:)

Anyway, back to your question

if
QRY_SearchAll11.Current_EveningWeekend AS [E/W U ppkWh]
is the value you want to show to 3dp then restate as

Code:
Space(15-len(format([Current_EveningWeekend ],'0.000')) & format([Current_EveningWeekend ],'0.000') AS [E/W U ppkWh]

Incidentally, bad idea to have spaces in names - can cause all sorts of problems when trying to debug
 

Users who are viewing this thread

Back
Top Bottom