Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

To apply trucate in select statement

0 views
Skip to first unread message

pol

unread,
Dec 23, 2009, 10:56:01 AM12/23/09
to
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


PvdG42

unread,
Dec 23, 2009, 12:15:56 PM12/23/09
to

"pol" <p...@discussions.microsoft.com> wrote in message
news:C67DCA08-A754-4434...@microsoft.com...

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.

Daryl S

unread,
Dec 23, 2009, 12:20:01 PM12/23/09
to
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.
--
Daryl S

John W. Vinson

unread,
Dec 23, 2009, 1:12:32 PM12/23/09
to

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?
--

John W. Vinson [MVP]

pol

unread,
Dec 24, 2009, 8:05:01 AM12/24/09
to
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.


"John W. Vinson" wrote:

> .
>

John Spencer

unread,
Dec 24, 2009, 9:13:47 AM12/24/09
to
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

0 new messages