Option Button does not Toggle

M

Michelle

I have an option button where I want the default value to be "Active". In
the Option Group Frame I have the default value set as "1". When a user
clicks on the "Active" button I want the backcolor of my form to remain the
same, when a user clicks on the "Inactive" button I want the backcolor of the
form to turn red. I have put a macro in the "After Update" procedure and the
code works but it doesn't "deselect" the button when I click on the other
button. I have to click Active, then click it again to take the focus off
before I click Inactive. If I don't do this, both boxes remain checked (the
color does change how I want it). Is there a way to make the buttons
"toggle" or "lose focus". Thanks.

My macro looks like this...
 
K

Klatuu

my guess is you are using the wrong After Update. You use the After Update
event of the Option Group, not the button. And if you are using a macro, you
will have to tell it what option was chosen so it knows how to handle the
colors, etc.
 
M

Michelle

But how do I clear out the "Active" checkbox when I select the "Inactive"
checkbox. Is there code for that?

Usually when I create an option button I can select one or the other. But I
have a single form and when I use that it changes all the records to a blue
background. Or all the records to a red background. I need each record to
be the color based on what the user selects (active - blue) (inactive - red).

Hope this makes sense.
 
K

Klatuu

Sound like you are using a datasheet view. That is the way datasheet view
works. If you change it to a continuous form and use conditional formatting,
it should slove your problem. You wont have to do anything to change the
colors in the after update event.
 
M

Michelle

If I switch to continuous form, will that make all my records the same color?
I would like to keep each record it's own color based on being "active" or
"inactive". Thanks.
 
K

Klatuu

Yes
--
Dave Hargis, Microsoft Access MVP


Michelle said:
If I switch to continuous form, will that make all my records the same color?
I would like to keep each record it's own color based on being "active" or
"inactive". Thanks.
 
J

John W. Vinson

If I switch to continuous form, will that make all my records the same color?
I would like to keep each record it's own color based on being "active" or
"inactive". Thanks.

You can use Format... Conditional Formatting on the menu to color code
textboxes on the continuous form.

John W. Vinson [MVP]
 
M

Michelle

Thanks John. I'm trying to make the detail backcolor of the form a different
color based on the click event of an option group. Is this possible?
 
J

John W. Vinson

Thanks John. I'm trying to make the detail backcolor of the form a different
color based on the click event of an option group. Is this possible?

Well, a continuous form has only one background (for the whole form), not a
different background for each line. Perhaps you could use a transparent
unbound textbox overlaying the entire detail section and toggle its color.

John W. Vinson [MVP]
 

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