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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limiting the decimals of a calculated field

Status
Not open for further replies.

Serrin

Programmer
Jul 3, 2001
6
DE
My SQL Statemant as it is looks like this:

SELECT (SUM(Time1 + Time2)) / 8 AS Summe
FROM TimeTable;

Is it possible to limit the decimals of the field 'Summe'?

Thanks,

Serrin
serin@gmx.net
 
Thanks, it seemed to be exatly what i needed but Microsoft Access doesn't accept the "cast" function!!! *argh*
 
I can't help directly with MS Access, but check the help/manual for a CONVERT function, which may do what you want.

Greg.
 
I did a search on "display formats, field data" in the MS Access help index. It looks as if you can get your data to display the way you want by defining a format property along with a DecimalPlaces property.
 
It is always nice to know the program in use. This is the ANSI SQL forum and thus I proposed an ANSI SL solution. Access is not quite ANSI 92 compliant.

There are a few ways to format data in Access.

As suggested, you can use the Format function.

SELECT Format(SUM(Time1 + Time2) / 8, "0.00") AS Summe
FROM TimeTable;

OR

SELECT Format(SUM(Time1 + Time2) / 8, "FIXED") AS Summe
FROM TimeTable;


You can use the Round function.
SELECT Round(SUM(Time1 + Time2) / 8, 2) AS Summe
FROM TimeTable; Terry

"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 
Thx, i used the Round function and it works perfect.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top