ACC: Form Name Err Msg Using Data Outline Control (95/97) (142843)



The information in this article applies to:

  • Microsoft Access for Windows 95 7.0
  • Microsoft Access 97

This article was previously published under Q142843
Moderate: Requires basic macro, coding, and interoperability skills.

SYMPTOMS

When you double-click a row in your Data Outline Control, you may receive the following error message:
The action or method requires a Form Name argument.
This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual.

CAUSE

The Data Outline Control's FormName property for that level is blank.

RESOLUTION

You can either change the Data Outline Control to open a form at that level or create a Visual Basic for Applications procedure that will cancel the event if the FormName property is blank. To create this procedure, follow these steps:

  1. View the form containing the Data Outline Control in Design view and using the right mouse button (right-click), click the Data Outline Control.
  2. Click Build Event.
  3. Select RequestFormOpen in the Procedure (Proc:) list.
  4. Add the following sample code to the Data Outline Control's RequestFormOpen event:
          Sub ActiveXCtl0_RequestFormOpen(Cancel As Integer, ByVal Level As _
              Integer)
    
             Dim L As Object
             Set L = Me![ActiveXCtl0].Object.Levelinfos
             If L(Level).FormName = "" Then Cancel = True
          End Sub
    						
    This procedure prevents the Data Outline Control from trying to open the form if the FormName property is blank.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Open the sample database Northwind.mdb.
  2. Create a new, blank form.
  3. On the Insert menu, click ActiveX Control (or Custom Control in Microsoft Access 7.0).
  4. In the Insert ActiveX Control dialog box, select Data Outline Control 1.2 (or Data Outline Control 1.1 in Microsoft Access 7.0), and then click OK.
  5. On the Edit menu, click Data Outline Control 1.2 Object, and then click Properties.
  6. Click the Level One tab and type Categories in the RecordSource property.
  7. Type CategoryName in the DisplayFields property, and then click OK.
  8. View the form in Form view, and double-click any row in the Data Outline Control.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kberrmsg kbprb kbProgramming KB142843