Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 13th, 2005, 01:32 PM
Registered User
 
Join Date: Mar 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using Datepart to get half an hour precision

Hey I need to make a table in Access to take weekly inputs (with hours) and count the number of occurences at half an hour intervals.
I've separated the date and time fields so I group by date and group by hour using this formula: "Hour_: DatePart("h",[Time(fraction)])"
Problem is I need to get half an hour precision.

I'd be glad if anyone knows how to do this (either by datepart or not)

Thanks in advance
Elad
 
Old March 14th, 2005, 04:10 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Elad,

If you wanted the value to be displayed on a scale of 0 to 48 then you can use this

HalfHour_: (DatePart("h",[Time])*2)+Int(DatePart("n",[Time])/30)

So if the time value is say 05:15 am then the result would be displayed as 10. If the time value was 05:35 am then the result would be 11. Basiccally you have split the day into 48 slots instead of 24.

HTH

Jon
 
Old March 16th, 2005, 10:08 AM
Registered User
 
Join Date: Mar 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dear Jon
Thank you very much from your help
worked like a charm

Elad





Similar Threads
Thread Thread Starter Forum Replies Last Post
Hour by Hour Matrix Report Ed_Conde BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 0 August 12th, 2008 02:51 PM
Half Perforation Paper Settings kamrans74 VB How-To 1 April 13th, 2007 01:41 AM
Datepart Vision G Access 2 October 18th, 2006 06:56 AM
Half the code in Access 2000 VBA doesn't work disruptivehair BOOK: Beginning Access VBA 0 December 26th, 2005 02:21 PM
Executing script automatically every half an hour saads90 Pro JSP 0 November 9th, 2005 10:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.