Microsoft KB Archive/233487

= ACC2000: How to use VBScript to Synchronize Two Data Access Pages =

Article ID: 233487

Article Last Modified on 7/13/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q233487



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
This article shows you how to use VBScript to synchronize two data access pages. The example in this article uses VBscript to capture the current record that is displayed on the first page, and then to search and move the second page to the matching record.



MORE INFORMATION
The following example uses the Find method of the Recordset object (supplied by the Microsoft Office Data Source Control) to search for a matching record and to display the match while keeping both pages synchronized.

This article assumes that you have Microsoft Web services (Personal Web Server or Internet Information Services) installed correctly, and that the default wwwroot folder exists on your hard disk.  In the sample database Northwind.mdb, create a new data access page that is based on the Products table, and add all of the fields from the Products table to the page. Click the page title placeholder Click here and type title text, and then type Products. Close and save the page as Products.htm in the wwwroot folder. Create a new data access page that is based on the Order Details table, and add all the fields from the Order Details table to the page. Click the page title placeholder Click here and type title text, and then type Order Details. Save the page as OrderDetails.htm in the wwwroot folder.</li> With the OrderDetails page still open in Design view, start Microsoft Script Editor.</li> On the HTML menu, point to Script Block, and then click Client.</li>  Type the following script: <SCRIPT language=vbscript>

</SCRIPT> </li> In the Script Outline, expand Window, and double-click onload.</li>  Type the following script and replace with the actual name of your Web server: <SCRIPT event=onload for=window language=vbscript>

</SCRIPT> </li> In the Script Outline, expand MSODSC, and double-click Current.</li>  Type the following script. Note how EVENT=Current changes to EVENT=Current(x): <SCRIPT event=Current(x) for=MSODSC language=vbscript>

</SCRIPT> </li> Close and save the changes that you made to the OrderDetails page.</li> Open the Products page in Design view.</li>  Start Microsoft Script Editor. In the Script Outline, expand Window, double-click onload, and then enter the following script: <SCRIPT event=onload for=window language=vbscript>

</SCRIPT> </li> Close and save the Products page, and then use Microsoft Internet Explorer to load http:// /orderdetails.htm, replacing with the actual name of your Web server.

Note that two browsers are loaded; the first displays the Order Details page, and the second displays the Products page (you may need to rearrange the pages to see both at the same time). Also note that the ProductID on both pages match.</li> Move through the records on the Order Details page, and note that the ProductID on the Products page stays synchronized with the ProductID on the Order Details page.</li></ol>

Additional query words: inf DAP DAPHowTo DAPScriptHowTo

Keywords: kbhowto kbdap kbdapscript KB233487

-

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

© Microsoft Corporation. All rights reserved.