Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / January 2006

Tip: Looking for answers? Try searching our database.

stay in the same field after tab

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Barb - 06 Jan 2006 20:00 GMT
Hi Everyone
I have a main form and subform. Subform is continious and mainly for data
entry. Is there a way to move cursor verticaly in the subform (like with
"down" key) with tab. People find it much easier with data-entry. So we'd
start with first record in subform - move down on tab until the last record
then move to next field.
Is it possible?
freakazeud - 06 Jan 2006 20:07 GMT
Hi,
just set the Tab Stop property of the other controls in this subform to NO.
This only leave ONE control (the first one) to have the tab stop property set
to yes. If you now press tab it will jump to that control in each record.
HTH
Good luck
Signature

Oliver
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
http://www.oli-s.de

> Hi Everyone
> I have a main form and subform. Subform is continious and mainly for data
[quoted text clipped - 3 lines]
> then move to next field.
> Is it possible?
Barb - 06 Jan 2006 20:53 GMT
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?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.