Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update event not working

Status
Not open for further replies.

mike2012

Programmer
Joined
Oct 31, 2012
Messages
3
Location
GB
Please forgive my possible misuse of terms but I am relatively new to this.

I have a table with a calculated field "=(Sum([Cost]))". This gives me the sum for all the records in the table.

It doesn't respond to an after_update or change event.

Can anyone help me with this.

Thank you.

Mike.
 
Can anyone help me with this.

Not without better information. If you have a SUM in your statement then it must be in a query ... not a table.

Please give us a description of what you are trying to do ... preferably including the code you are trying to run. Do you have a translation of "doesn't respond"? Are you seeing an error? Just nothing seems to take place?
 
Sorry, it is a form with a calculated field.

The code I originally tried to run was

Forms!jobs.[Total Cost] = Forms!jobs.Jobwork_Totals_subform![Total Cost]

This was just the first part of the intended finished code.

However when it didn't respond i just tried

msbox "Test" but nothing is happening at all in either case.

Basically want I am trying to do is get the sum of 2 subform fields to appear in a text box in the parent form.

Thanks.
 
The Change is typically an event on a control that fires with every keystroke so it is rarely used. The value of a bound control won't update to your "external" control until the record is actually saved. Changing or updating a bound control (text box) doesn't automatically save the record. When the record loses focus, it is saved. You can also force a save of the record.

You mentioned "get the sum of 2 subform fields to appear in a text box in the parent form" but only provided the name a single control.

Duane
Hook'D on Access
MS Access MVP
 
OK, I will start this again and explain what I want to do and perhaps someone will have a simple solution rather than the possible round about way I have done it.

I am creating a database for my boss and i have a form called jobs in which job details are entered ie name address job id etc.

I have 2 sub forms. One for hours spent on the job and one for materials purchased.

The sub forms are linked by job id so that the records in the sub form change as the job id change in the main form.

I have also created 2 forms that create the total cost for each job by using "=(Sum([Cost]))", one for hours and one for materials.

What I am trying to do now is show the grand total for the job.

I am sure someone out there can come up with a simpler way of doing it.

I would be grateful to hear from you.

Thanks.

Mike.
 
As I mentioned above I usually handle this in about five minutes using the DSUM function with the proper where clause criteria.
 
If you are still wanting the totals from two subforms to appear on a main form, I would create the totals in text boxes (txtSumHours and txtSumMaterials) on the subforms and then reference these in an expression on the main form:
Code:
=Nz(subformHoursCtrlName.Form.txtSumHours,0) + Nz(subformMaterialsCtrlName.Form.txtMaterialHours,0)

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top