Solved

Time Calculation

Posted on 2007-03-25
1
208 Views
Last Modified: 2010-04-30
Hi Experts,

I have a field called starttime that is formated h:mm AM/PM.  I have added a new field called putime and traveltime.  I want to be able to calculate the pickup time by deducting the minutes of traveltime and 60 mins from starttime.

I have tried the following code but get an error:

    Me.putime = timeAdd("h:mm AM/PM", -60 - trvtime.Text, starttime)


0
Comment
Question by:andrewl77
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
raja_ind82 earned 125 total points
ID: 18787615
starttime = Format(Now(), "h:mm AM/PM")
finaltime = DateAdd("n", 20, starttime) ' add twenty minutes...
MsgBox starttime
MsgBox finaltime

Have a look at this for more details on DATEADD:
http://msdn2.microsoft.com/en-us/library/hcxe65wz.aspx

Regards,
M.Raja
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using "ScreenUpdating" 6 86
how to Classify of email (pdf attachments) 7 57
transition to visual .net from vb6 5 81
adding "ungroup sheets" to existing vbs code 5 75
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

738 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