Solved

Setting 30 minute time increments in Access 2007 form

Posted on 2011-02-24
7
440 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
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.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
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…
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…

911 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

23 Experts available now in Live!

Get 1:1 Help Now