Grey Out OptionButtons on Form Entry

G

Guest

I have a form with multiple OptionButtons to be utilized by the user.
Problem is, I want to control these so that the user has to click the first
option button to build file, 2nd button on completion to run query, 3rd
button to create report etc. The optionbuttons currently work fine, but if
the user clicks option button 2 first, the query fails, I've got the option
buttons set to default of value of false on screen open. I want to have the
2nd & 3rd button grey out or not selectable on screen open, on successfull
optionbutton 1 run, deselect/grey out button 1, allow only button 2
selectable leaving 3 greyed out/delselected, on successful run of option 2,
deselect 2, leave 3 selectable, and at the end, all buttons not selectable,
only option is exit. Only reset option buttons on open. Any suggestions on
code would be great as I'm not very VB literate. The option buttons on this
form are labeled: Option10, Option20, Option30, with command button marked
EXIT, which closes form, returns to main menu. Thanks in advance.
 
J

John Vinson

I have a form with multiple OptionButtons to be utilized by the user.
Problem is, I want to control these so that the user has to click the first
option button to build file, 2nd button on completion to run query, 3rd
button to create report etc. The optionbuttons currently work fine, but if
the user clicks option button 2 first, the query fails, I've got the option
buttons set to default of value of false on screen open. I want to have the
2nd & 3rd button grey out or not selectable on screen open, on successfull
optionbutton 1 run, deselect/grey out button 1, allow only button 2
selectable leaving 3 greyed out/delselected, on successful run of option 2,
deselect 2, leave 3 selectable, and at the end, all buttons not selectable,
only option is exit. Only reset option buttons on open. Any suggestions on
code would be great as I'm not very VB literate. The option buttons on this
form are labeled: Option10, Option20, Option30, with command button marked
EXIT, which closes form, returns to main menu. Thanks in advance.

Set the Enabled property of option buttons 2 and 3 to No in form
design view, and enable them in the AfterUpdate event of the previous
option group:

Private Sub optGroup1_AfterUpdate()
If Me.OptGroup1 = <some value indicating it's ok>
Me.OptGroup2.Enabled = True
End If
End Sub

similarly for the other option groups and buttons.

John W. Vinson[MVP]
 
G

Guest

John,

Thanks for the assistance, I used the following code after reviewing your
suggestion and it appears to do just the trick for me.

Private Sub Form_Open(Cancel As Integer)
Option10.Enabled = True
Option20.Enabled = False
Option30.Enabled = False
End Sub

Then, later in the process, as field status change, I will then set
Option20.Enabled = True
during the early steps of usage, then set
Option30.Enabled = True
as the process enters its last phase of a tabbed form.
Thanks, it has gotten me to the finish point of my project.
Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top