Saving Control Calculated Fields To Tables

I'm trying to save the calculated result of a control "=[grossPay]*.062" into 
a table.  The form will only save bound user-entered fields to the table.  I 
would like to have all of the data, even calculated fields saved to the 
table.  Is there a way to save unbound form fields to a table?
0
Utf
12/6/2007 8:13:02 PM
access.forms 6864 articles. 2 followers. Follow

2 Replies
3259 Views

Similar Articles

[PageSpeed] 41

a control has to be bound to a field for the field to be updated (without 
some code).

My guess is that your formula is in the control source property of the 
control.
There are a couple of things you can do.
1. Move the formula to the default value property of the control.  The issue 
here is that if you change the value of the [gross pay] control, it will not 
update the new value.  The Default Value only works for new records.

2.  Move the formula to the After Update event of the [gross pay] control.  
With this method, the other control will update any time you change the value 
in the [gross pay] control.



-- 
Dave Hargis, Microsoft Access MVP


"Roberto" wrote:

> I'm trying to save the calculated result of a control "=[grossPay]*.062" into 
> a table.  The form will only save bound user-entered fields to the table.  I 
> would like to have all of the data, even calculated fields saved to the 
> table.  Is there a way to save unbound form fields to a table?
-1
Utf
12/6/2007 8:27:03 PM
On Thu, 6 Dec 2007 12:13:02 -0800, Roberto <Roberto@discussions.microsoft.com>
wrote:

>I'm trying to save the calculated result of a control "=[grossPay]*.062" into 
>a table.  The form will only save bound user-entered fields to the table.  I 
>would like to have all of the data, even calculated fields saved to the 
>table.  Is there a way to save unbound form fields to a table?

Storing derived data such as this in your table accomplishes 
three things: it wastes disk space; it wastes time (almost 
any calculation will be MUCH faster than a disk fetch); and 
most importantly, it risks data corruption. If one of the 
underlying fields is subsequently edited, you will have data 
in your table WHICH IS WRONG, and no automatic way to detect 
that fact.

Just redo the calculation whenever you need it, either as a 
calculated field in a Query or just as you're now doing it -
in the control source of a Form or a Report textbox.

If you want to store this calculated result, KNOWING THAT IT WILL BE WRONG at
any point that either the stored value or the grosspay gets edited, use the
Form's BeforeUpdate event to copy the value from the calculated control into a
bound control. Don't call me in as a witness when your employee sues you for
witholding the wrong amount of tax though, that's *your* problem.

             John W. Vinson [MVP]
0
John
12/6/2007 11:23:28 PM
Reply:

Similar Artilces:

Newbie question re column name does not belong to table item
This is my first time with XML and first time with vb.Net so it's an up hill learning curve for me but I would appreciate any help with this probably simple request. I've got a couple of column names in an xml source that my vb.net application can't handle. I know its because there is a ":" in both columns but i don't know of a way to treat the xml as a string, change the column names and then feed the results to an xmltextreader. regards, AndyB this is my xml feed: earthquake data from USGS. http://earthquake.usgs.gov/recenteqsww/eqs1day-M2.5.xml below is the err...

FileNotFound returned by Bitmap::Save() when saving to stream
I have a little chunk of code which is supposed to take a bitmap image and save its PNG encoding into a block of memory. The problem is, I keep getting a FileNotFound error back from Save(). If anyone has any ideas, I'd love to hear them. Here's the code (more or less) in question; there really shouldn't be much to it, I would have thought: /* Allocate an IStream object to write the data into a global memory block. We indicate that the handle to the underlying data will be freed when the stream object is released. */ VERIFY(S_OK == ::CreateStreamOnHGlobal(nil, True, static_c...

Handling of savings accounts and 401k accounts in the budget
I noticed that Money treats money that I contribute to a 401k account or transfer to a savings account as an expense. Basically, the more I contribute, the worse my budget looks. Is there a way to prevent this from happening? Right now, I exclude transfers to my savings account from the budget and it solves the problem, however, I shouldn't have to manually do this each time. For 401k contributions, I cannot find a way to do this. Why does it show up as "an expense" (what Category???) instead of something like Transfer Out of Budget Accounts? The 401k cash account sh...

what encoding does system.xml.xmldocument.save(string path) use to save the xml document if there is no <?xml... in the front of the xml document?
what encoding does system.xml.xmldocument.save(string path) use to save the xml document if there is no <?xml... in the front of the xml document? Daniel wrote: > what encoding does system.xml.xmldocument.save(string path) use to save the > xml document if there is no <?xml... in the front of the xml document? UTF-8 is the default encoding. -- Oleg Tkachenko [XML MVP, MCPD] http://blog.tkachenko.com | http://www.XmlLab.Net | http://www.XLinq.Net utf8 i suppose would be default Vinu Baby "Daniel" <softwareengineer98037@yahoo.com> wrote in message news:e8#...

