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 / February 2006

Tip: Looking for answers? Try searching our database.

refering to a control by its tab index

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Miguel - 15 Feb 2006 11:21 GMT
hi,

quick question: how does one refer to a control by its tab index using VBA,
as oppose to using the control's name?

thanks in anticipation...
Douglas J Steele - 15 Feb 2006 12:30 GMT
AFAIK, you can't. For one thing, the Form Header, Form Detail and Form
Footer sections each have their own tab order. In other words, on a single
form, you can have 3 separate controls that have TabIndex = 0.

If you wanted to live with that restriction, you could loop through all of
the controls on the form, looking for the one that has that value for its
TabIndex. Note that not all controls support the TabIndex property.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> hi,
>
> quick question: how does one refer to a control by its tab index using VBA,
> as oppose to using the control's name?
>
> thanks in anticipation...
Marshall Barton - 15 Feb 2006 17:17 GMT
>quick question: how does one refer to a control by its tab index using VBA,
>as oppose to using the control's name?

In addition to Doug's comments, you really do need to know
the control's section.  Then  you can loop through the
section's Controls collection.  E.g. if the control is in
the detail section:

    On Error Resume Next
    For Each ctl in Me.Setions(acDetail).Controls
        ndx = ctl.TabIndex
        If Err.Number = 0 Then
            If ndx = x Then
                'do something
            End If
        End If
    Next ctl

Signature

Marsh
MVP [MS Access]

 
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.