To apply trucate in select statement

  • Thread starter Thread starter pol
  • Start date Start date
P

pol

I have the following data in table

Worktime
---------------
5.30
6.40
3.15
5.55

How I give trucate function in select statement. ie,
select sum(trucate(worktime,60)) ....

Please help
 
pol said:
I have the following data in table

Worktime
---------------
5.30
6.40
3.15
5.55

How I give trucate function in select statement. ie,
select sum(trucate(worktime,60)) ....

Please help

Perhaps if you could describe what happens when you attempt your query? Do
you get unexpected results, or an error message? Please describe the results
in detail. While you're at it, please provide full query text. "...."
doesn't tell us much.
 
Pol -

By truncate, I assume you mean you want to display only the integer portion
of the results (whole hours only excluding any minutes). If so, use
Int([Worktime]). You can sum the records with Sum(Int([Worktime])), which
will truncate each value first, then sum the results.

This assumes these are number fields with decimal time (e.g. 1.5 = one hour
and 30 minutes), as that is the format in your post.
 
I have the following data in table

Worktime
---------------
5.30
6.40
3.15
5.55

How I give trucate function in select statement. ie,
select sum(trucate(worktime,60)) ....

Please help

There is no Trucate() (or even a Truncate) function in Access, so it clearly
won't work as written!

What is the datatype of Worktime? What are you expecting Trucate to return?
What is the meaning of the 60 argument?
 
The datatype is numeric with decimal 2. If I want integer part and decimal
part.
for example from the following

8.50
8.30

I have to get the value 8 from both record. So which function can I give to
get integer portion.
 
Use Int or Fix (check the VBA help for differences in the behavior of the two).

Int(8.75) will return 8
Int(-8.75) will return 9

Fix(8.75) returns 8
Fix(-8.75) returns 8

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
Back
Top