Microsoft KB Archive/257733

= ACC2000: How to Determine the Record Source of a Data Access Page =

Article ID: 257733

Article Last Modified on 7/13/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q257733



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
The RecordSource property of a data access page does not necessarily display all of the fields or tables on which a data access page is based. To ensure that you see the actual record source of a page, you must programmatically retrieve this value from the Microsoft Office Data Source Control (MSODSC). The MSODSC ActiveX control is responsible for binding any type of data to a data access page.



MORE INFORMATION
To retrieve the RecordSource property of a data access page:  Open the sample database Northwind.mdb. In the Database window, click Pages under Objects, right-click the Analyze Sales page, and then click Design View. On the Tools menu, point to Macro, and then click Microsoft Script Editor. On the View menu, point to Other Windows, and then click Script Outline. This places the focus in the Script Outline window pane, at the top-most node that is labeled Client Objects & Events. Expand this node (if it is not already expanded), and browse to the MSODSC node. Expand the MSODCS node, and then double-click Current.</li>  Place the following line of script in the Current event: MsgBox MSODSC.DefaultRecordset.Source </li> On the File menu, click Save, and then on the File menu, click Exit.</li> On the View menu, click Page View. Note that when the page is displayed, you receive a message box that contains the complete RecordSource value for the data access page.</li></ol>

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.

Keywords: kbhowto kbdap KB257733

-

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

© Microsoft Corporation. All rights reserved.