Does anyone know of a function or method that I could use to undo or de-select the user's selection if a certain condition is true using an option group control? I tried using the lock method but it only allows me to Lock the whole control and I don't want to do that. I only want to lock out one option.
Thanks in advance.
You can refer to the individual components of an Option Group.
If I had three options:
Male, Female, and (if Vassago is reading) Hermaphrodite.
I call my Option Group, fraGender.
I've opted for three options to be toggle buttons within it: I name these tglMale, tglFemale, and tglHermaphrodite respectively.
Then, during the course of my database, I have to enter the gender of someone and there is a restriction that people outwith Chernobyl can't be a hermaphrodite, I decide to disable/disallow that option.
Decide what you'd rather have.
If you want to disable it then with a bit of code:
Code:
If Me.cboLocation = "Chernobyl" Then
Me.tglHermaphrodite.Enabled = False
End If
If you want to disallow it then, using code on the option group's BeforeUpdate event you can evaluate the condition and set the Cancel argument to false.