0

Hi

I have used this code in an Access form to get a field to blink:

Private Sub Form_Timer()

With Me.[Credit Remaining]
.ForeColor = (IIf(.ForeColor = vbRed, vbGreen, vbRed))
End With

End Sub

Can anyone tell me how to get this to work only on an entry that is less than a certain value?

Thanks

Tobysan

2
Contributors
1
Reply
2
Views
11 Years
Discussion Span
Last Post by Grindboy
0

Hi

I have used this code in an Access form to get a field to blink:

Private Sub Form_Timer()

With Me.[Credit Remaining]
.ForeColor = (IIf(.ForeColor = vbRed, vbGreen, vbRed))
End With

End Sub

Can anyone tell me how to get this to work only on an entry that is less than a certain value?

Thanks

Tobysan

If you have other procedures reliant on the timer then you will have to encapsulate the timer code in an if then statement and create a flag variable (boolean wil do) as a module level variable. You set this flag when you enter a record (on the Current event) which the timer will pick up and react accordingly. See code below.

Private CredCheck as Boolean

Private Sub Form_Timer()

If CredCheck then
With Me.[Credit Remaining]
.ForeColor = (IIf(.ForeColor = vbRed, vbGreen, vbRed))
End With
End if

End Sub

Private Sub Form_Current

if Me.[Credit Remaining] < 10 then '<--- edit flashing criteria here
CredCheck = true
else
CredCheck = false
me.[Credit Remaining].ForeColor = vbGreen
end if


End Sub

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.