Microsoft KB Archive/209765

= ACC2000: GoToRecord Macro Does Not Work on Subform =

Article ID: 209765

Article Last Modified on 6/24/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q209765



Moderate: Requires basic macro, coding, and interoperability skills.



SYMPTOMS
If you create a GoToRecord macro that points to a subform and run that macro from the main form, you may receive the following error message:

Object '' isn't open



RESOLUTION
Use a GoToControl macro action to specify the subform control name, and then use the GoToRecord action to move to the next record within the subform. Leave the ObjectType and ObjectName arguments of the GoToRecord action blank and set the Record argument to Next.



MORE INFORMATION
The "GoToControl Action" Help topic contains a tip which reads as follows:   Tip   You can use the GoToControl action to move to a subform, which is   a type of control. You can then use the GoToRecord action to move to a  particular record in the subform. This is correct, but it is necessary to leave the ObjectType and ObjectName arguments for the GoToRecord action blank for this to work successfully.

Steps to Reproduce Behavior
  Open the sample database Northwind.mdb, and then create the following new macro:   Macro Name     Condition     Action ---  Macro1                       GoToRecord

Macro1 Actions -  GoToRecord Object Type: Form Object Name: Quarterly Orders Subform Record: Next Offset:  Open the Quarterly Orders form. On the Tools Menu, click Macro, and then click Run Macro. Click Macro1, and then click OK.

Note that you receive the following error message:

Object 'Quarterly Orders Subform' isn't open

</li>  Change Macro1 as follows: <pre class="fixed_text">  Macro Name     Condition     Action -  Macro1                       GoToControl GoToRecord

Macro1 Actions -  GoToControl Control Name: Quarterly Orders Subform GoToRecord Object Type: Object Name: Record: Next Offset: </li></ol>

Run the macro in the same way as before. Note that the macro moves the focus to the next record in the Quarterly Orders Subform.

Additional query words: prb

Keywords: kberrmsg kbprb kbusage KB209765

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.