Selasa, 16 Mei 2017

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

 

hi David, 

One of the good things about using a Navigation control is that it only loads the active page* -- that is also what is bad. 

*nothing on any other pages can be referenced or manipulated. If you want to save values, use global variables, tempvars, or database properties (my favorite).

>> What should I do differently? <<

use a tab control instead of Navigation control and, if you are concerned about loading a bunch of data you may not need, load things yourself as needed.  I have also seen the Navigation control fail to load super complex forms.

respectfully,
crystal
 
~ have an awesome day ~

On 5/15/2017 11:00 PM, 'Graham Mandeno' graham@mandeno.com [MS_Access_Professionals] wrote:

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: crystal 8 <strive4peace2008@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

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