Microsoft KB Archive/293169

= HOW TO: Add an All Values Item to a Database Query Using FrontPage 2002 =

Article ID: 293169

Article Last Modified on 6/25/2004

-

APPLIES TO


 * Microsoft FrontPage 2002 Standard Edition

-



This article was previously published under Q293169



IN THIS TASK

 * SUMMARY
 * Adding an All Values Item to a Text Field Query
 * Adding an All Values Item to a Numeric Field Query
 * REFERENCES



SUMMARY
This article describes how to add an &quot;All Values&quot; item to a database query by using the Microsoft FrontPage 2002 Database Results Wizard.

The Database Results Wizard uses Active Server Pages (ASP) on a Web server running Microsoft Internet Information Services (IIS) to search a database. This article describes how to create an All Values search item for querying a database. Because the process is slightly different depending on whether you want to search a text field or a numeric field, this article presents both techniques in separate examples.

back to the top

Adding an All Values Item to a Text Field Query
You can perform a search of all text fields in a database by using a single wildcard character (%). From FrontPage, you can add an All Values option to a drop-down list of query values. To add an All Values item to a text field query, follow these steps:  Open a Web on a Web server running IIS and create a new page. On the Insert menu, point to Database, and then click Results. In the wizard, perform the following steps:  Click Use a sample database connection (Northwind) and then click Next. Click Record Source. In the Record Source list, click Products. Click Next. Click More Options. In the More Options dialog box, click Criteria. In the Criteria dialog box, click Add. In the Add Criteria dialog box, make the following selections: <ol> In the Field Name list, click ProductName.</li> In the Comparison list, click Contains.</li> Click to select the Use this search form field check box.</li> Click OK.</li></ol> </li> Click OK two more times to return to step 3 in the Database Results Wizard.</li> Click Next two times, and then click Finish.</li></ol> </li> Select the text box next to ProductName and press DELETE.</li> Add a drop-down box with a list of search values. To do this, use either of the following methods:

To create a search list manually:

<ol style="list-style-type: lower-alpha;"> On the Insert menu, point to Form, and then click Drop-Down box.</li> Double-click the drop-down box. In the Name box, type ProductName .</li> Click Add. In the Add Choice dialog box, follow these steps: <ol> In the Choice box, type All Values .</li> Click to select the Specify Value check box.</li> In the Specify Value box, type % .</li> Under Initial State, click Selected.</li> <li>Click OK.</li></ol> </li> <li>Repeat step c to add the following additional choices, values, and states to the drop-down list:

<pre class="fixed_text">Choice            Value            Initial State - Chai              Chai             Not Selected Chang             Chang            Not Selected Aniseed Syrup     Aniseed Syrup    Not Selected

</li> <li>Click OK to close the Drop-Down Box Properties dialog box.</li></ol>

To create a search list dynamically: <ol style="list-style-type: lower-alpha;"> <li>On the Insert menu, point to Database, and then click Results. In the wizard, perform the following steps: <ol> <li>Click Use a sample database connection (Northwind) and then click Next.</li> <li>Click Record Source. In the Record Source list, click Products. Click Next.</li> <li>Click Edit List. In the Displayed Fields list, select all fields except ProductName, and then click Remove. Click OK.</li> <li>Click Next.</li> <li>In the Choose formatting options for the records returned by the query list, click Drop-down list - one record per item, and then click Next.</li> <li>Click Finish.</li></ol> </li> <li>Double-click the drop-down box. In the Name box, type ProductName .</li> <li>Click Add. In the Add Choice dialog box, follow these steps: <ol> <li>In the Choice box, type All Values .</li> <li>Click to select the Specify Value check box.</li> <li>In the Specify Value box, type % .</li> <li>Under Initial State, click Selected.</li> <li>Click OK.</li></ol> </li> <li>In the Drop-Down Box Properties dialog box, select All Values entry and click the Move Up button to move the selection to the top of the list.</li> <li>Click OK to close the Drop-Down Box Properties dialog box.</li></ol> </li> <li>Save the page as Alltextvalues.asp .</li> <li>Preview the page in a Web browser using HTTP.</li> <li>In the ProductName list, click Chai, and then click Submit Query. All of the items in the database containing Chai in the product name will be displayed.</li> <li>To search for all of the products, select All Values, and then click Submit Query. All of the product names in the database will be displayed.</li></ol>

