Case

G

Guest

Hi!

In EventProcedure of the form, I have:

Private Sub Form_Timer()

If [txtValue] >= 0 Then

Select Case Me!txtFirstName.BackColor
Case vbGreen
Me!txtFirstName.BackColor = vbWhite
Case vbWhite
Me!txtFirstName.BackColor = vbGreen
Case vbGreen
Me!txtFirstName.BackColor = vbWhite
Case vbWhite
Me!txtFirstName.BackColor = vbGreen
End Select

Else

If [txtValue] < 0 Then

Select Case Me!txtFirstName.BackColor
Case vbRed
Me!txtFirstName.BackColor = vbWhite
Case vbWhite
Me!txtFirstName.BackColor = vbRed
Case vbRed
Me!txtFirstName.BackColor = vbWhite
Case vbWhite
Me!txtFirstName.BackColor = vbRed
End Select

End If

End If

This work fine only if change de value when laber is white. If the label is
colored, don't actualize.
Why not, please?

Thanks in advance.
an
 
D

Douglas J. Steele

Well, first of all you don't need the redundant entries in the 2 Case
statements. Remove one set of entries from each.

Try putting a breakpoint into the Timer event, and single-step through the
code to see what happens.
 
G

Guest

Thanks for your reply.
I changed to:

If [txtValor] >= 0 Then

Select Case Me!txtFirstName.BackColor
Case vbGreen
Me!txtFirstName.BackColor = vbWhite
Case vbWhite
Me!txtFirstName.BackColor = vbGreen
End Select

Else

If [txtValor] < 0 Then

Select Case Me!txtFirstName.BackColor
Case vbRed
Me!txtFirstName.BackColor = vbWhite
Case vbWhite
Me!txtFirstName.BackColor = vbRed
End Select
End If
End If

but the situation is remained...

Thank you.
an

Douglas J. Steele said:
Well, first of all you don't need the redundant entries in the 2 Case
statements. Remove one set of entries from each.

Try putting a breakpoint into the Timer event, and single-step through the
code to see what happens.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


an said:
Hi!

In EventProcedure of the form, I have:

Private Sub Form_Timer()

If [txtValue] >= 0 Then

Select Case Me!txtFirstName.BackColor
Case vbGreen
Me!txtFirstName.BackColor = vbWhite
Case vbWhite
Me!txtFirstName.BackColor = vbGreen
Case vbGreen
Me!txtFirstName.BackColor = vbWhite
Case vbWhite
Me!txtFirstName.BackColor = vbGreen
End Select

Else

If [txtValue] < 0 Then

Select Case Me!txtFirstName.BackColor
Case vbRed
Me!txtFirstName.BackColor = vbWhite
Case vbWhite
Me!txtFirstName.BackColor = vbRed
Case vbRed
Me!txtFirstName.BackColor = vbWhite
Case vbWhite
Me!txtFirstName.BackColor = vbRed
End Select

End If

End If

This work fine only if change de value when laber is white. If the label
is
colored, don't actualize.
Why not, please?

Thanks in advance.
an
 
D

Douglas J. Steele

And did you put a breakpoint into the Timer event, and single-step through
the code to see what happens, as I also suggested?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


an said:
Thanks for your reply.
I changed to:

If [txtValor] >= 0 Then

Select Case Me!txtFirstName.BackColor
Case vbGreen
Me!txtFirstName.BackColor = vbWhite
Case vbWhite
Me!txtFirstName.BackColor = vbGreen
End Select

Else

If [txtValor] < 0 Then

Select Case Me!txtFirstName.BackColor
Case vbRed
Me!txtFirstName.BackColor = vbWhite
Case vbWhite
Me!txtFirstName.BackColor = vbRed
End Select
End If
End If

but the situation is remained...

Thank you.
an

Douglas J. Steele said:
Well, first of all you don't need the redundant entries in the 2 Case
statements. Remove one set of entries from each.

Try putting a breakpoint into the Timer event, and single-step through
the
code to see what happens.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


an said:
Hi!

In EventProcedure of the form, I have:

Private Sub Form_Timer()

If [txtValue] >= 0 Then

Select Case Me!txtFirstName.BackColor
Case vbGreen
Me!txtFirstName.BackColor = vbWhite
Case vbWhite
Me!txtFirstName.BackColor = vbGreen
Case vbGreen
Me!txtFirstName.BackColor = vbWhite
Case vbWhite
Me!txtFirstName.BackColor = vbGreen
End Select

Else

If [txtValue] < 0 Then

Select Case Me!txtFirstName.BackColor
Case vbRed
Me!txtFirstName.BackColor = vbWhite
Case vbWhite
Me!txtFirstName.BackColor = vbRed
Case vbRed
Me!txtFirstName.BackColor = vbWhite
Case vbWhite
Me!txtFirstName.BackColor = vbRed
End Select

End If

End If

This work fine only if change de value when laber is white. If the
label
is
colored, don't actualize.
Why not, please?

Thanks in advance.
an
 

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