Click to See Complete Forum and Search --> : Setting focus back on a field


fhaldimann
September 24th, 1999, 08:51 AM
In my UserForm the date input is made of 3 fields (TextBox): one for the day (MaxLength-Property=2), one for the month (MaxLength=2) and one for the year (MaxLength=4). When entering the fourth digit in the year field an Exit-Event is started which composes the date with the entered day's and month's digits. A date validation is then executed (in then Exit-Event/Function) and i would like the focus to be set back in then day-field if the composed date is not valid (with the setfocus-Method use in the year-field Exit-Event). But I can't!
The focus doesn't stay in the day-field, it leaves it and jumps forward two field afer the year-field.

Lothar Haensler
September 24th, 1999, 08:58 AM
if you use vb6 I suggest that you use the Validate Event. It's (almost) perfect for validating input and forcing the focus within a field.