flash textbox based on time

P

plgii

I have a textbox called delTime
it is set to say 11:00am and I want to make its textbox flash two hours
before to remind user that action is needed. I know how to make it flash
based on date, but how do I do it based on the time in the control?
 
B

Barry Gilbert

If you have it working for dates, the only difference is to get your code to
see only the time portion of the control's value. Try using the TimeValue()
function.

Barry
 
P

plgii

the code I have to flash based on date does not work.

Private Sub Form_AfterUpdate()
Dim MyHour, MyTime
MyHour = Hour(MyTime)
If Me.Text0 > MyHour Then
'If Me.Text0 > Date - 30 Then
Me.Text0.BackColor = 255
r = 1
Else
Me.Text0.Visible = True
Me.Text0.ForeColor = 0
r = 0
End If
End Sub

Private Sub Form_Timer()
If r = 1 Then
Me.Text0.Visible = Not Me.Text0.Visible
End If
End Sub
..can you give me something to try?
 
B

Barry Gilbert

plgii said:
the code I have to flash based on date does not work.

Private Sub Form_AfterUpdate()
Dim MyHour, MyTime
MyHour = Hour(MyTime)
If Me.Text0 > MyHour Then
'If Me.Text0 > Date - 30 Then
Me.Text0.BackColor = 255
r = 1
Else
Me.Text0.Visible = True
Me.Text0.ForeColor = 0
r = 0
End If
End Sub

I don't see where your variables are getting their values. I think you want
something like this:

Private Sub Form_Timer()
If Me.Text0.BackColor = 16777215 Then
Me.Text0.BackColor = 255
Else
Me.Text0.BackColor = 16777215
End If
End Sub

Private Sub Text0_AfterUpdate()
If Hour(CDate(Me.Text0)) >= Hour(Now()) - 2 Then
Me.TimerInterval = 1000
Else
Me.TimerInterval = 0
Me.Text0.BackColor = 16777215
End If
End Sub

Barry
 

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