UD40 Ultradev Tutorials
Home

Tutorials

Search

Links

Credits

Feedback
Home | Search | Back
Tutorial 1 - Filtering records based on Month or Day from a Date column
This tutorial shows you how to make a query that will allow you to pull up records that are in a certain month or day based on your selection.

First let us take a look at the database design.



Create a column in your database that stores a date in the mm/dd/yy format. The default value is set using Date() which will give you dates in the form of 1/5/01. Do not use Now() as it will give you dates in the form of 1/5/01 along with the hours and seconds.

Now back to your ASP pages in UltraDev. Create a form with 2 dropdown menus, one labeled Month and the other Day. Populate them with the appropriate labels and values. The value for both day and month should be in the format of 1, 2, 3... and not 01, 02, 03...



Now it is time to set up the recordset with the proper SQL statement on the target page of your form.



The screen-shot above should be self-explanatory. Remember that SQL statement with dates is enclosed within a pair of #s. The /01 part means we are filtering records created in the year 2001. You can set up a third dropdown box for another variable to filter the year if you like.

The default value for Bulan is set to 13 because if you don't put a figure in this column UltraDev will not let you expand the Recordset menu in the Data Binding palette. Since there are only 12 months, a default value of 13 would never interfere in your recordset filtering.

Demo | Back


Copyright © 2001, Swee Hoe Ong
All rights reserved.