Subform Not Requerying

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I have a mainform (form 1)
which has a subform (form 2)
that subform has 2 subforms of its own (forms 3a & 3b)

Forms 3a & 3b are actually based on the same query, but were broken up into
2 forms b/c of the amount of data to be displayed. The common link between
the 2 forms is field that I'll call revision.

The problem I am having is that when I enter information into the revision
field on form 3a, that information is not updated in form 3b, unless I 1st
select a different record in form 2 and then go back.

How do I make form 3b get updated without doing this? Thanks.
 
jgiv said:
Hi, I have a mainform (form 1)
which has a subform (form 2)
that subform has 2 subforms of its own (forms 3a & 3b)

Forms 3a & 3b are actually based on the same query, but were broken
up into 2 forms b/c of the amount of data to be displayed. The common
link between the 2 forms is field that I'll call revision.

The problem I am having is that when I enter information into the
revision field on form 3a, that information is not updated in form
3b, unless I 1st select a different record in form 2 and then go back.

How do I make form 3b get updated without doing this? Thanks.

Apparently you need to force subform 3b to be requeried, since you're
adding a record to its recordsource by some means external to it. You
might use code in the AfterInsert event of subform 3a, along these
lines:

'---- start of example code ----
Private Sub Form_AfterInsert()

Me.Parent!3b.Requery
' *** SUBSTITUTE NAME OF SUBFORM CONTROL ***

End Sub
'---- end of example code ----

Note that you need to replace "3b" in the above with the name of the
subform *control* on the parent form ("form 2"), which may or may not be
the same as the name of the form that is the control's Source Object.

If subform 3a also allows records to be deleted, you'll need to requery
the other subform when that happens, too. To do that, you can use the
AfterDelConfirm event, assuming you allow Access to display the delete
confirmation prompts.
 
Back
Top