Solved

Setting 30 minute time increments in Access 2007 form

Posted on 2011-02-24
7
463 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 40

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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 40

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

830 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