Microsoft KB Archive/202297

= ACC2000: Current Event of a Data Access Page Does Not Occur When a Section Is Collapsed =

Article ID: 202297

Article Last Modified on 6/30/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q202297



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

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SUMMARY
When you write script for the Current event of the MSODSC control of a grouped data access page, the script runs when the section of the page is expanded, but the script does not run when the section of the page is collapsed.



MORE INFORMATION
When a grouped data access page is opened, the parent section of the page is automatically current. When the child section is expanded, the child section also becomes current. However, when the child section is collapsed, the parent section does not become current again because the parent section did not lose its current status when the child section gained its own.

Steps to Reproduce the Behavior
 Open the sample database Northwind.mdb. In the Database window, click Pages under Objects, and then click New. In the New Data Access Page dialog box, click Page Wizard, and then click OK. On the first page of the Page Wizard, add the following fields to the data access page, and then click Next:  Categories: CategoryID Categories: CategoryName</li> Products: ProductID</li> Products: ProductName</li></ul> </li> Group the page by CategoryID, and then click Finish.</li> On the Tools menu, point to Macro, and then click Microsoft Script Editor.</li> On the View menu, click Other Windows, and then click Script Outline.</li> Expand MSODSC under Client Objects and Events, and then double-click the Current event.IMPORTANT: When you create VBScript blocks for MSODSC events, you must add a parameter to the event name as follows:

<SCRIPT LANGUAGE=vbscript FOR=MSODSC EVENT=Current(oEventInfo)>

The <I>oEventInfo</I> parameter returns specific information about the event to the script. You must add this parameter, whether or not it will be used, because the script will not work without it.

</li>  Add the following script to the Current event: Alert "The Current event of the MSODSC fired." </li> On the File menu, click Save.</li> Quit the Script Editor.</li> On the View menu, click Page View.</li> Expand the Categories section of the page. Note that the message box is displayed.</li> Collapse the Categories section of the page. Note that the message box is not displayed.</li></ol>

<div class="references_section">