In This Site

Home
Free News Updates
Using Microsoft FrontPage
Cascading Style Sheets
Database Fundamentals
FrontPage & Access
FrontPage Navigation
Website Security
Solving Problems
Learning SQL
Code Samples
Promote Your Site

In This Section

Up
Progressive Search Forms
Add An All Values Option
Add Multiple Select
Adding Text Search
Search Multiple Fields
Search Multiple Tables

The number one source for making your website sell!

 

 

 

FrontPage Tips by Ward Cameron Enterprises
Take Your Web Site to New Levels

Using FrontPage's Text Search Capability

This tutorial is part of a larger discussion on creating search forms for your FrontPage Database website. Click here to read the full tutorial.

The process involves several steps
1. Searching begins with website design
2. Create a Progressive Search Form
3. Add an All Values option to your Search Form
4. Using Drop-down Menus with Multiple Select
5. Add a Text Search Field Using the DRW
6. Search Multiple Fields in the Same Table
7. Search Multiple Fields or Tables in the Same Database

Using the built-in tools of FrontPage, you can create a simple search field that will allow users to search for specific data. The Database Results Wizard (DRW) makes this a simple process. In this case, we'll create a search form to search for a company from our Customers table.

On a blank page select Insert-Database-Results and follow these directions

  1. Step 1. Select the Northwind database connection
  2. Step 2. Select the Customers table
  3. Step 3. Remove all the fields with the exception of the CompanyName and CustomerID fields. Click the More Options button and then Criteria. Add the criteria CompanyName Like CompanyName. This will provide the comparison mechanism we need to help us find a company that we may only know a portion of the name.
  4. Step 4. Select List - one field per item
  5. Step 5. Select display all records together AND Add Search Form. Click Finish

You will now have a form that resembles the following example. You will need to make sure your site visitors understand how to use this form. The Like option is SQL allows FrontPage to find the data with a minimum of information, but it will not find it if you just type in a few letters. In the following form, type the letter a and click submit. You'll see a mesage indicated "No Records Returned" - even though there are several companies whose names begin with A. For this to work, you need to use the percent symbol (%) as a wild card.

If you want to find companies that begin with A then type A% into the search field. Give it a try.

If you want to find names that end with A then type %A.

If you want to find names that contain a text string, then enclose the string in percent symbols. Try the following: %the%. This will return all companies whose name contains the word "the".

Click here to see it in action

OK, I hear you. Your users will not read the directions that tell them to use the % wildcard in their searches.

There IS a way around this, and it includes replacing the LIKE comparison with CONTAINS.

In Step 4 above, we set our criteria to CompanyName LIKE CompanyName. This provided a search form that compares what we type to what is in the database. It makes an exact comparison and so wildcards help to extend the reach of this technique.

Using CONTAINS instead searches for any record containing the string. This means that it will list records that have the string at the beginning, middle or end of the value.

This is often the preferred way to create these searches. They don't require wildcards, in fact they assume the % should be placed at the beginning and end of whatever is typed into the search field.

Click here to check it out

When we created the form, we included both the CustomerID field AND the CompanyName field. I deleted the CustomerID field because we do not need it to display. However, if you want to add another page that will show the details on any of the customers returned by the search form, then the CustomerID field comes into play.

To do this, create another page with the name TextSearchResults.asp and insert a DRW onto it. Select the Customer table and add the criteria CustomerID=CustomerID. Have it display all of the fields in the table.

Now return to the search form you created above. Highlight the <<CompanyName>> field and select Insert-Hyperlink. Link the field to TextSearchResults.asp and click the Parameter button Add the parameter CustomerID. Now when you click on any of the company names, you will be taken to another page with more detail about the individual company. You can give it a try on the form above.

In our next tutorial, you'll learn how to use FrontPage's Mulitple Select feature on your search forms. Click here to read it now

These tutorials are part of an upcoming training course called "FrontPage Magic - How To Create A Database Driven Website For Non-Programmers". Stay tuned for more details on this exciting new product.

Send your tips to .
All materials Copyright © Ward Cameron All Rights Reserved