Another simple problem for the access masters

P Zero

Registered User.
Local time
Today, 23:59
Joined
Mar 15, 2006
Messages
41
I'm nearly finished my database now, but I just have a couple of loose ends to tie up. I have one last problem (hopefully) that I hope you guys can help me with.

On my form, I have a combo box. Underneath the combo box I have 2 check boxes. Under normal conditions, the checkboxes will be enabled and the user will be able to tick or untick the boxes. But if a certain selection is made from the combo box, the check boxes should be disabled and unticked.

Is this possible? Any help greatly appreciated :)
 
Yes you will have to write some code in the After_Update event of the combo box.
 
Disable/Enable them in the AfterUpdate event of the ComboBox.
 
KeithG said:
Yes you will have to write some code in the After_Update event of the combo box.
I know that but I have no idea where to start with the code :confused:
 
RuralGuy said:
Disable/Enable them in the AfterUpdate event of the ComboBox.
But how can I get them to also change back to unticked?
 
Something like this in the AfterUpdate Event

if me.NameOfComboBox.value="Value"
me.CheckBoxName.visible=false
else
me.CheckBoxName.visible=true
end if
 
They are 'ticked' when their value is True/Yes but you have a bigger problem; remembering when you disabled them if they were they ticked or unticked?
 
I dont need to remember their values to reinstate later on. I just need to disable them and change their values to false when a certain value is selected from the combo box.
 
And if the user goes back and selects one of the other values from the ComboBox?
 
Then the check boxes are enabled, but will be fine set to false. The user can then tick them again if needed.
 
Then rather than using the Visible property as KeithG suggested, your code will be something like:
Code:
If Me.ComboBoxName = "YourSpecialValue"
   Me.CheckBoxName = 0
   Me.CheckBoxName.Enabled = False
Else
   Me.CheckBoxName.Enabled = True
End If
Using your ComboBox and CheckBox names of course.
 
Thanks.

My code now looks like this;

Code:
Private Sub M_VentType_AfterUpdate()

If Me.M_VentType = "Natural"
   Me.M_VentSupply = 0
   Me.M_VentSupply.Enabled = False
Else
   Me.M_VentSupply.Enabled = True

End Sub

but it is highlighting the 'If' line and saying it expects a Then or GoTo.
 
Oops. Air Code!!
Code:
Private Sub M_VentType_AfterUpdate()

If Me.M_VentType = "Natural" [B][COLOR="Red"]Then[/COLOR][/B]
   Me.M_VentSupply = 0
   Me.M_VentSupply.Enabled = False
Else
   Me.M_VentSupply.Enabled = True
[B][COLOR="Red"]End If[/COLOR][/B]

End Sub
 
I cant get it to work. Could there be something else in my code for that form preventing it from working?

I'm off home just now anyway. Its just pi**ing me off.

Thanks for all your help though.
 

Users who are viewing this thread

Back
Top Bottom