HOW TO: Run a Query from a Drop-Down Menu in Front Page 2000 (265307)



The information in this article applies to:

  • Microsoft FrontPage 2000

This article was previously published under Q265307

SUMMARY

This article shows you how to create a drop-down menu that is populated with field items from a database. It then shows you how you can select one item from the drop-down menu as the criteria for a query that will return results on a Web page.

back to the top

Create a Drop-Down Menu

To create a drop-down menu that is populated with field items from a database, follow these steps:
  1. Start Microsoft FrontPage. On the File menu, point to New, and then click Web. In the New dialog box, click One Page Web, and then click OK.
  2. On the Insert menu, point to Form, and then click One-Line Text Box.
  3. Click to select just the text box, and then on the Insert menu, point to Database, and then click Results to start the Database Results Wizard.
  4. In step 1 of 5, click to select Use a sample database connection (Northwind), and then click Next.
  5. In step 2 of 5, under Record source, click to select Employees, and then click Next.
  6. In step 3 of 5, click Edit List. In the Displayed Fields dialog box, remove all fields under Displayed fields except LastName, and then click OK. Click Next.
  7. In step 4 of 5, select Drop-Down List - one record per item when prompted to choose formatting options for the records returned by the query. Values will be submitted and displayed from the LastName field by default. Click Next.
  8. In step 5 of 5, click Finish to complete the creation of the drop-down menu.
  9. Right-click on the Submit button, and then click Form Properties.
  10. In the Form Properties dialog box, click to select Send to other, and then click Options.
  11. Type results.asp in the Action text box, and then click OK twice.
  12. Save the page as form.asp.
  13. On the File menu, point to New, and then click Page. In the New dialog box, click Normal Page, and then click OK.
  14. On the Insert menu, point to Database, and then click Results to start the Database Results Wizard.
  15. In step 1 of 5, click to select Use a sample database connection (Northwind) and then click Next.
  16. In step 2 of 5, under Record source, click to select Employees, and then click Next.
  17. In step 3 of 5, click More Options, and then click Criteria.
  18. In the Criteria dialog box, click Add, and select LastName in the Field Name text box. Click OK three times.
  19. Click Next twice. In step 5 of 5, click to clear the Add search form check box, and then click Finish to complete the wizard.
  20. Save the page as results.asp.
  21. In the Folder List, double-click form.asp to open it. On the File menu, click Preview in Browser to view the form. Click the drop-down arrow in the Last Name text box. Notice that you have a list of employees' last names to choose from. Select Fuller and then click Submit. Notice that the results form opens and displays the data for Andrew Fuller.
NOTE: To set the drop down menu to display only distinct field values, use the following SQL statement

SELECT DISTINCT Field Name FROM Table Name

where Field Name represents the field name that you are using form your menu, and Table Name is the table in the database where the fields reside.

back to the top

Modification Type:MajorLast Reviewed:10/27/2002
Keywords:kbhowto kbHOWTOmaster KB265307