Radio Option and IF Statement

  • Thread starter time_racer via AccessMonster.com
  • Start date
T

time_racer via AccessMonster.com

I have a form with multi radio options, combo boxes (disabled by default) and
a button, the user has to select one of those radio options which would
enable only one Combo Box and then their values ( the radio option and combo
box ) would be saved in the table

My question is how to use the if statement with with the radio option, I used
the below command but it returned this error " you enterned an expression
that has no value"

VB Code:

if isnull (me.option1 and me.option2 and me.option3) then

msgbox "please choose an option", vbOKonly

else

me.combo1.enable = true

endif
 
A

Arvin Meyer [MVP]

Use a Case statement on the Option Group itself (air code):

Select Case Me.OptionGrp_AfterUpdate()
Case 1
Me.combo1.enabled = True
Me.combo2.enabled = False
Me.combo3.enabled = False
Case 2
Me.combo1.enabled = False
Me.combo2.enabled = True
Me.combo3.enabled = False
Case 3
Me.combo1.enabled = False
Me.combo2.enabled = False
Me.combo3.enabled = True
End Select
 
T

time_racer via AccessMonster.com

Arvin said:
Use a Case statement on the Option Group itself (air code):

Select Case Me.OptionGrp_AfterUpdate()
Case 1
Me.combo1.enabled = True
Me.combo2.enabled = False
Me.combo3.enabled = False
Case 2
Me.combo1.enabled = False
Me.combo2.enabled = True
Me.combo3.enabled = False
Case 3
Me.combo1.enabled = False
Me.combo2.enabled = False
Me.combo3.enabled = True
End Select
I have a form with multi radio options, combo boxes (disabled by default)
and
[quoted text clipped - 19 lines]


Hi Arvin

Thanks for the reply but your solution would work, but how to make the
options as a group or how to define them as a group?!!
 
A

Arvin Meyer [MVP]

Create a new group using the tool box wizard, and all you'll need to do the
put the labels on each value. You may also add an option group without the
wizard, and select and cut all the radio buttons, then select the option
group and paste. It should put you radio button controls within the new
group.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


time_racer via AccessMonster.com said:
Arvin said:
Use a Case statement on the Option Group itself (air code):

Select Case Me.OptionGrp_AfterUpdate()
Case 1
Me.combo1.enabled = True
Me.combo2.enabled = False
Me.combo3.enabled = False
Case 2
Me.combo1.enabled = False
Me.combo2.enabled = True
Me.combo3.enabled = False
Case 3
Me.combo1.enabled = False
Me.combo2.enabled = False
Me.combo3.enabled = True
End Select
I have a form with multi radio options, combo boxes (disabled by default)
and
[quoted text clipped - 19 lines]


Hi Arvin

Thanks for the reply but your solution would work, but how to make the
options as a group or how to define them as a group?!!
 
Top