ACC: Parameter Prompt If LinkMaster/LinkChild Contains Table Name

ID: Q179832


The information in this article applies to:
  • Microsoft Access versions 2.0, 7.0, 97


SYMPTOMS

When you open a form that contains a subform or a report that contains a subreport, you may receive an unexpected prompt to enter a parameter value.


CAUSE

The LinkMasterFields or LinkChildFields property of the subform or subreport contains a reference to the underlying table or query. This table or query could be the record source of the main form, the main report, the subform, or the subreport. The property's value is in the format

MainTable.FieldName

Note that in Microsoft Access 2.0, this behavior occurs only when you refer to the underlying table or query in the LinkMasterFields property.

Because the reference to the table or query underlying the form or report is implied, it is not necessary to include the table or query name in the LinkMasterFields or LinkChildFields property.


RESOLUTION

Use one of the following resolutions to correct the behavior of the form or report.

  • Do not refer to the underlying table or query in the LinkMasterFields or LinkChildFields property.

    -or-


  • Refer to a control name on the main form or report that contains the appropriate value for the link criteria.



STATUS

This behavior is by design.


MORE INFORMATION

Steps to Reproduce Behavior

In Microsoft Access 7.0 and 97


  1. Open the sample database Northwind.mdb.


  2. In the Database window, click the Forms tab, and then click New.


  3. In the New Form dialog box, click Form Wizard, and then click OK.


  4. On the first screen of the Form Wizard, click Table: Categories in the Table/Queries list.


  5. Move the CategoryID, CategoryName, and Description fields from the Available Fields list to the Selected Fields list.


  6. Click Table: Products in the Table/Queries list.


  7. Move the ProductID, ProductName, CategoryID, and UnitPrice fields from the Available Fields list to the Selected Fields list, and then click Next.


  8. On the screen that asks you how you want to view your data, click By Categories, and then click to select Form with subform(s). Click Next.


  9. When asked what layout you would like for your subform, click to select Datasheet, and then click Next.


  10. When asked what style you would like, click Standard, and then click Next.


  11. When asked what titles you want for your forms, type frmLinkMain in the Forms box and frmLinkSub in the Subform box. Then click Finish.


  12. On the View menu, click Design View.


  13. Right-click frmLinkSub and then click Properties.


  14. Change the LinkChildFields property to Products.CategoryID, and change the LinkMasterFields property to Categories.CategoryID.


  15. View the form in Form view. Note that you are prompted for the parameters Categories.CategoryID and Products.CategoryID.


In Microsoft Access 2.0


  1. Open the sample database Nwind.mdb.


  2. In the Database window, click the Form tab, and then click New.


  3. In the New Form dialog box, click Categories in the Select a Table/Query list, and then click the Form Wizards button.


  4. In the Form Wizards dialog box, click Main/Subform, and then click OK.


  5. When the Main/Subform Wizard prompts you to choose which table or query contains the data for the subform, click Products; then click Next.


  6. When prompted to select the fields for the main form, move Category ID, Category Name, and Description from the Available Fields list to the Fields on Main Form list. Click Next.


  7. When prompted to select the fields for the subform, move Product ID, Product Name, Category ID and Unit Price from the Available Fields list to the Fields on Subform list. Click Next.


  8. When prompted to select a style for the form, click Standard, and then click Next.


  9. When prompted to provide a title for the form, type frmLinkMain. Click Finish.


  10. When you receive the message stating that you must save the subform, click OK.


  11. Type frmLinkSub in the Save As dialog box. Click OK.


  12. Open the frmLinkMain form in Design view.


  13. On the View menu, click Form Design.


  14. Right-click frmLinkSub, and then click Properties.


  15. Change the LinkChildFields property to Products.Category ID, and change the LinkMasterFields property to Categories.Category ID.


  16. Open the form in Form view. Note that you are prompted for the parameter Categories.CategoryID.



REFERENCES

For more information about linking main forms and subforms or main reports and subreports, search the Help Index for "LinkMasterFields property" and display the topic "LinkChildFields, LinkMasterFields Properties," or ask the Office Assistant.

Additional query words: param prompts

Keywords : FmrOthr
Version : WINDOWS:2.0,7.0,97
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: April 23, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.