[AccessD] OT - Looping Through Controls on Visual Basic Form

Randall R Anthony RRANTHON at sentara.com
Wed Jun 8 07:02:45 CDT 2005


Paul,
This is what I'm currently using to do just what you described.  I'm
sure it can be manipulated to search on specific control names, although
I have not done it because I don't need the specificity.

For Each cCtrl In frmFormName.Controls
            If TypeOf cCtrl Is TextBox Then
                cCtrl.Locked = True
            End If
            If TypeOf cCtrl Is ComboBox Then
                cCtrl.Locked = True
            End If
            If TypeOf cCtrl Is DBGrid Then
                cCtrl.AllowAddNew = False
                cCtrl.AllowDelete = False
                cCtrl.AllowUpdate = False
            End If
        Next



More information about the AccessD mailing list