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
Working With Dates
Using Or with And

 

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

Solving the Many Challenges of Working With Date Fields

Date fields can cause no end of challenges in Microsoft FrontPage Database Sites. First, there is the challenge of controlling how your users enter their date information to ensure that it is correctly stored in your Database. If they enter 1/3/2003, did they mean January 3 or March 1?

Secondly, there is the added problem that occurs when you try to search for date related data. Since the text forms created by FrontPage look for text data, rather than date formatted information, you will likely end up with a cryptic error message.

This tutorial will help you to correct some of these challenges.

Set Today's Date as a Default in Your FrontPage Form
Control How Your Users Enter Date Related Information
Correct the Error Messages When Searching Date Fields
Set Today's Date as a Default in Your FrontPage Form

To set the default date in a date field as the current date, into a blank form place a text field. Now right click and select form field properties. Enter the following code into the Initial Value Field: <%=date()%>

Control How Your Users Enter Date Related Information

This is one of the biggest headaches when trying to collect date related information. I've tried working with small date calendar scripts, but I've never managed to get any of them to work. I finally solved this problem by using a series of three drop-down boxes, one each for the Month, Day and Year. Click here to learn how I solved this challenge

Correct the Error Messages When Searching Date Fields

Now, when you try to create a search form that queries date related information, you will often run into problems.

You will get the following error message:

Switch to HTML view and search for the following:

fp_sQry="SELECT * FROM Employees WHERE (HireDate = #::HireDate::#)"

Replace WHERE (HireDate = '::HireDate::')" with

WHERE (HireDate = #::HireDate::#)"

Select a hire date from the following drop-down list and click the submit button. You'll see the information for the employees hired on that particular date.


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