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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.