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 VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 August 30th, 2004, 12:25 AM
Registered User
 
Join Date: Jul 2004
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Storing Calculated Fields

I have a calculated field called Saving which I want to store in the table. I know this isn't advisable, but I need to refer back to it constantly and want to know what the savings are when the information was entered. Does anyone know a way to do this?

Reply With Quote
  #2 (permalink)  
Old August 30th, 2004, 10:54 AM
SGL SGL is offline
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

First, add a field to the appropriate table where you will store your calculated field.

Second, bind your calculated control field to that form.

Third, make that control calculated field locked.

Fourth, write a VBA procedure that does the calculation. For example:

Me!CalcField = Me!Cost - Me!Discount

Fifth, set before update events for each field used to do the calculation that call the procedure you wrote above.

Sixth, set the on enter event of the calculated field to also call that procedure and do the calcuation. This should be unnecessary but it is an extra safety step.
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
How to create calculated fields MacDevv C# 3 August 16th, 2006 09:38 AM
Nested Calculated Fields in Queries SerranoG Access 0 August 14th, 2006 10:04 AM
Storing Calculated Fields dearnne Access 3 September 2nd, 2004 05:30 PM
Summing the Results of Two Calculated Fields CloudNine Access 1 December 24th, 2003 12:05 PM



All times are GMT -4. The time now is 08:54 AM.


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