UpdateField in Table Through Control Calculation

JoeyB_99

Registered User.
Local time
Today, 12:07
Joined
Jul 6, 2012
Messages
78
I am using Access 2007.

I have a form with a control that does a calculation based on two other controls, and all three are fields in the same table.

The table is called tblWorkFile and the controls are RegRate and RegHours, and these are multiplied together in the control source for RegAmount. I want the user to be able to update/change the RegHours and thereby update the RegAmount calculation which should update the corresponding field.

I am struggling with the SetValue macro command in the AfterUpdate property of the RegAmount control. I have the Item as tblWorkFile!RegAmount and the Expression is Form!RegRate against Form!RegHours.

What am I doing wrong? Can someone please help? Any input would be greatly appreciated.
 
Well, you can't set the table value directly, you'd set the value of the textbox bound to that field.
 
It is generally not a good idea to store calculations in your table. You can do this in your form, in queries and in reports. If you need to present the information to a third party, you can run a query or report with the calculation. Tables are meant to store raw data.
 
Okay Paul, thanks. But can you please elaborate? I don't quite follow you.
 
Thanks Alansidman.

But I inherited this database and I am in a crunch right now. Is there anyway you can help me trouble-shoot my macro?
 
Did you look at the link that Paul provided to Allen Browne's site on calculated fields. I do not use macros in Access. I have always used VBA, so I cannot help you further.
 

Users who are viewing this thread

Back
Top Bottom