Option Groups Is the value in the button or the grouping structure

  • Thread starter Thread starter TravelingHT
  • Start date Start date
T

TravelingHT

I am trying to learn a very simple thing, turn ForeColor to Red, Green, Blue.

I can do this with a simple Command button.

Private Sub cmdRedNine_Click()

Me.txtInfo.ForeColor = vbRed
End Sub
(The above code is working on the same form that the following problem is
not working.)
But give me an option button, created with the wizard and I do not have a
hope.

I think I am not explaining to the computer exactly where the info is stored.
There is no underlying table as I am just learning.
Do I need to create a Module Level Variable "Dim" to hold the value and if
so what is the value I want to hold.

I have tried to reference the frame value as it has a defalt value, so my
thinking is, it must have a value. But this did not work.

I have tried to reference the frame, using If statement and the Toggle
buttons directly but to no avail.

This is where I currently am:

Private Sub Frame3_Click()

If Frame3.Value = 1 Then
Me.txtInfo.ForeColor = vbBlue

ElseIf Frame3.Value = 2 Then
Me.txtInfo.ForeColor = vbGreen

Else: Frame3.Value = 3
Me.txtInfo.ForeColor = vbRed

End If
End Sub

Thanks in advance
 
Ok I just used the code I put in which was a little different to what I was
using before and it actually worked. Three days after I started on it.

Thanks again anyway.
 
if you're still there:
Nested "If"s are not a good idea.
Try

Select Case Frame3.Value
case =1
Me.txtInfo.ForeColor = vbBlue
Case =2
Me.txtInfo.ForeColor = vbGreen
Case=3
Me.txtInfo.ForeColor = vbRed
end select
 
Back
Top