A
Ayo
The following snippet of code is suppose to loop through all the
CommandButton controls on a Multipage control on a form and change the
Enabled property of those CommandButton to True if there is a Value in the
ComboBox "cmbDrive". Otherwise the CommadButton controls should be Disabled.
My problem is that I keep getting an "Object required" error message. I
don't know what I did wrong. If there is anyone out there that knows what is
wrong or how I can code this better, please HELP !!!
Private Sub cmbDrive_AfterUpdate()
If cmdDrive.Text <> "" Then
For Each ctl In frmOpenFiles.Controls
If TypeName(ctl) = "CommandButton" And ctl.Enabled = False Then
ctl.Enabled = True
End If
Next ctl
ElseIf cmdDrive.Value = "" Then
For Each ctl In frmOpenFiles.Controls
If TypeName(ctl) = "CommandButton" And ctl.Caption <> "Cancel"
Then
ctl.Enabled = False
End If
Next ctl
End If
End Sub
CommandButton controls on a Multipage control on a form and change the
Enabled property of those CommandButton to True if there is a Value in the
ComboBox "cmbDrive". Otherwise the CommadButton controls should be Disabled.
My problem is that I keep getting an "Object required" error message. I
don't know what I did wrong. If there is anyone out there that knows what is
wrong or how I can code this better, please HELP !!!
Private Sub cmbDrive_AfterUpdate()
If cmdDrive.Text <> "" Then
For Each ctl In frmOpenFiles.Controls
If TypeName(ctl) = "CommandButton" And ctl.Enabled = False Then
ctl.Enabled = True
End If
Next ctl
ElseIf cmdDrive.Value = "" Then
For Each ctl In frmOpenFiles.Controls
If TypeName(ctl) = "CommandButton" And ctl.Caption <> "Cancel"
Then
ctl.Enabled = False
End If
Next ctl
End If
End Sub