Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 13th, 2005, 01:32 PM
Registered User
Join Date: Mar 2005
Location: , , .
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
Reply With Quote
  #2 (permalink)  
Old March 14th, 2005, 04:10 AM
Friend of Wrox
Join Date: Jan 2005
Location: , , United Kingdom.
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts

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.


Reply With Quote
  #3 (permalink)  
Old March 16th, 2005, 10:08 AM
Registered User
Join Date: Mar 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

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

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 01:19 PM.

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