Problems with my Select Case

  • Thread starter Thread starter Barkley via AccessMonster.com
  • Start date Start date
B

Barkley via AccessMonster.com

I am trying to run a Select Case procedure but regardless of the outcome of
my combo box, the procedure keeps running the Case Else option... which is to
display a message box stating "try again"... here is my code...

Private Sub Combo0_AfterUpdate()
Select Case [Combo0]
Case [Combo0] = "Apples"
Option2.Enabled = True
Option4.Enabled = True
Option6.Enabled = True
Option11.Enabled = False
Option13.Enabled = False
Option15.Enabled = False
Option17.Enabled = False
Label9.Visible = True
Label10.Visible = False
Case [Combo0] = "Oranges"
Option2.Enabled = False
Option4.Enabled = False
Option6.Enabled = False
Option11.Enabled = True
Option13.Enabled = True
Option15.Enabled = True
Option17.Enabled = True
Label9.Visible = False
Label10.Visible = True
Case [Combo0] = "Papayas"
Option2.Enabled = False
Option4.Enabled = False
Option6.Enabled = False
Option11.Enabled = False
Option13.Enabled = False
Option15.Enabled = False
Option17.Enabled = False
Label9.Visible = False
Label10.Visible = False
Case Else
MsgBox ("Try Again")
End Select
End Sub


Any suggestions?
 
Assuming Combo0 is bound to a Text field (not a Number field), and the
RowSource and BoundColumn match correctly, the code would be like this:
Select Case Me.Combo0
Case "Apples"
Me.Option2.Enabled = True
...
Case "Oranges"
...
 
Thanks Allen... I got it to work... I didn't realize the Me. had to be
entered into the procedure... I was under the impression that, because this
is a class procedure, only the name of the control had to be entered...

Allen said:
Assuming Combo0 is bound to a Text field (not a Number field), and the
RowSource and BoundColumn match correctly, the code would be like this:
Select Case Me.Combo0
Case "Apples"
Me.Option2.Enabled = True
...
Case "Oranges"
...
I am trying to run a Select Case procedure but regardless of the outcome of
my combo box, the procedure keeps running the Case Else option... which is
[quoted text clipped - 37 lines]
End Select
End Sub
 
Actually, the Me is optional (but recommened as it helps identify what you
are talking about.)

The crucial change was just stating the value in the Case statement.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Barkley via AccessMonster.com said:
Thanks Allen... I got it to work... I didn't realize the Me. had to be
entered into the procedure... I was under the impression that, because
this
is a class procedure, only the name of the control had to be entered...

Allen said:
Assuming Combo0 is bound to a Text field (not a Number field), and the
RowSource and BoundColumn match correctly, the code would be like this:
Select Case Me.Combo0
Case "Apples"
Me.Option2.Enabled = True
...
Case "Oranges"
...
I am trying to run a Select Case procedure but regardless of the outcome
of
my combo box, the procedure keeps running the Case Else option... which
is
[quoted text clipped - 37 lines]
End Select
End Sub
 
Back
Top