Unable to save password in Outlook 2003
I cannot seem to save my "network password" for Outlook 2003. I tried everything I can think of. I tried editing the registry. I use XP. I try going into Control Panel, go to mail and go thru the process there and....nothing worked there. I uninstalled Office the reinstalled it.....nothing! I even went as far as unistalling my internet software, still...nothing! Someone told me that XP will not save passwords. My Outlook express works fine. Someone HELP! I also had this issue in Outlook 2003, but also in indows Live Messenger and Internet Explorer 7. I spend hour...

Save and save as
Hi, I am looking for some help with a macro, I need to disable anyone from saving a file or save as and also disable the prompt if the close button is pressed you get an option to save the file then, I need to disable all of these, also have a pop up box to warn that save as been disables when a user tries to save the file fro save and save as. Can anyone help me with this. I am using word 2003 Regards Mark Once you give someone access to a document, you have ceded all control over it. You can however stop them from overwriting the original file by making the doc...

Saving Images
When I right click to save an image in an email, it will only save as a .bmp. I need to use it as a .jpeg or a .gif. How can I fix this? In news:AB8040CE-5975-4A14-87BD-BE3B97E33682@microsoft.com, Angi <Angi@discussions.microsoft.com> typed: > When I right click to save an image in an email, it will only save as > a .bmp. I need to use it as a .jpeg or a .gif. How can I fix this? Clear your internet explorer temp file cache.....go to control panel, internet options, and choose 'delete files' "Angi" <Angi@discussions.microsoft.com> wrote in message...

PivotTable Calculated Items trouble
My PivotTable has two fields in the rows area: Country and Company, one columns field Date and one data field Profit. Profit Date Country Company 2003 2004 ------------------------------------------- Germania 110 170 BMW 50 80 Mercedes 60 90 USA 40 70 Chrysler 30 Ford 10 70 Grand Total 150 240 When I add a calculated item (difference between two Date items) to the PivotTable, it changes the affiliation of Companies to Countries and displays the whole list of Companies under each Country. Why? Profit Date Country Company 2003 2004 Diff -------------------------------...

Multiple ActiveX Controls
We have an ActiveX control that is built in VC++ and being used in VB and VC++. We are trying to use it in applications where there will be multiple instances of the control. When we attempt to use the control in this way, some, not all, of the events are passed to the wrong control. Ex: If there are three instances placed on a form and the third instance fires an event, the interface for the first control in the form will be the one that receives the event. When we've examined this closely, we have found that the handle of the control is being lost. Has anyone else seen anythin...

passing a control to a sub
I'm having trouble passing a MSFlexGrid control to a sub. The control name is "flxGalleries". The error is "Type Mismatch. Error '13'". I have the following code: Private Sub Form_Open (Cancel as Integer) .... do stuff ... GridSetup flxGalleries 'Call the Sub and pass the Control .... do more stuff ... End Sub Public Sub GridSetup (ByRef flxGrid As MSFlexGrid) With flxGrid .... do stuff ... End With End Sub What have I done wrong? Cheers Maybe try the following syntax to call it: GridSetup Me.flxGalleries or G...

make new table
i have the follow problem, i have a table like this in excel worksheet... i have in collums the number of the days of one month 1,2...31, each day have / occupies 3 different collums beneath with values and the same patern for all the days, the problem is that i don't have all the fields filled with numbers but some, now i want to collect those numbers and make a new table that contains the numbers...... how i can do it? (at the A collum every row have a different name) i don't know how to describe it better but for simplicity for each row i want to have the values of every of the 3 c...

"Unattainable" savings goals
I've learned to mostly ignore it, but it drives me batty. I have a particular loan with a goal to pay it off by 7/4/04. The loan balance is 14,000. I have marked a savings account to be "used for budgeted savings goals." I deposit $1300 per month into the account which has a balance currently of $13000. Money 2K4 says that I cannot reach my savings goal. What can I do to help fix this? Any feedback would be appreciated! ...

Clear Temp Table
Sir, How to clear or delete messages in SMTP Temp Table Thanks and regards Sathish Kumar ...

Extract some fields from a Row to a column
Hi! Apreciate your help in advance. This is my problem I have a Database w/ four columns but in my firs column starts row A, Co. Name, RowB Address, Row C Phone #. I Columns # 3 and 4 have their City Name ,State Zip Code respectivibly I'll like to put this rows in columns. Thanks VicV PS From Sunny South Florid -- Vic ----------------------------------------------------------------------- VicV's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1463 View this thread: http://www.excelforum.com/showthread.php?threadid=26266 Hi not really sure how your ...

Saving default tabs
I can't seem to get a change in the default tab setting to save. When I reopen publisher the tab setting reverts to .5 which was original default. I'm I the only person who is having this problem? I'm using the 2003 verson but had the same problem with 2000. Why not take the default page, set the tabs you want and save it as a template with a file name of, "My Very Special Tabs Settings for Future Files.pub" (jerking your chain a bit<G>) Then when you want to create what you want, use your created template file and when your pub file is what you want, do a Sa...

