473,385 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Adding 10 min to a time

2
This is a little more frustrating than i thought it would be.
What i'm trying to do is just add 10 min to an already existing time.

The scenario: Scheduling
A student is partaking in various activities throught the day
They can do multiple events in one day but a 10 min must be added on the end of each event to account for the 'walking' time to the next event.
Each activity is 15 min long.
Another student may start the activity while the first student is in the walking time so i can't just make the activity times 25 min.

I have tried just adding the 10 min all sorts of ways but nothing works.
Is there some special format i need to put the 10 min in so its the same as the time i'm adding it to?

I am taking my first database class so i only have a basic understanding of access and vba. Anything will help though.
Ty for your time
May 19 '10 #1
5 1847
TheSmileyCoder
2,322 Expert Mod 2GB
You can write a function and put it in a module, or you can just use the build in dateAdd function. Either way here is code showing both:
Expand|Select|Wrap|Line Numbers
  1. Public Function fAdd10(dtInput As Date) As Date
  2.     'Adds 10 minutes to a input dateTime
  3.     fAdd10 = DateAdd("n", 10, dtInput) 'n=minutes
  4.  
  5.     'For debugging/testing, comment out when done
  6.     Debug.Print "Input: " & dtInput
  7.     Debug.Print "Output:" & fAdd10
  8.  
  9. End Function
May 19 '10 #2
TheSmileyCoder
2,322 Expert Mod 2GB
And welcome to Bytes.
May 19 '10 #3
213emi
2
@TheSmileyOne
Thank you sooo much for the fast response.

It works but its on like a delay
So whenever I change a value for the time its always one update behind.
Here is the code for it

Expand|Select|Wrap|Line Numbers
  1. Private Sub ComboHour_Change()
  2.  
  3. Me.Text10min.Value = Tenmin(TimeBox)
  4. Me.Text15min.Value = Fifteenmin(TimeBox)
  5. Me.TimeBox.Value = DLookup("[TimeQ]", "Query_Time_Reserve") 'this pulls the time from a query that is made up of 3 different combo boxes one for each hour, min, ampm
  6.  
  7. End Sub
May 19 '10 #4
TheSmileyCoder
2,322 Expert Mod 2GB
Well without knowing what data your query is pulling and from where, its a bit hard to guess at the underlying problem.

But I will venture a guess anyway. *IF* Your query works off the same data as your form you need to realise that the record in the form is not updated, until you either actively save it, or switch away from the record. (If you have record selectors=true, you can see the small black triangle on the left hand side turning into a pencil whenever your editing, and back into a triangle when the record is saved(your out of edit mode).

So since the record has not been updated/saved yet, the query is pulling old data.

I hope this helps you, and if not, you will need to provide some more details on your table structure and design.
May 19 '10 #5
Stewart Ross
2,545 Expert Mod 2GB
Smiley is absolutely spot-on in his response for your one-behind problem. If you want to save the record concerned automatically before you use the Dlookup in code you can use the Dirty (meaning 'has been modified') property of the form, like this if it is the current form:

Expand|Select|Wrap|Line Numbers
  1. If Me.Dirty then 
  2.   Me.Dirty = False
  3. End If
or if the record is on a different form:

Expand|Select|Wrap|Line Numbers
  1. With Forms("YourFormName")
  2.   If .Dirty then 
  3.     .Dirty = False
  4. End With
You can place this in your sub if you want, but it must be before your Dlookup statement.

-Stewart
May 19 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Nicolas Mejia | last post by:
Hello: I´m not a professional programer in Access. I´m working in a proyect that will permit me add my flight time, but I have been having problems with the time adding. Please can some one...
2
by: Bob W | last post by:
I am trying to get a total for times, but I am having trouble getting anything to work. Basically I created a query to pull up several people's name that performed certain details and how long each...
22
by: Drum2001 | last post by:
I have a table that tracks employee times. I have a column (Date/Time). Users, through a form, enter how long it takes them to complete a task. For example, 03:45 = 3 hours and 45 mins. I am...
3
by: pburling | last post by:
I have been reading the posts regarding the CompactDatabase method and would like to say Thanks to everyone, especially Mr.Steele. I have taken his advice and make a backup from the Backend before...
6
by: madbrit | last post by:
I am designing a wages calculator based on time started, and time finished., the total time will be about 3-400 hours a month. how can I add time together to be over 24 hours, Saple code below...
8
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi just wondering if anyone had any ideas on how to do this in C#. I am trying to get the total time of several start and stop time data entries. For example the input data looks like starttime...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.