storing calculated control of a subform (1 Viewer)

Wysy

Registered User.
Local time
Today, 13:19
Joined
Jul 5, 2015
Messages
333
Hi,
Eventhogh i know calculated control are for queries, i still need to store a calculated value of a sum. I have a form with customers, dates, locations. That form has a subform that contains the services done and materilas used. This subform is in datasheet view. In the footer i have a control with =Sum([Price]). So i need the value of this control to be stored in the table the main form is based on. I did an unbound control in the main form where the =Me!Subform.Form!.Textx will bring the value "over" Then for the on focus event the vba code Me.Total=Me.Textx stores the value. That is fine. The same works with a command button with the same vba code. However i am asking if there is a more automatic way to get the value over without the unbound control/command button.
thanks
Andy
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:19
Joined
Aug 30, 2003
Messages
36,124
Code in the after update event of the subform should work.
 

Wysy

Registered User.
Local time
Today, 13:19
Joined
Jul 5, 2015
Messages
333
Thanks i will try it.
Andy
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:19
Joined
Aug 30, 2003
Messages
36,124
No problem, post back if you get stuck.
 

Wysy

Registered User.
Local time
Today, 13:19
Joined
Jul 5, 2015
Messages
333
I tried and it works only partially: it sums only the records previous to the last one. In other words, it misses the last value eventhough i push enter/tab all the way to "save" the last record into the recordset
Andy
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:19
Joined
Aug 30, 2003
Messages
36,124
You might requery the sum textbox first, if you're using that value.
 

Wysy

Registered User.
Local time
Today, 13:19
Joined
Jul 5, 2015
Messages
333
How do i do it exactly what you mean?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:19
Joined
Aug 30, 2003
Messages
36,124
Like

Me.TextboxName.Requery
 

Users who are viewing this thread

Top Bottom