Trouble color coding drop down selection

  • Thread starter Thread starter Joe
  • Start date Start date
J

Joe

Hi Folks,

Sorry if this post seems like an episode from Poltergeist, but I need some
help. I am trying get a drop down to save one of five colors (red, green,
blue yellow and orange) when selected on a form, to a table in the database.
I need the color chosen to remain chosen for each record on the form and in
the table. My problem is that the colors do not stay chosen (saved). Each
time I save a choice from the drop down and scroll back or forward on the
form, the color choices change randomly. Below is the color code for the
After Update Event of the “Status†field (Combo56).

Private Sub Combo56_AfterUpdate()

Me.Combo56.BackColor = IIf(IsNull(Me.Combo56.Value) = True, 15066597,
Switch(Me.Combo56.Value = "Green", 65280, Me.Combo56.Value = "Yellow", 65535,
Me.Combo56.Value = "Red", 255, Me.Status.Value = "Blue", 16737843,
Me.Combo56.Value = "Orange", 5220351))

Can anyone help with a code that will accomplish my aim?

Thanks.

Joe
 
Joe,

Try using your code in the OnCurrent event of your form as well as the
AfterUpdate event of the combo control.

You might even want to create a user defined function that you can call to
accoomplish this and then you would only have one place that you would have
to change your code when changes are required.
 
Thanks, "Mr B"!! It worked.

Mr B said:
Joe,

Try using your code in the OnCurrent event of your form as well as the
AfterUpdate event of the combo control.

You might even want to create a user defined function that you can call to
accoomplish this and then you would only have one place that you would have
to change your code when changes are required.

--
HTH

Mr B
askdoctoraccess dot com
 
Back
Top