View Single Post
  #6  
Old May 10th, 2010, 11:33 PM posted to microsoft.public.access.forms
jamo
external usenet poster
 
Posts: 11
Default Expression in forms


--
Center for technica education


"Linq Adams via AccessMonster.com" wrote:

John's advice is spot on, of course, and should be followed in the vast
majority of cases, including the scenario you have here. In the very few
cases where storing a calculated value is necessary, you have to move the
calculation to somewhere other than the Control Source for the textbox, so
that the Control Source can be a field in the underlying table and theresults
stored in that field.

If, for instance, you were adding the values of two textboxes together,
txtFieldA and txtFieldB, you'd do something like this, in the AfterUpdate
event of each of them:

Private Sub txtFieldA_AfterUpdate()
Me.txtTotal = Nz(Me.txtFieldA, 0) + Nz(Me.txtFieldB, 0)
End Sub

Private Sub txtFieldB_AfterUpdate()
Me.txtTotal = Nz(Me.txtFieldA, 0) + Nz(Me.txtFieldB, 0)
End Sub

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201005/1

.Ling

I am following John advise and it sound like if I try to do whated I
started to do,it gets too hairy