setting a value to a field for all records
I need to create 'Select All' and 'Unselect All' buttons to put true or false in a yes/no field. Anyone have an idea for the easiest way to iterate through all the records? ...

Save to unProtect a Document?
Our company has word documents that we use as templates on a fileserver. How could I protect the documents so that when they open them, they dont make changes to the server version, but save their OWN version and do what they want? First of all, make use of true *template* files (with the *.dot or *.dotx extension). Also, assign the template files the read-ony attribute. -- Stefan Blom Microsoft Word MVP "Chris" <Chris@discussions.microsoft.com> wrote in message news:EB9D352D-823F-4126-8A00-2D90516A3FA1@microsoft.com... > Our company has word docum...

Table to feed form instead of lenghty code?
Hello, I a database that is kind of like an Auction type deal. If a user enters their user ID and click the button, it will automatically display their chosen private ID (or Auction ID). What I want to know is, I have 80 people in my department and the code (only way I know how to do it) will become very long. Can I set up a table with the User ID and Private ID and when the button is clicked, have it read from the table and display the Private ID that way? Below is how I am going to do it if no alternative. Private Sub cmdStatusUpdate_Click() Me.NewBid.Locked = False ...

frequency table for continuous variable
Dear Friends. Can we use excel to create a frequency table for a continuous variable? I using excel 2000. Any help? Oamr Farook omarfdawood@yahoo.com Yes =COUNTIF(range,"<3")-COUNTIF(range,"<1") will return the number of values in the range that satisfy 1<=x<3. Jerry omarfdawood@yahoo.com wrote: > Dear Friends. > > Can we use excel to create a frequency table for a continuous variable? > I using excel 2000. > > Any help? > > Oamr Farook > omarfdawood@yahoo.com > > ...

Exchange 2007 And Daylight Savings Time Update
Is there a patch I need for Day light savings time and Exchange 2007? Thanks! No CDO patch required (no equivalent of KB 926666). However, the Windows Server 2003 OS will required KB 931836 time zone update and Calendar-items in 2007-hosted mailboxes created using old DST 2006 rules will need to be rebased. -- Bharat Suneja MVP - Exchange www.zenprise.com NEW blog location: exchangepedia.com/blog ---------------------------------------------- "D303M" <D303M@discussions.microsoft.com> wrote in message news:A3132ABD-4614-402F-9654-61EA72501112@microsoft.com... > I...

Save csv format to dbf format
I have a .csv file with 13 columns of data opened in excel. I make a few changes to a field and then want to save to .dbf format. After saving as .dbf when I open the file only column 1 data is present. Any insights into where the rest of the data goes? Why does the data disappear? Thanks, Mike -- mdelasaux ------------------------------------------------------------------------ mdelasaux's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=28889 View this thread: http://www.excelforum.com/showthread.php?threadid=486365 Try using Notepad and open your .dbf...

when I save an email, where does it save to?
Hi all, I have several emails that I wanted to reply, and I did click "reply" and then wrote something, but I did not have time to finish... then I click on "save", and in the evening, I closed the outlook because I slept... now I reopen the outlook in the morning, and I want to find my saved unfinished replies that I was writing... But where to find them? I have a "draft" folder, but those saved emails do not seem to be in this folder... wherelse could they go? ---------------------------------------------- This is annoying... is there a way to automat...

Trying to calculate third day from today...
I'm trying to come up with a formula to calculate the third day out from today, excluding weekends and holidays. I'm pretty sure I should use the WORKDAY function, however I only know how to use this function when using a specific date to add three to; not when using a rolling date. Can someone help? -- telewats ------------------------------------------------------------------------ telewats's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=30270 View this thread: http://www.excelforum.com/showthread.php?threadid=501177 Hi! You practically already ha...

Daylight Savings Time #2
In regards to DST or better yet XDST, in my windows 2003 domain environment I have the servers and workstations syncing their clock with one of my DCs. The statement has been presented here that since this is the case we should not have to worry about clocks being off by one hour. I do not get the warm and fuzzy with this statement. I feel that if it were that easy it would have been documented as a solution by now. Maybe they are right and I am wrong. Could you give me an explanation why so or why not? Thanks - Any clock synching is done based on UMT/GMT and the locale/timezone o...

Pivot Table #7
Hi -- I have a pivot table Column A = Soldtoname Column B = Sales # Column C = Software Column D = Support Column E = Grand total Is there a way to incorporate next to Column E what percentage Support represents? Hi, Take a look at Debra web http://www.contextures.com/xlPivot10.html if this helps please click yes, thanks "H" wrote: > Hi -- I have a pivot table > > Column A = Soldtoname > Column B = Sales # > Column C = Software > Column D = Support > Column E = Grand total > > Is there a way to incorporate next to Column E what percentage Supp...