Updating table with value from calculated unbound field on form

sv89

Registered User.
Local time
Today, 20:50
Joined
Nov 3, 2010
Messages
40
Hi,

I have a form with a calculated unbound field - Tot. The control source of Total is set to = F1 + F2 where F1, F2 are bound fields on the same form.

I've set the AfterUpdate event of Total to

DoCmd.RunSQL ("UPDATE tbl SET Total = " & Me.Total.Value & " WHERE ID = " & Me.ID.Value & "")

However, this does not update the table.

Any ideas?
 
You can completely avoid the problem. Total should not be written to the table. It should be calculated by adding F1 and F2 where required in a query, report or form. Writing Total to the table is a breach of normalization.

The reason the SQL does not run is that events are not triggered by changes in values of part of the ControlSource expression. They fire when the value is changed by typing something.
 
Thanks GalaxiomAtHome.
 

Users who are viewing this thread

Back
Top Bottom