changing the toggle button color in option group

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

this is probably simple (but not yet for this newbie)...

there are 7 toggle buttons (numbered toggle8, 9, 10, 24, 11, 14 and 12) in
my option group on this form i'm using. their values are (respectively)
1,2,3,4,5,6, and 7.

when the user presses one, i'd like it's foreground (i.e. text) label's
color to be red (255). moreover when the user scrolls or otherwise moves from
one record to the next, i'd like the application to handle the color changes
(leaving unclicked buttons having black text and clicked ones having red =
255).

anyone?
 
Sounds like conditional formatting.

Set the conditional formatting for each of your toggle buttons.

Rick B
 
you might just be on to something with the CF idea....after i wrote this, i
thought maybe some conditional vba in the 'On Current' Event property of the
form's but CF is easier assuming that it can be set. the toggle's are all
feeding a value (1,2,..,7) into an "Outcome" variable. i guess we'll take the
empirical approach and hope it does.

thx,

ted
 
interesting....

no CF available on the toggle's (it's greyed out, or as my friends north of
the border would say it's stippled out).

tried some vba on it as well w/ no luck either.

ted
 
One way to do this is using VBA. Create a Sub called
ToggleColor...

Sub ToggleColor()
Select Case (Name of Option Group) ;for example Frame7
Case 1
Toggle8.ForeColor=vbRed
Toggle9.ForeColor=vbBlack
Toggle10.ForeColor=vbBlack
Toggle24.ForeColor=vbBlack
Toggle11.ForeColor=vbBlack
Toggle14.ForeColor=vbBlack
Toggle12.ForeColor=vbBlack
Case 2
(Copy Case 1 to Case 2 through Case 7 making sure that
the desired Toggle in each Case is set to vbRed i.e.
Toggle9 in Case 2 should be vbRed and the rest of the
Toggles vbBlack, Toggle 10 in Case 3 should be vbRed and
the rest vbBlack and so on...)

Case Else
(all Toggles here should be vbBlack)


Now create two additional subs:

One for the Option Group BeforeUpdate event and one for
the Form Current event. In each of the sub you will call
ToggleColor.

For example if your option group was named Frame7

Sub Frame7_BeforeUpdate(Cancel as Integer)
ToggleColor
End Sub

Sub Form_Current()
ToggleColor
End Sub


Hope this helps!
 
this seems promising looking; will definitely have to code it when i gets to
the office this morning.

much obliged for the bandwidth :-)

ted
 
hi,

well, it worked like a charm in one of the two versions of the same form i
have in my a2k mdb. it being in the 'edit only' version. really cool. i have
a 'review only' version of this form into which i copied the togglecolor sub
and into which i added the reference to it in the 'on current' event property
ofl the form's. noting happens however?? shouldn't it?

a correlated issue i've been wrestling with is the question of moving the
cursor automatically from the toggle button to an adjacent datetime field of
which there are seven (one per toggle btn).

best,

ted
 
hold the presses!!

the answer to my 'review only' dilemma appeared in the form of the fact that
the frame's name on it was different. changing it solved the problem.

but the question of moving the cursor persists...

best

ted
 
Back
Top