>We have a situation where bonds are maturing in more than 100 years time. Hence we need to ensure that we can trap when a user enters a two digit century, and force the user to enter 4 digits. - Looks simple enough!
>
>Unfortunately it seems that VFP's SET CENTURY xx ROLLOVER nn functionality fires before the valid event of the text-box and therefore makes an assumption, which in this instance is invalid.
>
>
>Here's an example of the problem.
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> User has a bond which matures on 01/01/2109
>
> So he enters 01/01/19
>
> IF SET CENTURY xx ROLLOVER 50 is set on then VFP assumes
>
> 01/01/2019 - Incorrect!!!
>
> IF SET CENTURY xx ROLLOVER 50 is set off – (I.e. Rollover 0?) then VFP assumes
>
> 01/01/1919 - Incorrect!!!
>
> Unfortunatley with users being who/what they are, it is likely
> that the user will make an assumption that the system has
> interpreted his entry correctly - no bothering to check.
>
>I've looked at the various text-box properties in VFP 5.0 and nothing (includes StrictDateEntry, DateFormat and Century) seems to give me the control I need. - I cannot believe that no-one else has encountered this problem?!?
>
>Does VFP 6.0 have better control over date entry?
>
>Anybody have any ideas?
>
>Many Regards,
>
>James.
James,
Cumbersome but this one works. Check textbox.text (unformatted as user entered) and change value as needed ie:
lnDesiredCentury = 21
lnYearDigits = len(alltrim(substr(this.text,7)))
if lnYearDigits < 4
this.value = ctod(stuff(this.text,7,0,;
substr(str(lnDesiredCentury*100,4),1,;
4-lnYearDigits)))
endif
Cetin