Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Force a 4 Digit Year
Message
 
To
28/04/1999 19:21:24
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00213242
Message ID:
00213252
Views:
27
>How do I force a user to enter a 4 digit year. I have looked at SET CENTURY TO n ROLLOVER n command and have created a table with a date field. But the user can still enter a 2 digit year and then the SET CENT command comes into effect.
>
>I want to FORCE the user to enter 4 digits as the year!
>
>This has to be in code as OCX's are not stable enough in VFP for me.
>
>Thanks
>Bernard

Use the .Keypress event to count keystrokes and make sure user has entered 8.
This also means that you'd have to blank out the date when a user first makes a change. Sure, you can leave a previous value there, but once they start typing in a date field, blank out and start counting. This will force the user to input the entire date. Sounds tough on the user but if those who are paying the bills are demanding full dates, they'll probably like it.

Steve
Previous
Reply
Map
View

Click here to load this message in the networking platform