Form KeyPress

Moonshine

Registered User.
Local time
Today, 16:45
Joined
Jan 29, 2003
Messages
125
Hi All

I have created a little bit of code, saying depending what field you are in, when you hit a key, it moves you onto the next field in the form. This works great..

However, there are 140 fields on this form, and i dont really want 140 pieces of code, so we thought we would use the Form_KeyPress but it doesnt seem to capture it.

Does anyone know where you have to be, on a form to get the Form_KeyPress event to trigger?
 
TAB will move you to the next field.
 
Yup, and the tab order is set to go down... However, they also want to be able to move across when they have finished going down.

Confusing i know, but i have yet to meet a User that isnt!
 
the form keypress event does not occur unless the form has the focus when a key is pressed (sounds redundant, I know). If you currently have the cursor in a text box, the text box has the focus and a keypress event will be registerd by the text box, not the form.

Right click on the upper left corner of the form in design mode, go to Tab order and adjust there.
 
Thanks for that, does seem a bit odd it needs to have the focus.

Anyway, as i said previously i know all about tab order, but that is already used. There are 7 days, Monday to Sunday. 20 fields per day, listed down. A time from and a time to is entered in a row. Once you have entered this for Monday, they want to then press a key and it takes you upto Tuesday.

Why they cant press the mouse button is beyond me. Ive done it, but i have had to do a seperate piece of code for each box. As tab order is used for moving down the day, and not across the week.
 
Moonshine said:
Anyway, as i said previously i know all about tab order, but that is already used. There are 7 days, Monday to Sunday. 20 fields per day, listed down. A time from and a time to is entered in a row. Once you have entered this for Monday, they want to then press a key and it takes you upto Tuesday.
Listen for the keypress event in the last field and bind the move to the return key instead. Logic being, tab through individual fields for Monday, press return to go to Tuesday
 
Again, logically that is sound however all the fields for a given day are not always filled in. A client might have care 7 til 8, 12 til 2 and thats it.

Where as others might have 7 til 8, 9 til 10, 12 til 13, 14 til 15 and so forth...
 
use sendkeys in a macro; create one for each day?
 
Moonshine said:
Again, logically that is sound however all the fields for a given day are not always filled in. A client might have care 7 til 8, 12 til 2 and thats it.
add the return listener at the end of each line as opposed to each box.
 
wazz said:
use sendkeys in a macro; create one for each day?

Forgot about SendKeys, will have a try with that :)

Bod: Not sure what the return listener is?
 

Users who are viewing this thread

Back
Top Bottom