Solved

Time Calculation

Posted on 2007-03-25
1
183 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
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

746 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

12 Experts available now in Live!

Get 1:1 Help Now