Microsoft KB Archive/274387

= ACC2002: Drop-Down List on Data Access Page Does Not Stay in Sync with Recordset =

Article ID: 274387

Article Last Modified on 9/27/2006

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q274387



Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SYMPTOMS
When you delete a record on a data access page, a combo box that is used to find records on the page is not refreshed to reflect the deletion.



CAUSE
A combo box on data access pages is not automatically refreshed after a deletion in the underlying recordset.



RESOLUTION
In order to refresh the combo box, set the ServerFilter property to an empty string, as follows:  Open the Northwind sample database.  Open the Customers table, add a record as follows, and then close the table:   CustomerID:   AAAAA CompanyName: TestCompany  In the Database window, click the Customers table, and then on the Insert menu, click Page. In the New Data Access Page dialog box, click AutoPage: Columnar, and then click OK. After the page has been created, click Design View on the View menu.</li> Click the arrow next to Customers on the Header bar, and then click Group Level Properties.</li> Change the CaptionSection property to True.</li> In the toolbox, click Control Wizards so that the tool appears with a box around it, and then use the wizard to add a combo box to the Caption: Customers section of the page.</li> In the wizard, add the CustomerID and CompanyName fields from the Customers table to the combo box, and then accept all other defaults.</li> Right-click the combo box, click Element Properties, click the All tab, and then change the ID property of the combo box to cboFindCustomer.</li> On the Tools menu, point to Macro, and then click Microsoft Script Editor.</li> In the Client Objects & Events drop-down list, click cboFindCustomer.</li> In the Event drop-down list, click onchange.</li>  Type the following code for the onchange event of the combo box: dim rs set rs = MSODSC.DefaultRecordset rs.Find &quot;CustomerID = '&quot; & cboFindCustomer.value & &quot;'&quot;, 0, 1, 1 </li> In the Client Objects & Events drop-down list, click MSODSC.</li> In the Event drop-down list, click afterdelete.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.

</li>  Type the following code for the afterdelete event: MSODSC.RecordsetDefs(0).ServerFilter = &quot;&quot; </li> Save, and then close the page.</li> Open the page in Microsoft Internet Explorer, and then click TestCompany in the drop-down list.</li> On the record navigation toolbar, click Delete, and then click Yes to the prompt confirming the deletion.</li></ol>

Note that after the record has been deleted, TestCompany no longer appears in the drop-down list.

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

<div class="moreinformation_section">

Steps to Reproduce the Behavior

 * 1) Complete steps 1 through 14 in the &quot;Resolution&quot; section of this article.
 * 2) Open the data access page in Internet Explorer.
 * 3) In the caption section of the page, click TestCompany in the combo box.
 * 4) On the record navigation toolbar, click Delete to delete the TestCompany record.
 * 5) Open the combo box again. Note that TestCompany still appears.

Additional query words: prb in step phase matched up match

Keywords: kbdap kbprb KB274387

-

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

© Microsoft Corporation. All rights reserved.