Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2008

Tip: Looking for answers? Try searching our database.

Requery Subforms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Combustible Kid - 21 May 2008 18:36 GMT
I have a list box on a main form. When the list box is updated it should
requery within per the after update procedure two subforms [sfrmAgency] and
[sfrmEmployment].

The after update procedure is returning an error stating that it "can't find
the field 'sfrmAgency'...", however [sfrmEmployment] had been working okay.
Unfortunately, I accidently deleted it. When it was recreated I got the same
behavior. The same thing happens on my OnCurrent procedure for the main form.

The afterupdate procedure is:
[Forms]![frmPerson]![sfrmEmployment].Requery
[Forms]![frmPerson]![sfrmAgency].Requery

I have also tried:
[Forms]![frmPerson].[sfrmEmployment].[Form].Requery
[Forms]![frmPerson].[sfrmAgency].[Form].Requery
Klatuu - 21 May 2008 20:15 GMT
Addressing subforms takes another level of object reference.  As written,
this version trying to requery the subform control on the main form.

   [Forms]![frmPerson]![sfrmEmployment].Requery
   [Forms]![frmPerson]![sfrmAgency].Requery

But, my guess is sfrmEmployment and sfrmAgency are not the names of subform
controls on frmPerson, but the names of the forms being used as a subform.

This version is closer, but again I think you are using the name of the forms.

   [Forms]![frmPerson].[sfrmEmployment].[Form].Requery
   [Forms]![frmPerson].[sfrmAgency].[Form].Requery

The correct refernce is to use the name of the subform control, not the name
of the form.  The main form knows nothing about the forms being used as
subforms.  It only knows about the subform controls.  A subform control has a
Source Object property.  That is what defines the form to use as the subform.
Then you have to use the Form reference because it is what identifies the
refence to the form being used as a subform.  So, the short of it is, change
the names to use the control name, not the form name.  If the subform is on
the main form where your code is, all you need is:

   Me.SubFormControlName.Form.Requery

Signature

Dave Hargis, Microsoft Access MVP

> I have a list box on a main form. When the list box is updated it should
> requery within per the after update procedure two subforms [sfrmAgency] and
[quoted text clipped - 12 lines]
> [Forms]![frmPerson].[sfrmEmployment].[Form].Requery
> [Forms]![frmPerson].[sfrmAgency].[Form].Requery
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.