ACC2000: How to Determine the Record Source of a Data Access Page (257733)



The information in this article applies to:

  • Microsoft Access 2000

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:
  1. Open the sample database Northwind.mdb.
  2. In the Database window, click Pages under Objects, right-click the Analyze Sales page, and then click Design View.
  3. On the Tools menu, point to Macro, and then click Microsoft Script Editor.
  4. 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.
  5. Expand this node (if it is not already expanded), and browse to the MSODSC node.
  6. Expand the MSODCS node, and then double-click Current.
  7. Place the following line of script in the Current event:
    MsgBox MSODSC.DefaultRecordset.Source
    					
  8. On the File menu, click Save, and then on the File menu, click Exit.
  9. 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.
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.

Modification Type:MinorLast Reviewed:7/13/2004
Keywords:kbDAP kbhowto KB257733