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



The information in this article applies to:

  • Microsoft Access 2000

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

  1. Open the sample database Northwind.mdb.
  2. In the Database window, click Pages under Objects, and then click New.
  3. In the New Data Access Page dialog box, click Page Wizard, and then click OK.
  4. 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
    • Products: ProductID
    • Products: ProductName
  5. Group the page by CategoryID, and then click Finish.
  6. On the Tools menu, point to Macro, and then click Microsoft Script Editor.
  7. On the View menu, click Other Windows, and then click Script Outline.
  8. 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.

  9. Add the following script to the Current event:
    Alert "The Current event of the MSODSC fired."
    					
  10. On the File menu, click Save.
  11. Quit the Script Editor.
  12. On the View menu, click Page View.
  13. Expand the Categories section of the page. Note that the message box is displayed.
  14. Collapse the Categories section of the page. Note that the message box is not displayed.

REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

257637 ACC2000: Data Access Page MSODSC Events Do Not Run by Default


Modification Type:MajorLast Reviewed:6/30/2004
Keywords:kbDAP kbhowto KB202297