Enter current time and move to next field with Enter key

C

crtopher

I have a series of fields that record a series of times. On my form I'd like
each field in succession to have the current time entered into it and then
move to the next field all with a simple press of the enter button.

Currently i have a button on the form labelled "now" that enters the current
time in whatever field i have the cursor in using the following code:

Application.Screen.PreviousControl.SetFocus
Me.ActiveControl = Time()

This works well. I have even set its default to "yes" so that when i hit
'enter' the current time is recorded. The problem is that even though i have
the enter key behaviour set to go to the next field via the menu option, it
wont do it when the buttons default is set to yes.

Do i need another line in my code to force the next control to get the focus?

I have read all the forums about changing enter key behaviour as well as
ansi code for the key press event but cant seem to do what i need to do.

Thanks in advance
 
J

jokobe

crtopher said:
I have a series of fields that record a series of times. On my form I'd like
each field in succession to have the current time entered into it and then
move to the next field all with a simple press of the enter button.

Currently i have a button on the form labelled "now" that enters the current
time in whatever field i have the cursor in using the following code:

Application.Screen.PreviousControl.SetFocus
Me.ActiveControl = Time()

This works well. I have even set its default to "yes" so that when i hit
'enter' the current time is recorded. The problem is that even though i have
the enter key behaviour set to go to the next field via the menu option, it
wont do it when the buttons default is set to yes.

Do i need another line in my code to force the next control to get the focus?

I have read all the forums about changing enter key behaviour as well as
ansi code for the key press event but cant seem to do what i need to do.

Thanks in advance
this might work: fieldname.setfocus with fieldname being the name of the
next field.

jokobe
 
C

crtopher

Thanks jokobe. That would work if I had only one specific control to jump
to. But I need jump to a number of different controls in succession. Is there
code for "nextcontrol.setfocus" or something?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top