In This SiteIn This SectionThe number one source for making your website sell!
|
FrontPage Tips by Ward Cameron Enterprises
|
|||||||||||||||||||||||
| FirstName | LastName | Date | |
| sdf | sdf | 2/4/2003 | |
| test | icle | 1/1/2003 | |
| zifqdsigrpa | zifqdsigrpa | ||
| radajgbv | radajgbv | ||
| Doug | Smith | 7/15/2003 | |
To take this one step further, I needed to find a way to use this same technique in an updatable form. When I developed my online database applications, the first step was creating the main form to add a record to the database. We've now accomplished that task.
Now what happens when you want to edit that record. You can use the same technique, but you need to add a few steps to set up the form.
Once you have entered a date to your database, you will need to disassemble it to create the three field values of month, day and year. I accomplished this by creating a query and adding three new fields, each of which displayed part of the date value.
To do this, create a blank query and add all of the values from your original table. Now, in a blank column of the query design window type the following:
Month:Format([Date],"mm")
This will create a new field in the query called "Month", formatted to show only the two digit month value. Now, let's create two more values:
Day:Format([Date],"dd") and
Year:Format([Date],"yyyy")
You now have added fields for Month, Day and Year to the query. When we create the update form using the techniques in the Edit Records Tutorial we'll add an identical date field from the first step of this tutorial. The only difference is an additional value added to the top level of each drop-down list.
Copy the Date drop-down fields from your original Add Record form. Double click on the Month Drop-down and click the add value button. Under choice type the following:
<%=FP_FieldHTML(fp_rs,"Month")%>

It should look like the image to the left. Be sure to deselect Specify Value and to make sure Selected is highlighted.
Do this again for each of the other two fields. You've now created a series of three drop-down lists that will automatically display the currently stored values for month, day and year. When the form is loaded, you have the opportunity to leave the current values or change it to one of the other values. This is way cool once you put it into action.
If you choose to use a text field to enter dates, you can 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()%>
Many thanks to Hisham Hhammash for his assistance with this tutorial.
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