subform.requery code not working after update

  • Thread starter Thread starter M Skabialka
  • Start date Start date
M

M Skabialka

I have created a new database which has forms with sub-forms, similar to
many I have created in the past.

There are many cases where, if information is changed in one sub-form, the
information in another sub-form must be updated, so in the after update
event I use code like this (same as in the other databases)

Private Sub HoursAssigned_AfterUpdate()
ResourceAmount = Rate * HoursAssigned
Forms![frmACRN]![frmACRN subform3].Requery
End Sub

However, "frmACRN subform3" is not updating; it is a summary of information
in "frmACRN subform2" where the HoursAssigned field gets updated. These are
3 subforms on the main form "frmACRN". When I change the HoursAssigned data
on subform2, the summary hours on subform3 should get updated but it
doesn't.

"frmACRN subform2" has linked child and master fields of:
ContractNumber;LineNumber;ProjectNumber

"frmACRN subform3" has linked child and master fields of:
ContractNumber (it's a summary of of all line and project numbers)

What would make code like this -
Forms![frmACRN]![frmACRN subform3].Requery
work on some forms and not on others?

Mich
 
I tried at your suggestion:

Private Sub HoursAssigned_AfterUpdate()
ResourceAmount = Rate * HoursAssigned
Forms![frmACRN]![frmACRN subform3].Requery
DoEvents
End Sub

Nothing changed - it still doesn't work.
Mich
 
On my website (see sig below) is a small sample database called
"SubformReference.mdb" which answers this as well a number of other problems
with referencing subforms and subsubforms.
 
There are three subforms, not sub-sub forms.
subform1 lists projects, you select one.
subform2 lists activities for that project, you change the assigned hours on
one or more activities.
subform3 lists a summary of the assigned hours for all projects.

Your sample database did not address this case, where changing the assigned
hours on subform2 should cause the total assigned hours on subform3 to
update. Thanks anyway....

I am still at a loss,
Mich

Roger Carlson said:
On my website (see sig below) is a small sample database called
"SubformReference.mdb" which answers this as well a number of other problems
with referencing subforms and subsubforms.

--
--Roger Carlson
www.rogersaccesslibrary.com
Reply to: Roger dot Carlson at Spectrum-Health dot Org

M Skabialka said:
I have created a new database which has forms with sub-forms, similar to
many I have created in the past.

There are many cases where, if information is changed in one sub-form, the
information in another sub-form must be updated, so in the after update
event I use code like this (same as in the other databases)

Private Sub HoursAssigned_AfterUpdate()
ResourceAmount = Rate * HoursAssigned
Forms![frmACRN]![frmACRN subform3].Requery
End Sub

However, "frmACRN subform3" is not updating; it is a summary of information
in "frmACRN subform2" where the HoursAssigned field gets updated. These are
3 subforms on the main form "frmACRN". When I change the HoursAssigned data
on subform2, the summary hours on subform3 should get updated but it
doesn't.

"frmACRN subform2" has linked child and master fields of:
ContractNumber;LineNumber;ProjectNumber

"frmACRN subform3" has linked child and master fields of:
ContractNumber (it's a summary of of all line and project numbers)

What would make code like this -
Forms![frmACRN]![frmACRN subform3].Requery
work on some forms and not on others?

Mich
 
Back
Top