ACC2: Command Button Wizard Prompts for Parameter Value

Last reviewed: July 11, 1997
Article ID: Q119475
The information in this article applies to:
  • Microsoft Access version 2.0

SYMPTOMS

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

When you choose a command button, created with the Commmand Button Wizard, on a subform to open another form to the current record in the subform, you are prompted "Enter a parameter value" for the value of the linked field as if the subform were a main form, not a subform.

CAUSE

When you created the command button, the Command Button Wizard did not recognize that the form you were using was a subform. Instead, the wizard assumed that the form was a main form.

RESOLUTION

After you run the Command Button Wizard, edit the command button's code to properly reference the control on the subform. The correct syntax for referencing a control on a subform is:

   Forms![MainFormName]![SubformName].Form![ControlName]

STATUS

Microsoft has confirmed this to be a problem in Microsoft Access version 2.0. This problem no longer occurs in Microsoft Access version 7.0.

MORE INFORMATION

Steps to Reproduce Problem

CAUTION: Following the steps in this example will modify the sample database NWIND.MDB. You may want to back up the NWIND.MDB file, or perform these steps on a copy of the NWIND database.

  1. Open the sample database NWIND.MDB.

  2. Open the Categories Subform form in Design view.

  3. Set the form's DefaultView property to Single Form.

  4. Make sure that the Control Wizards button in the toolbox is selected (the button should appear sunken).

  5. Add a command button to the form. Fill out the Command Button Wizard screens as follows:

        a. In the Categories box, select Form Operations. In the When
           Button Is Pressed box, select Open Form. Choose the Next button.
    

        b. In the "What form would you like this command button to open?"
           box, select Products. Choose Next.
    

        c. Select the "Open the form and find specific data to display in
           it" option button. Choose Next.
    

        d. In the Categories Subform box, select Product ID. In the Products
           box, select Product ID. Choose the "<->" button, then choose
           the Finish button.
    

  6. Save and then close the form.

  7. Open the Categories form in Form view.

  8. Choose the new command button on the subform. You will be prompted:

          Enter Parameter Value: Forms!Categories Subform!Product ID
    

REFERENCES

For more information about how to reference a control on a subform, search for "subforms: referring to controls," and then "Referring to Controls on a Subform or Subreport" using the Microsoft Access Help menu.

Microsoft Access "Building Applications," version 2.0, Chapter 4, "Using Forms to Collect, Display, and Filter Information," page 83


Additional query words: sf
Keywords : FmsButb kbusage
Version : 2.0
Platform : WINDOWS
Hardware : X86
Issue type : kbbug
Resolution Type : kbworkaround


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 11, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.