Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Order of Controls in Controls Collection

Avatar of Henry_Harris
Henry_HarrisFlag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft Access
4 Comments1 Solution246 ViewsLast Modified:
Is it possible to predict the order of controls when looping through the controls collection.
Order on the form would be preferred or else Tab Order will suffice.
My code is attached
Public Function CheckForEmptyControls()
CheckForEmptyControls = True
With CodeContextObject
    Dim ctl As Control
    Dim strMissingEntryMessage As String
    strMissingEntryMessage = ""
    For Each ctl In .Controls
        If ctl.Visible And _
            (Left(ctl.Name, 3) = "txt" Or Left(ctl.Name, 3) = "cbo") _
            And ctl.Name <> "txtRelease" And ctl.Name <> "ID" And IsNull(ctl) Then
                strMissingEntryMessage = strMissingEntryMessage & Chr(13) & Chr(10) & " " & ctl.Tag
        End If
    Next ctl
    If strMissingEntryMessage <> "" Then
        CheckForEmptyControls = False
        If MsgBox("The following needs to be completed:" & Chr(13) & Chr(10) & strMissingEntryMessage, _
            vbRetryCancel, strMsgBoxTitle & ": Completing Form " & .Name) = vbCancel Then
                .cmdSaveRecord.Enabled = False
        End If
    End If
End With
End Function