Solved

Setting 30 minute time increments in Access 2007 form

Posted on 2011-02-24
7
451 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
ID: 34972764
Try Me.Time = Dateadd("n",30,[StartTme])
0
 

Author Comment

by:GMCAH
ID: 34973234
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
ID: 34974848
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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 39

Expert Comment

by:als315
ID: 34977311
May be you can upload you form?
0
 
LVL 1

Expert Comment

by:jimbuckleybarrett
ID: 34978336
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
ID: 34982096
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
ID: 34982201
All information was not provided with the original response i.e., verify the field format setting is medium date.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

822 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