Applies ToAccess for Microsoft 365 Access 2021 Access 2019

The following sections show how to use the product form and how to program it. The object names are provided so you can easily examine them in the ­Northwind 2.0 Starter Edition database.

Product forms have been designed in a simple way to highlight best practices. There are few advanced ways to manage product inventory as you would in a real-world application.

The main menu (frmMainMenu) has a Products command button that opens a list of products (sfrmMainMenu_ProductList) with hyperlinks to open the product details form (frmProductDetail) for each product and has the following action buttons:

  • The Add Product button to open a new blank product form.

  • The Export to File button to send the product list to a file of the user’s choice, such as Excel, .pdf, and so on.

On the Product Details form (frmProductDetail), you can delete unused products by using the Delete Product button.

The following information summarizes important points about how the form was developed.

Product details (frmProductDetail) gets its data from a simple query, qryProductDetail, specified in the RecordSource property. Basing a data entry form on a simple one-table query is a recommended practice.

Notice the text box, txtOrderLabel, above the product orders subform (sfrmProductDetail_OrderList). This is a good example of leveraging current variable values to customize the form display.

Another interesting feature of this and other detail forms is that they pop up and can be moved around. This can be accomplished in one of two ways:

  • Setting the Form PopUp Property to "Yes."

  • Opening the form as a Dialog: When opening a form (with a macro or code), specify the Window Mode argument as "acDialog". Note that opening a form as a dialog will override the form’s Modal property if that property is set to "No."

Every form has a Modal Property. When this property is set to “yes,” you are prevented from interacting with any other form while the form is open. When a form is opened via macro or code using the Window Mode "acDialog", the form is automatically modal, regardless of the form’s Modal property.

Also notice that the Product Description text box has Rich Text enabled. This means that the text can be displayed using different fonts and colors within the text box. Because the product details form’s Popup mode is "Yes", the text formatting shortcut menu bar is not available. You can try pasting some rich text from a Word document, or temporarily resetting the form’s Popup property to “No.”

The product orders subform (sfrmProductOrders) of the product detail form in the subform control named ctlProductOrders is bound to a three-table query of products that have been ordered. This subform’s rows are filtered for the current product by setting the LinkMasterFields and LinkChildFields properties of the subform control.

See also

Northwind 2.0 Starter Edition

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.