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 Programming / March 2007

Tip: Looking for answers? Try searching our database.

GoToRecord in a subform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rebecca - 22 Mar 2007 17:42 GMT
Hello,
I need a piece of code that will allow me to advance to records in a subform
of a subform (main form -> Subform1 -> Subform2, subform of Subform1).  The
following works in Subform1 when it is not within the subform control of the
main form (code is in the Click event of a command button within subform1):
Subform2.setfocus
docmd.gotorecord , , acgoto , 2

Once I try this code from within the subform control of the main form, it no
longer works.  Does anyone know of a way to correct this?  I know that
subforms within subforms tend to complicate matters.  Thank you for any help
you can provide!
kingston - 22 Mar 2007 19:59 GMT
Create a Public subroutine in the main form that advances the record in
subform1 (or subform2).  From within the other subform, call that subroutine
when you need it:

Forms!MainForm.PublicSub

>Hello,
>I need a piece of code that will allow me to advance to records in a subform
[quoted text clipped - 8 lines]
>subforms within subforms tend to complicate matters.  Thank you for any help
>you can provide!
Marshall Barton - 23 Mar 2007 01:24 GMT
>I need a piece of code that will allow me to advance to records in a subform
>of a subform (main form -> Subform1 -> Subform2, subform of Subform1).  The
[quoted text clipped - 6 lines]
>longer works.  Does anyone know of a way to correct this?  I know that
>subforms within subforms tend to complicate matters.

Another one of the problems with DoCmd nethods.

The general technique is to use methods of the form object's
Recordset or RecordsetClone.

This should be sufficient in newer versions of Access:

code in the form that you want to manipulate:
    Me.Recordset.Move 2    'or MoveNext or FindFirst or . . .

code in the parent form of the subform:
    Me.subform.Form.Recordset.Move 2

code in the grandparent form of the subsubform:
    Me.subform.Form.subsubform.Form.Recordset.Move 2

Signature

Marsh
MVP [MS Access]

Rebecca - 23 Mar 2007 04:37 GMT
Success!!  This worked.  Thank you!!

> >I need a piece of code that will allow me to advance to records in a subform
> >of a subform (main form -> Subform1 -> Subform2, subform of Subform1).  The
[quoted text clipped - 22 lines]
> code in the grandparent form of the subsubform:
>     Me.subform.Form.subsubform.Form.Recordset.Move 2
 
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.