Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 28th, 2006, 06:09 AM
Registered User
 
Join Date: Nov 2006
Location: Melbourne, Victoria, Australia.
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

Reply With Quote
  #2 (permalink)  
Old November 28th, 2006, 06:24 AM
Friend of Wrox
 
Join Date: Sep 2003
Location: Salisbury, Wiltshire, United Kingdom.
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
Reply With Quote
  #3 (permalink)  
Old November 28th, 2006, 08:59 PM
Authorized User
 
Join Date: Nov 2006
Location: , , .
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
Reply With Quote
  #4 (permalink)  
Old November 29th, 2006, 08:36 PM
Registered User
 
Join Date: Nov 2006
Location: Melbourne, Victoria, Australia.
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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:39 PM.


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