ACC2002: Access Quits When You Set the ControlSource Property on a Data Access Page (295257)



The information in this article applies to:

  • Microsoft Access 2002

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("ControlName").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.

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

    ID: txtValueTest

  5. On the Tools menu, point to Macro, and then click Microsoft Script Editor.
  6. 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.

  7. Type or paste the following line in the Script Editor between the SCRIPT tags.
        txtValueTest.value = ReportsTo.value
    					
  8. Save the changes, and then view the data access page in Page view.

STATUS

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

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Start Access, and then open the sample database Northwind.mdb.
  2. 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.
  3. In the field list, expand the Categories table.
  4. Drag the CategoryID field from the table to the page.
  5. Add a new text box to the page.
  6. Right-click the new text box, and then click Element Properties on the shortcut menu.
  7. Type the following expression in the ControlSource property on the Data tab:

    =document.all("CategoryID").value

  8. Press TAB or click Page View on the View menu. Note that you receive the error message that is mentioned in the "Symptoms" section of this article, and then Access quits.

Modification Type:MinorLast Reviewed:9/27/2006
Keywords:kbbug kberrmsg kbnofix KB295257