
Signature
Oliver
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
http://www.oli-s.de
Hi Oliver
Thanks for a tip, but it's not what I need. I need to enter data in all most
of the fields, and after entering verticaly in one field I'd like to be able
to do the same in the next field. Method you sugested works only in one field.
Thanks
Barb
> Hi,
> just set the Tab Stop property of the other controls in this subform to NO.
[quoted text clipped - 10 lines]
> > then move to next field.
> > Is it possible?
Kevin K. Sullivan - 06 Jan 2006 21:52 GMT
The Enter key can be set to jump to the same field in the next record.
Check the options under
Tools->Options->Keyboard->Move After Enter
Change it to Next Record.
Potentially, you could change this setting in code:
'aircode
Dim intOldOption as integer
'in Subform gotfocus
intOldOption = GetOption("Move After Enter")
SetOption "Move After Enter", 2
'in Subform LostFocus
setOption "Move After Enter", intOldOption
------
but be warned, some users really don't like their settings to be changed
HTH,
Kevin
> Hi Oliver
> Thanks for a tip, but it's not what I need. I need to enter data in all most
[quoted text clipped - 18 lines]
>>>then move to next field.
>>>Is it possible?
Klatuu - 06 Jan 2006 22:35 GMT
If you are willing to allow the user to use the up arrow and down arrow keys
to move between records and remain in the same control then here is a routine
that will work:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim lngRecords As Long
Dim lngPosition As Long
lngRecords = Me.Recordset.RecordCount - 1
lngPosition = Me.Recordset.AbsolutePosition
If KeyCode = vbKeyUp Then
If lngPosition <> 0 Then
Me.Recordset.MovePrevious
Else
KeyCode = 0
End If
ElseIf KeyCode = vbKeyDown Then
If lngPosition = lngRecords Then
KeyCode = 0
Else
Me.Recordset.MoveNext
End If
End If
End Sub
It requires that the form's KeyPreview property be set to Yes so the form
will see the keystroke before the control. The reason for the KeyCode = 0 is
that if you are on the first record and press the up arrow, it will move to
the previous control on the same record. Setting the KeyCode to 0 makes the
control think no key had been pressed, so it just stays on the first record
in the same control. The same is true of the last record with the down arrow
key.
> Hi Oliver
> Thanks for a tip, but it's not what I need. I need to enter data in all most
[quoted text clipped - 18 lines]
> > > then move to next field.
> > > Is it possible?
Barb - 06 Jan 2006 23:56 GMT
Thank you very much for all your help. I'll try it first thing tomorrow
morning, but it looks promissing. Hopefully I will not mess up the code.
Barb
> If you are willing to allow the user to use the up arrow and down arrow keys
> to move between records and remain in the same control then here is a routine
[quoted text clipped - 52 lines]
> > > > then move to next field.
> > > > Is it possible?