Ms ACCESS and SQL: round to two decimals through query

Jolien .A

I use queries to calculate all kinds of supplier information (average lead time, total spend for that supplier, average price, etc.). All output is shown in listboxes in forms in Ms ACCESS.

Example of a calculated number:

enter image description here

How do I format the output of these queries to be rounded to two decimals? I've been playing around with the listbox settings but cannot find it there. I believe I will have to do it in the query itself, but I'm not sure how.

Query code for the above number:

SELECT Avg([Item Master].PlannedLeadTime) AS AverageLeadTime
FROM [Item Master]
WHERE ((([Item Master].DateStamp)>=[Forms]![History Supplier Tool]![List2] And ([Item Master].DateStamp)<=[Forms]![History Supplier Tool]![List3]) AND (([Item Master].SupplierName)=[Forms]![History Supplier Tool]![List1]));

Note: List1 is a listbox where the user can select a certain supplier (for which the calculations are performed) and list2 and list3 are dates the user can select (as to determine a date range for the calculations).

mwurth

Access SQL has a rich function set one of which is the round function.

Example:

SELECT Round(Avg([Item Master].PlannedLeadTime),2) AS AverageLeadTime
FROM [Item Master]
WHERE (...)

Further information: http://www.techonthenet.com/access/functions/numeric/round.php

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related