- Local time
- Today, 01:49
- Joined
- Jul 9, 2003
- Messages
- 16,331
I don't like that you are using identical names for your objects as controls on the form. At best it's not good practice and at worst I think it could cause unforeseen issues. In any event it is advisable not to do it this way.
This is how I think your code should look:-
Note I have renamed the combobox objects to indicate that they are in fact objects...
This is how I think your code should look:-
Code:
Private Sub cboPre_AfterUpdate()
Dim oCboPre As ComboBox
Dim oCboApple As ComboBox
Dim oCboOrange As ComboBox
Dim oCboGrapes As ComboBox
Set oCboPre = Me!cboPre
Set oCboApple = Me!cboApple
Set oCboOrange = Me!cboOrange
Set oCboGrapes = Me!cboGrapes
If oCboPre.Value = "None" Then
oCboApple.Enabled = False
oCboOrange.Enabled = False
oCboGrapes.Enabled = False
Else
oCboApple.Enabled = True
oCboOrange.Enabled = True
oCboGrapes.Enabled = True
End If
End Sub
Note I have renamed the combobox objects to indicate that they are in fact objects...