back to the top

Adding an All Values Item to a Numeric Field Query
If you want to search all numeric fields in a database, you cannot use wildcard characters. You can, however, use a logic operation to achieve the same results. To add an All Values item to a numeric field query, follow these steps: <ol> <li>Open a Web on a Web server running IIS and create a new page.</li> <li>On the Insert menu, point to Database, and then click Results. In the wizard, perform the following steps: <ol style="list-style-type: lower-alpha;"> <li>Click Use a sample database connection (Northwind) and then click Next.</li> <li>Click Record Source. In the Record Source list, click Products. Click Next.</li> <li>Click More Options. In the More Options dialog box, click Criteria.</li> <li>In the Criteria dialog box, click Add.</li> <li>In the Add Criteria dialog box, make the following selections: <ol> <li>In the Field Name list, click ProductID.</li> <li>In the Comparison list, click Equals.</li> <li>Click to select the Use this search form field check box. (The check box is selected by default.)</li> <li>Click OK.</li></ol> </li> <li>Click OK.</li> <li>In the More Options dialog box, click Defaults. In the Input Parameters list, click ProductID, and then click Edit.</li> <li>In the Value box, type 1 OR 1 and click OK.</li> <li>Click OK two more times to return to Step 3 of the Database Results Wizard.</li> <li>Click Next two times, and then click Finish.</li></ol> </li> <li>Select the form field text box next to ProductID and press DELETE.</li> <li>Add a drop down box with a list of search values. To do this, use either of the following methods.

To create a search list manually:

<ol style="list-style-type: lower-alpha;"> <li>On the Insert menu, point to Form, and then click Drop-Down box.</li> <li>Double-click the drop-down box. In the Name box, type ProductID .</li> <li>Click Add. In the Add Choice dialog box, make the following selections: <ol> <li>In the Choice box, type All Values.</li> <li>Click to select the Specify Value check box.</li> <li>In the Specify Value box, type 1 OR 1 .</li> <li>In the Initial State section, click Selected.</li> <li>Click OK.</li></ol> </li> <li> Repeat step c to add the following additional choices, values, and states to the drop-down list: <pre class="fixed_text">Choice           Specify Value         Initial State - Chai              1                    Not Selected Chang             2                    Not Selected Aniseed Syrup     3                    Not Selected </li> <li>Click OK to close the Drop-Down Box Properties dialog box.</li></ol>

To create a search list dynamically: <ol style="list-style-type: lower-alpha;"> <li>On the Insert menu, point to Database, and then click Results. In the wizard, perform the following steps: <ol> <li>Click Use a sample database connection (Northwind) and then click Next.</li> <li>Click Record Source. In the Record Source list, click Products. Click Next.</li> <li>Click Edit List. In the Displayed Fields list, select all fields except ProductID and ProductName, and click Remove. Click OK. Click Next.</li> <li>In the Choose formatting options for the records returned by the query list, click Drop-down list - one record per item. In the Display values from this field list, click ProductName. In the Submit values from this field list, click ProductID. Click Next.</li> <li>Click Finish.</li></ol> </li> <li>Double-click the drop-down box. In the Name box, type ProductID.</li> <li>Click Add. In the Add Choice dialog box, follow these steps: <ol> <li>In the Choice box, type All Values .</li> <li>Click to select the Specify Value check box.</li> <li>In the Specify Value box, type 1 OR 1 .</li> <li>Under Initial State, click Selected.</li> <li>Click OK.</li></ol> </li> <li>In the Drop-Down Box Properties dialog box, select the All Values entry and click the Move Up button to move the selection to the top of the list.</li> <li>Click OK to close the Drop-Down Box Properties dialog box.</li></ol> </li> <li>Save the page as Allnumericvalues.asp .</li> <li>Preview the page in a Web browser.</li> <li>In the ProductID list, click Product One, and then click Submit Query. All of the items in the database containing the number one in their Product ID will be displayed.</li> <li>To search for all products, select All Values, and then click Submit Query. All of the product IDs in the database will be displayed.</li></ol>

back to the top

<div class="references_section">