Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best way to reset a date or date/time to empty?
Message
From
03/09/1999 02:25:32
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00260884
Message ID:
00261019
Views:
21
>What's the best way to reset a date or date/time field in a record. For example, I put a date or date/time in a field in a record and then later I decide to blank it out. How should I do it to prevent Data Type Mismatch or some other error?
>
>Also, I also put the date or date/time field in a textbox on a form and want to give the user the option to blank out the date or date/time field in the textbox on the form. What's the best way to do that too?
>
>The Date and Date/Time values are coming from the system and getting plugged into the record and the form when the user clicks a checkbox.
>
>Thanks for the advice. I have my own so-so way of doing it, but there must be a nicer way to do it. I have lots of books, but they don't cover this topic very well.
>
>Steve Kramer
>Kramer & Kramer Design
>http://members.aol.com/gocartoons
>gocartoons@aol.com
>Home of more than 260 original, off-the-wall cartoons by yours truly.

The other guys have already given you the right answer. However, a "back-door" way to do it (at least for Dates) is to set the value to an invalid date e.g.

MyDate = {99/99/1999}

This does NOT throw an error - the value of MyDate becomes an empty date. You can use this "feature" to validate user input, etc.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform