Microsoft KB Archive/295257

= ACC2002: Access Quits When You Set the ControlSource Property on a Data Access Page =

Article ID: 295257

Article Last Modified on 9/27/2006

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q295257



Moderate: Requires basic macro, coding, and interoperability skills.

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



SYMPTOMS
On a data access page, when you set the control source of a text box or a Bound SPAN to an expression that references the HTML document object, Microsoft Access may stop responding, or you may receive the following error message, and then Microsoft Access quits:

Microsoft Access has encountered a problem and needs to close.

We are sorry for the inconvenience.



CAUSE
Possible causes of this problem may include using a control source that references one of the following:
 * document.all(&quot;ControlName&quot;).value, where ControlName is the name of a control on the page
 * document.title



RESOLUTION
Use script to fill the control. For an example of how to do so, follow these steps.

CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

 Start Access, and then open the sample database Northwind.mdb. Open the Employees data access page in Design view. If the toolbox is not already visible, click Toolbox on the View menu. Add a new text box to the page, and then set the following property:

ID: txtValueTest

 On the Tools menu, point to Macro, and then click Microsoft Script Editor. In the Client Objects & Events box, click MSODSC in the list. Click Current in the list of events.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 or paste the following line in the Script Editor between the SCRIPT tags. txtValueTest.value = ReportsTo.value </li> Save the changes, and then view the data access page in Page view.</li></ol>

<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
<ol> Start Access, and then open the sample database Northwind.mdb.</li> Create a new data access page in Design view.

NOTE: Click OK if you are prompted that you will not be able to make design changes to the data access page in Microsoft Access 2000.</li> In the field list, expand the Categories table.</li> Drag the CategoryID field from the table to the page.</li> Add a new text box to the page.</li> Right-click the new text box, and then click Element Properties on the shortcut menu.</li> Type the following expression in the ControlSource property on the Data tab:

=document.all(&quot;CategoryID&quot;).value

</li> Press TAB or click Page View on the View menu. Note that you receive the error message that is mentioned in the &quot;Symptoms&quot; section of this article, and then Access quits.</li></ol>

Additional query words: pra hang dap

Keywords: kbbug kberrmsg kbnofix KB295257

-

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

© Microsoft Corporation. All rights reserved.