Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

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).

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


Keywords: KB257733, kbdap, kbhowto

↑ Back to the top

Article Info
Article ID : 257733
Revision : 2
Created on : 7/13/2004
Published on : 7/13/2004
Exists online : False
Views : 300