S
schwigg
This problem surfaced while working on a larger project, but to
simplify things...
Let's assume that I have two forms, aForm and aSubForm. aSubForm is
included as a subform on Form. Form includes a combo box named aCombo
that is populated based on the data controlled by aSubform. So, if I
go to select a value in aCombo but do not find it there, I can add an
additional record into aSubform with the idea that it will immediately
appear within aCombo as an available choice.
(Side note: I realize I could use NotInList for aCombo for this
example, but the real-world application of this is a bit more
complicated.)
I set the AfterUpdate event of aSubform to do the following event
procedure:
Private Sub Form_AfterUpdate()
Forms!aForm.Requery
End Sub
This works great for the *first* time that I update aSubForm: after
adding the record to aSubForm, the option appears within the aCombo
field. However, subsequent updates are recorded within aSubForm (and
the table behind it) but are not reflected in aCombo. These changes
*will* be reflected by closing and reopening aForm. Some testing with
message boxes in the AfterUpdate Sub above has shown that the
AfterUpdate event is only being triggered on the first update.
Am I doing something wrong? Or will the AfterUpdate event only trigger
once?
Thanks!
simplify things...
Let's assume that I have two forms, aForm and aSubForm. aSubForm is
included as a subform on Form. Form includes a combo box named aCombo
that is populated based on the data controlled by aSubform. So, if I
go to select a value in aCombo but do not find it there, I can add an
additional record into aSubform with the idea that it will immediately
appear within aCombo as an available choice.
(Side note: I realize I could use NotInList for aCombo for this
example, but the real-world application of this is a bit more
complicated.)
I set the AfterUpdate event of aSubform to do the following event
procedure:
Private Sub Form_AfterUpdate()
Forms!aForm.Requery
End Sub
This works great for the *first* time that I update aSubForm: after
adding the record to aSubForm, the option appears within the aCombo
field. However, subsequent updates are recorded within aSubForm (and
the table behind it) but are not reflected in aCombo. These changes
*will* be reflected by closing and reopening aForm. Some testing with
message boxes in the AfterUpdate Sub above has shown that the
AfterUpdate event is only being triggered on the first update.
Am I doing something wrong? Or will the AfterUpdate event only trigger
once?
Thanks!