I'm trying to loop through my form and enable all textboxes. I have this code:
Private Sub subIntitializeTextBoxes()
'declare a control object variable
Dim ctl As Control
'Loop thru the Controls collection
For Each ctl In Me.Controls
If Me.ControlType = acTextBox Then
MsgBox ("Text Box")
End If
Next ctl
End Sub
My first problems is on the line:
If Me.ControlType = acTextBox Then
on execute I get the error Method or data member not found. The examples I've seen use this method. I'm missing something.
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015
TIP: In your code the Me refers to the form object.
Try:
'Loop thru the Controls collectionFor Each ctl In Me.Controls If ctl.ControlType = acTextBox Then degug.print "Text Box: " & ctl.Name ' prints to the immediate window ctl.Enabled = True End IfNext ctlEnd Sub
Try:
Open in new window