Adding a Subform to a Form in Design View

From NeoWiki

Revision as of 03:39, 25 October 2007 by Lorinda (Talk | contribs)
Jump to: navigation, search
This article is part of the To Base and Back Again tutorial series.

Because the new Bird_Pictures table and form we created (See Creating a Table and a Form to Store Images ) includes a PicFieldTripID field, it would be helpful if there were an easy way for users entering data in the Bird Pictures Data Entry form to look up the Field Trip ID for a particular date without having to leave the form. We can do this by adding a subform to our form.

Create the Subform

  1. Open the Bird Pictures Data Entry form for editing by control-clicking on the form in the main database document window. (make sure you have chosen Forms in the left hand column of the window)
  2. Make sure that the Form Design toolbar is visible. (Go to the Tools menu and choose Toobars if Form Design is not checked, select it.)
  3. Click on the Form Navigator button on the Form Design toolbar. (It looks like a form icon with a small Navigator icon on it.) The Form Navigator
  4. Right-click or control-click on the MainForm icon and choose New and then Form from the contextual menu. A new form icon named Standard appears in the Form Navigator
  5. Right-click or control-click on the Standard form icon and choose Properties. The Form Properties window opens.
  6. In the Data tab, choose Field_Trips from the Content dropdown menu.
  7. Click on the ... button next to Link master fields. The Link Fields window opens.
    Under Field_Trips choose Date from the dropdown.
    Under Bird_Pictures choose DateTaken from the dropdown.
  8. Set Allow additions, Allow deletions, and Allow Deletions to no. (Obviously, if you were creating a subform for data entry, you would leave these set to yes.)
  9. In the General tab, give the form a more identifiable name. I chose FieldTripDates.
  10. Close the Form Properties
  11. In the Form Navigator window, make sure the subform (named FieldTripDates in our example) is selected
  12. Click on the More Controls button on the Form Controls Toolbar.
  13. In the More Controls window, click on the Table Control
  14. Click and drag on the form to draw the table. The Table Element Wizard - Field Selection window opens.
  15. In the Existing fields section of the Table Element Wizard window, select the following fields and then click the -> button after each selection to move them over to the Selected fields section.
    ID
    Date
    Location
    we are including the location field for those instances where more than one field trip occurred on the same date.
  16. Click on the Finish button.
  17. Adjust the column widths and properties as desired.
    To adjust properties, control-click on a column header and choose Column from the contextual menu.
  18. Save the form by pressing Command-S.

Test the form

  1. Shift to data entry mode by clicking on the Design Mode On/Off button on either the Form Controls or Form Design toolbars.
  2. Add a new entry using the following data:
    DateTaken: 05/13/1900
    BirdPictured: American Goldfinch
    Image:Goldfinch.jpg
  3. Once the data is entered, click on the subform table; you may need to wait, but when the data is posted, a field trip should show up in the subform. You can now enter the Field Trip ID in the main form.
Personal tools