Option group enable and disable certain form controls

G

Guest

I have an option group "Frame 40" with option 43=1,45=2, 47=3 and 49=4 that I
want to enable certain form controls. As an example when Option 43 is
selected it would enter the number "1" in the "opportunity" text box
disabeling the "Blocked" and "Own" text box then if a different option is
selcted it woudl clear the "1" in the "opportunity" box and enable other text
boxes of my choosing. Where do I put the code and what would it be?
Thanks!
 
S

SusanV

Hi Nick,

First off, I'd rename those controls (the frame and the options) so that
they make sense - otherwise you're going to have one heck of a time later on
should you need to go back in and modify the options. That said, what you
want is a SELECT CASE statement in the OnUpdate event of the Option group,
something like:

Select Case Me.Frame40
Case Is = 1
Me.Opportunity = 1
Me.Blocked.Enabled = False
Me.Own.Enabled = False

Case Is = 2
'Whatever you want to do for this option
Case Is = 3
'Whatever you want to do for this option
End Select
 
G

Guest

Thanks, I have renamed some of the controls. I do have another question. How
do I clear the controls for the next entry? After completing data entry is
complete I found that I have to close the form and reopen it before I can
add data with a different "case". It seams that one "case" enabled controls
carries over to the next form entry and also in reviewing previous entries.
 
S

SusanV

If the option frame's default value (data tab in properties) is set to
nothing (blank) a new record should have no radio button selected.
 
G

Guest

Yes, the default value is set to nothing but when entereing new records the
"enable" controls are set to what the radio button was in the previous record
but the radio button are all unmarked. Also, when reviewing previously
entered records the enabled controls do not reflect what the radio controls
selected was for that record. When the form is closed and reopened all
controls are available in all records unless a radio selection is changed.
 
S

SusanV

Oh ok, gotcha - I thought you meant the option group was retaining the
previous choice. Using the form's On Current event, set the controls'
enabled property to what you want for defaults - perhaps set all to false
until the user selects an option.
 
G

Guest

Thanks! on Current in the form did the trick.

SusanV said:
Oh ok, gotcha - I thought you meant the option group was retaining the
previous choice. Using the form's On Current event, set the controls'
enabled property to what you want for defaults - perhaps set all to false
until the user selects an option.
 

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