ComboBox that changes Forms Color--but I have a problem-- they do not stay that color

M

Mike

Below is the code I have that changed the Detail part of my form. It
works, but it does not stay that color when I navagate through the
records. So, if I chose the ComboCurrentStatus to Open, it does turn
the form (HOTLINE_FORM) Red, but if I navigate to the next record, it
is also Red, even if I changed it seconds before to Closed = Green.

Can anyone help me keep the Colors the same?

---------------------------------------------------------------------------------------------
Private Sub ComboCurrentStatus_AfterUpdate()
Select Case Me!ComboCurrentStatus
Case "Open"
Me.Detail.BackColor = vbRed
Case "Action Track"
Me.Detail.BackColor = vbYellow
Case "Closed"
Me.Detail.BackColor = vbGreen
Case Else
MsgBox "Oops, don't know the status!"
End Select
End Sub
 
J

Jeff L

Your code will only work when you change the Status, not navigating
between records. Use On Current for that.

Hope that helps!
 
M

Mike

Thanks Jeff,
When you say On Current, where is that and what do I need to do
(Realitively new to Access)? I just noticed that when I re-open my Form
it does not save to the color it was before. Any ideas how to fix this?

What I want is the color of the details section of my form
(HOTLINE_INFO) to represent RED for Open, YELLOW for Action Track, and
GREEN for Closed.

Open, Action Track and Closed are the 3 choices from the Combo Box
named ComboCurrentStatus (Control Source=CurrentStatus) in the header
of my form.
 
J

Jeff L

On Current is an event for your form. You can find it under the form
properties. It runs every time you navigate to a different record or
when you open your form.
 
M

Mike

Thanks Jeff, works perfectly!
Jeff said:
On Current is an event for your form. You can find it under the form
properties. It runs every time you navigate to a different record or
when you open your form.
 

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