Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 28th, 2006, 06:09 AM
Registered User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Time Difference Calculation

Hi All,

I am in middle of a development process and i am stuck. This is the situation:

I have three fields 1. StartTime, 2. EndTime, 3. TotalHrs. I can find the diffence using DateDiff('s',[StartTime],[EndTime]) in control source property in the TotalHrs. Fields StartTime and EndTime are bound to a table and TotalHrs is having this expression in the control source field. The value displays correctly in totalhrs. However, I am not able to store the TotalHrs value displayed in the underlying TotalHrs field in the Table.

I hope i have explained the situation. All i want is the value to be calculated in totalhrs and stored. I know a bit of VBA but not able to do this. I am using Access 2003 and VBA.

Any help would be greatly appreciated.

Thanks,

Deepak

 
Old November 28th, 2006, 06:24 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 155
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to leehambly
Default

Deepak,

You can use an Update query to update the Total Hours. But this isnt Excel, you cannot put a formula into a table.

What you can do though is store the parts of the formula in the table, ie: Start and End Date.

When you need the TotalHrs, evaluate the Start and End Time and you have the TotalHrs... but why store the result? You have no need to store it.

I hope you understand.

Lee
 
Old November 28th, 2006, 08:59 PM
Authorized User
 
Join Date: Nov 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I agree, we were always taught in college calculated fields should not be stored, only queried
 
Old November 29th, 2006, 08:36 PM
Registered User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Lee. I appreciate your reply. I asked this doubt coz i tried this macro which i did using this microsoft article:


HOW TO: Use the ControlSource Property to Store Calculated Values in Access 2000

http://support.microsoft.com/kb/209172

Thank you for enlightning me on the UPDATE process.

Deepak






Similar Threads
Thread Thread Starter Forum Replies Last Post
time calculation hozyali Beginning PHP 2 April 9th, 2007 08:02 AM
Time Calculation surendran MySQL 1 June 24th, 2006 01:38 PM
Time calculation rdfernandez Access VBA 6 March 24th, 2005 11:51 AM
CLIENT SIDE TIME CALCULATION IN ASP.NET gmk51080 Javascript How-To 1 December 1st, 2004 01:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.