Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How to filter a database query by using a drop-down list in FrontPage 2000


View products that this article applies to.

Summary

FrontPage 2000 enables you to create a database query that results in a list that displays all of the records in a particular field. This article describes the steps that you can use in one database query to limit the results of another database query.


Filter a Database Query by Using Drop-Down List Populated from Another Query

Use the following procedures in the next two sections to use a filter from a database query within a drop down list box that has been populated from another query.


Create a Search Form

  1. Open a web in FrontPage on an ASP-enabled web server.
  2. Start a new, blank page.
  3. On the Insert menu, click Form, and then select Form.
  4. Position the insertion point within the form. On the Insert menu, click Database, and then select Results.
  5. In step 1 of the Database Results Wizard, select your database connection.
    Example: Choose Use a sample database connection (Northwind).
    Click Next.
  6. In step 2 of the wizard, select your record source.
    Example: Choose Categories.
    Click Next.
  7. In step 3 of the wizard, select Edit List, and then remove all of the fields except the one or two that you will use to query the database. Click OK.
    Example: Remove all fields except CategoryID and CategoryName.
    Click Next.
  8. In step 4 of the wizard, click to select Drop-Down List from the list of formatting options, assign the display and submit values, and then click Next.
    Example: Choose to display CategoryName and submit CategoryID.
    Click Next.
  9. In step 5 of the wizard, click Finish.


Show the Filtered Database Results

  1. Position the insertion point somewhere outside the form where you want the filtered database results to be displayed.
  2. On the Insert menu, click Database, and then select Results.
  3. In step 1 of the Database Results Wizard, select your database connection.
    Example: Choose Use a sample database connection (Northwind).
    Click Next.
  4. In step 2 of the wizard, select your record source.
    Example: Choose Products.
    Click Next.
  5. In step 3 of the wizard, click More Options, click Criteria, and then click Add. Choose the field that you want to use to filter the database. (NOTE: This must be the same field that you chose when you created the drop-down list earlier in this article.)
    Example: Use CategoryID.
    Make sure the Use this search form field check box is selected, and then click OK twice.
  6. In the More Options dialog box, click Defaults. Select the query field, click Edit, and then add a default value that matches the field type. (For example, if it is a number field, the default value could be 0.)
    Example: Type 0 for the default value; this should return no records.
    After typing a default value, click OK three times, and then click Next.
  7. In step 4 of the wizard, choose to return the result to a table, and then click Next.
  8. In step 5 of the wizard, make sure the Add Search Form check box is cleared (not selected), and then click Finish.


↑ Back to the top


References

For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:
244968 FP2000: How to Add an All Values Item to a Database Query
265307 How to run a query from a drop-down menu in Front Page 2000

↑ Back to the top


Keywords: KB235554, kbquery, kbfilters, kbdatabase, kbhowtomaster

↑ Back to the top

Article Info
Article ID : 235554
Revision : 2
Created on : 9/27/2004
Published on : 9/27/2004
Exists online : False
Views : 266