Hi David
On the surface, it looks like everything should be working fine.
I suggest you add some diagnostic code to the Form_AfterUpdate procedure of frmSampleGroupSamples:
With Forms!frmMainNav.sfrmMainNav.Form!lstSamplePoints
Debug.Print "Before requery, ListCount=" & .ListCount
.Requery
Debug.Print "After requery, ListCount=" & .ListCount
End With
This will confirm that your code is running and that the new record is being added to the list. If you see that both instances of ListCount are the same, then you could try moving the code to Form_AfterInsert. I have always been of the understanding that Form_AfterUpdate occurs AFTER the physical record has been written to the table, but Form_AftyerInsert occurs even later, so it's worth a try.
Best wishes,
Graham [Microsoft Access MVP 1996 – 2015]
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Tuesday, 16 May 2017 15:33
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] REquery List Box on Calling Subform Control
I have a navigation form, frmMainNav, with subform control, sfrmMainNav.
ONe of the subforms is frmConfigureSampleGroups, and it contains two list boxes which are related PK/FK. One list box is lstSampleGroups and the other is lstSamplePoints (displays sample points contained in the sample group).
I have a cmdButton which brings up a form to add sample points to a sample group (frmSampleGroupSamples). Both forms remain open.
My challenge is getting the lstSamplePoints on the calling form (frmConfigureSampleGroups) to update when I add a sample point to the list using a cmdSaveAndNew button on the frmSampleGroupSamples.
In the After_Update event of frmSampleGroupSamples I tried:
Forms!frmMainNav.sfrmMainNav.Form!lstSamplePoints.requery
No errors but no list refresh either.
I then tried to use the BrowseTo command to browse to frmConfigureSampleGroups before the requery statement above, and still am not getting a list refresh of the lstSamplePoints. Is it necessary to browse to the subform before I can requery the list?
What should I do differently?
Posted by: "Graham Mandeno" <graham@mandeno.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar