Using Combo Boxes in a Form

From NeoWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 18:07, 17 September 2007 (edit)
Lorinda (Talk | contribs)
(Adding the Combo Box - change section title name)
← Previous diff
Revision as of 18:11, 17 September 2007 (edit) (undo)
Lorinda (Talk | contribs)
(Using a Combo Box in a Data Sheet Style Form - clarify section title)
Next diff →
Line 40: Line 40:
-==Using a Combo Box in a Data Sheet Style Form==+==Creating A Combo Box in a Data Sheet Style Form==
Setting up a Combo Box is more complicated when the form uses a Data Sheet (spreadsheet-like) format. We need to use this technique in our Field Trips Data Entry form. (See [[Creating A Data Entry Form With A Subform]]) Entering Bird Names correctly in the subform will be much simpler if we use a Combo Box. Setting up a Combo Box is more complicated when the form uses a Data Sheet (spreadsheet-like) format. We need to use this technique in our Field Trips Data Entry form. (See [[Creating A Data Entry Form With A Subform]]) Entering Bird Names correctly in the subform will be much simpler if we use a Combo Box.

Revision as of 18:11, 17 September 2007

This article is part of the To Base and Back Again tutorial series.

Forms can include Combo Boxes and/or List Boxes to make data entry easier. List Boxes force the user to choose one of a list of pre-defined values. New values cannot be added. List Boxes use references. Combo Boxes do not use references, and allow users to choose from a pre-defined list or to add a new value. For more information on the differences between these two, type Combo Box/List Box Wizard into the Search Term field in the NeoOffice Help window.

Contents

Adding a Combo Box to Forms (except Data Sheets)

For our example, we will create a combo box for the Terrain Type field the the Locations Data Entry form. (see Creating a Simple Data Entry Form) We want to use a combo box here so that we can add new terrain types directly from the Locations Data Entry form, rather than needing to open the Terrain Types table.


Preparing the Form for the Combo Box

These steps are only necessary for forms created using the Form Wizard. If you are creating a form in design view, skip directly to Using Combo Boxes in a Form#Creating the Combo Box

  1. Open the database document
  2. Click on the Forms icon in the left column
  3. Right-click on the Locations Data Entry icon in the Forms section and choose Edit from the contextual menu that appears.
  4. Click on Terrain Type.
  5. The Label and the (blank) text box have been grouped in order to proceed, they must be ungrouped: Under the Format Menu, choose Group and then Ungroup.
  6. Click elsewhere on the form
    1. Click on the blank text box under the words Terrain Type
  1. Hit the delete key

Creating the Combo Box

  1. Make sure the Form Controls toolbar is visible. If not, under the View choose Toolbars and then Form Controls.
  2. Click on the Combo box icon. (The icon with a blank drop-down box and a scrolling list below it. Watch the tooltips as you mouse over the icons to find the right one.)
  3. Move your mouse back onto the form. The cursor has turned into cross.
  4. Drag to create the combo box in the location where the blank text box was before.
    -->A combo box control appears, and the Combo Box Wizard appears
  5. In the list of tables, click on Terrain Types.
  6. Click Next>>
  7. In the Existing Fields section, click on Terrain
  8. Click Next>>
  9. Select Yes, I want to save it in the following field:
  10. Select TerrainType from the drop-down menu
  11. Click Finish

Notes

  • During data entry, if you enter a value not in the combo box, it will be written to the Locations table, but not to the Terrain Type table. For consistancy's sake, it is best to enter Terrain Types in the Terrain Types table as much as possible.
  • This process needs to be repeated for any fields for which there exist "convenience" tables. (e.g. StateOrProvince, WaterType, etc.)
  • Some individuals may find it easier to create the form using Design View, rather than the Form Wizard, since adding combo boxes requires ungrouping and deleting fields if the Form Wizard has been used.


Creating A Combo Box in a Data Sheet Style Form

Setting up a Combo Box is more complicated when the form uses a Data Sheet (spreadsheet-like) format. We need to use this technique in our Field Trips Data Entry form. (See Creating A Data Entry Form With A Subform) Entering Bird Names correctly in the subform will be much simpler if we use a Combo Box.

  1. Open the database document
  2. Click on the Forms icon on the left hand column
  3. Right-click or control-click on the Field Trips Data Entry form and choose Edit... from the contextual menu.
  4. When the form opens, right-click or control-click on the Bird Name column header in the sub-form and choose Replace With... and then Combo Box.
  5. Rick-click or control-click once again on the Bird Name column header in the sub-form anc choose Column...
  6. Click on the Data tab in the Properties: Combo Box window
  7. Set Type of list contents.... to Sql
  8. In the List Content... box, type the following SQL statement:
    SELECT DISTINCT "EnglishName" FROM "AOU Birdlist"
  9. Close the Properties: Combo Box window by clicking on the red dot.
  10. Now click the Design Mode On/Off button (the one that looks like a blue drafting triangle) to shift to data entry mode. Enter a test set of data. Note that when you begin typing in a cell in the BirdName column, bird names appear. You can also click on the triangle to see a list of bird names.


This article in other languages: Français
Personal tools