Selasa, 16 Mei 2017

Re: [MS_AccessPros] REquery List Box on Calling Subform Control

 

I have experienced similar issues in the past and quickly resolved them with code that sets the Row Source to the current Row Source:


Forms!frmMainNav.sfrmMainNav.Form!lstSamplePoints.RowSource = _

    Forms!frmMainNav.sfrmMainNav.Form!lstSamplePoints.RowSource


Regards,

Duane


From: MS_Access_Professionals@yahoogroups.com <MS_Access_Professionals@yahoogroups.com> on behalf of 'Graham Mandeno' graham@mandeno.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: Monday, May 15, 2017 11:00 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: [MS_AccessPros] REquery List Box on Calling Subform Control
 


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: Duane Hookom <duanehookom@hotmail.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar