Adding a Search Control to a Form

From NeoWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 02:26, 17 October 2007 (edit)
Lorinda (Talk | contribs)
(begin article)
← Previous diff
Revision as of 02:54, 17 October 2007 (edit) (undo)
Lorinda (Talk | contribs)
(Add An Alias to the '''All Sightings''' Query - continue article)
Next diff →
Line 4: Line 4:
==Add An Alias to the '''All Sightings''' Query== ==Add An Alias to the '''All Sightings''' Query==
 +In the process of testing this approach, I discovered that the field name '''StateOrProvince''' was problematic. The macro described later in this article read this name as two field names separated by the logical operator "OR", and threw an SQL error. Fortunately, this issue was easily solved by creating an alias for the field in question.
 +
 +#Open the '''All Sightings''' Query for editing (In the main database document, click on {{prefName|Queries}} in the left hand column, then right-click or control-click on the '''All Sightings''' Query and choose {{Menu|Edit}} from the contextual menu)
 +#In the '''Alias''' row of the '''StateOrProvince''' column, type <tt>State</tt>
 +#Click the Save icon on the toolbar, or hit {{Key|Command-S}}
 +#Close the Query
 +
 +==Adding the Control to the Form==
 +#Open the '''All Sightings''' Form for editing (In the main database document, click on {{prefName|Forms}} in the left hand column, then right-click or control-click on the '''All Sightings''' Query and choose {{Menu|Edit}} from the contextual menu)
 +#Right-click or control-click on the '''State''' column heading and choose {{Menu|Column...}} from the contextual menu.
 +#In the {{Section|Tab} of the {{Window|Properties: Text Box}} window, replace '''StateOrProvince''' with '''State'''
 +#Close the {{Window|Properties: Text Box}} window.
 +#:'''Note''' the steps above are not normally part of creating a search control. They are necessary here because we created the Alias for the StateOrProvince field after the form was built.
 +#If the Form Controls toolbar is not visible, go to the {{Menu|View}} menu and choose {{Menu|Toolbars}} an then {{Menu|Form Controls}}.
 +#Click on the Combo Box form control on the toolbar
 +#On the form, drag to create a Combo Box in the space between the title and the table.

Revision as of 02:54, 17 October 2007

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

In addition to using form-based filters, you can also create a control on a form that will allow the user to quickly filter the data according to the control setting. As an example of this, we will create a combo box on our All Sightings form to filter by the StateOrProvince field. The process for creating a search control with a text box or a list box is very similar.

Add An Alias to the All Sightings Query

In the process of testing this approach, I discovered that the field name StateOrProvince was problematic. The macro described later in this article read this name as two field names separated by the logical operator "OR", and threw an SQL error. Fortunately, this issue was easily solved by creating an alias for the field in question.

  1. Open the All Sightings Query for editing (In the main database document, click on Queries in the left hand column, then right-click or control-click on the All Sightings Query and choose Edit from the contextual menu)
  2. In the Alias row of the StateOrProvince column, type State
  3. Click the Save icon on the toolbar, or hit Command-S
  4. Close the Query

Adding the Control to the Form

  1. Open the All Sightings Form for editing (In the main database document, click on Forms in the left hand column, then right-click or control-click on the All Sightings Query and choose Edit from the contextual menu)
  2. Right-click or control-click on the State column heading and choose Column... from the contextual menu.
  3. In the {{Section|Tab} of the Properties: Text Box window, replace StateOrProvince with State
  4. Close the Properties: Text Box window.
    Note the steps above are not normally part of creating a search control. They are necessary here because we created the Alias for the StateOrProvince field after the form was built.
  5. If the Form Controls toolbar is not visible, go to the View menu and choose Toolbars an then Form Controls.
  6. Click on the Combo Box form control on the toolbar
  7. On the form, drag to create a Combo Box in the space between the title and the table.
Personal tools