>>>Ok,
>>>
>>>I got it to kind of work. The problem is I have to go into the textbox twice for it to work. When I hit enter the first time it doesn't do anything. When I go back and put the cursor in the textbox again and press enter again then it works. Why could this be?
>>>
>>Tyler,
>>
>>Why not simply check the value of LASTKEY() in the Valid event?
>
>LASTKEY() will return whatever the most recent keystroke was, which might not be the one that fired the Valid()! INKEY() takes the next available keystroke from the head of the keyboard queue, but LASTKEY() returns the tail of the queue...
Ed,
There are five ways out of a test box (at least for the purposes of this discussion: You reach the number of characters supplied in the input mask, press enter, tab, shift + tab, or click on another control. If CONFIRM is OFF, in the first case you'll get the last key press. If you don't reach the number of characters in the input mask, pressing Enter returns 13, tab, 9, shift + tab 15, and clicking on another control 7. However, if CONFIRM is set to ON, then LASTKEY() will always return 13 when Enter is pressed or another control is clicked on, and tab and shift + tab the same as before.
George
Ubi caritas et amor, deus ibi est