HOW TO: Run a Query from a Drop-Down Menu in Front Page 2000 (265307)
The information in this article applies to:
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:
- 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.
- On the Insert menu, point to Form, and then click One-Line Text Box.
- 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.
- In step 1 of 5, click to select Use a sample database connection (Northwind), and then click Next.
- In step 2 of 5, under Record source, click to select Employees, and then click Next.
- 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.
- 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.
- In step 5 of 5, click Finish to complete the creation of the drop-down menu.
- Right-click on the Submit button, and then click Form Properties.
- In the Form Properties dialog box, click to select Send to other, and then click Options.
- Type results.asp in the Action text box, and then click OK twice.
- Save the page as form.asp.
- On the File menu, point to New, and then click Page. In the New dialog box, click Normal Page, and then click OK.
- On the Insert menu, point to Database, and then click Results to start the Database Results Wizard.
- In step 1 of 5, click to select Use a sample database connection (Northwind) and then click Next.
- In step 2 of 5, under Record source, click to select Employees, and then click Next.
- In step 3 of 5, click More Options, and then click Criteria.
- In the Criteria dialog box, click Add, and select LastName in the Field Name text box. Click OK three times.
- 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.
- Save the page as results.asp.
- 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: | Major | Last Reviewed: | 10/27/2002 |
---|
Keywords: | kbhowto kbHOWTOmaster KB265307 |
---|
|