Solved

Setting 30 minute time increments in Access 2007 form

Posted on 2011-02-24
7
429 Views
Last Modified: 2013-11-28
I have a form that has a StartTme (date/time) field formated as General Number.  I want the StartTme field to auto populate the Time, Time1,Time2,Time3, etc.(Time - Time28) in increments of 30 minutes.  I tried wrting an event procedure but it's not working correctly: Me.Time = [StartTme] + 30.  
0
Comment
Question by:GMCAH
7 Comments
 
LVL 39

Accepted Solution

by:
als315 earned 500 total points
Comment Utility
Try Me.Time = Dateadd("n",30,[StartTme])
0
 

Author Comment

by:GMCAH
Comment Utility
Hi,
It's not working as expected.  The event procedure I was using is working perfectly except when the time entered is 11:30.  If the time entered is 11:30 then the time displayed is 1160 and not 12:00.  
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
Then it seems that it is not clear as to what exactly your "time" data is.
Can you elaborate?

Typically a "Time" is actually represented in fractions of a day (.5=12 noon)
Typically a Day is an whole number.
For example 3/4/1945 is actually 20518
Hence: 3/4/1945 12 pm is actually: 20518.5

So when you say that the Time displayed is 1160, I am more than a little confused...

Also remember that a Time, is usually accompanied by a date component.
Also try not to name your Objects with keywords like "Time", as this will cause problems if they are not referenced correctly.
(Use something like StartTime, EndTime, ...etc)


;-)

JeffCoachman

0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 39

Expert Comment

by:als315
Comment Utility
May be you can upload you form?
0
 
LVL 1

Expert Comment

by:jimbuckleybarrett
Comment Utility
Why do you have the date/time field generated as a number?  StartTime is a date/time so leave it formatted a date/time.

Then try as als315 suggested

Time.text = Dateadd("n",30,[StartTme])
Time1.text = Dateadd("n",60,[StartTme])

Don't froget to set the format fo the Time textboxes as date/time

Jim
0
 

Author Comment

by:GMCAH
Comment Utility
Thanks everyone.
The solution was to change the field back to a date/time field (which it orignally was) and modify the event procedure
Time = DateAdd("n", 30, [StartTme])
Time1 = DateAdd("n", 60, [StartTme])
etc.
0
 

Author Closing Comment

by:GMCAH
Comment Utility
All information was not provided with the original response i.e., verify the field format setting is medium date.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now