Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flashing past due date in form

Status
Not open for further replies.

Dausa67

Technical User
Oct 1, 2008
96
US
Good morning,
This is what I am trying to do but it is not working.
**If Required Date is less than todays date then flash.

I have not used VBA but a few times so I am having trouble figuring out what I am doing wrong.
The background is not flashing.

Below is my code:
Code:
Private Sub Form_Timer()
   
   If [RequiredDate] < Date Then
      If [RequiredDate].ForeColor = vbRed Then
         [RequiredDate].ForeColor = vbBlack
      Else
         [RequiredDate].ForeColor = vbRed
      End If
   End If
   
End Sub

Can anyone tell me what I am doing wrong?

Thanks

Clay
 
What is the value of the TimerInterval property of the form ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you for the quick response.
TimerInterval is 1000

Clay
 
How are ya Dausa67 . . .

If your using [blue][RequiredDate][/blue] to describe a control (should be Me.RequiredDate or Me!RequiredDate), it would be interesting to see the line of code used to set the TimerInterval ...

See Ya . . .

Be sure to see FAQ219-2884 Worthy Reading! [thumbsup2]
Also FAQ181-2886 Worthy Reading! [thumbsup2]
 
What about using Me.Repaint just after changing the color ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
You've only addressed the situation where RequiredDate < Date; you're missing the Else Clause for the situation where RequiredDate is not < Date.

Code:
[b]Private Sub Form_Timer()
   
   If Me.RequiredDate < Date Then [COLOR=#EF2929]'Case where RequiredDate [u]is < Date[/u][/color]
      If Me.RequiredDate.ForeColor = vbRed Then
         Me.RequiredDate.ForeColor = vbBlack
      Else
         Me.RequiredDate.ForeColor = vbRed
      End If
   Else [COLOR=#EF2929]'Case where RequiredDate is [u]not < Date[/u][/color]
      Me.RequiredDate.ForeColor = vbBlack
   End If
   
End Sub[/b]
This will only work, of course, if the Form is in Single View; otherwise it will flash or not flash according to the RequiredDate value in the Current Record.

Also, I used .ForeColor, as you have, but in the original post you said:

"The background is not flashing.

If you want the background to flash, you need to use .BackColor, not ForeColor.

The Missinglinq

Richmond, Virginia

The Devil's in the Details!
 
Thank you for all of the responses. I am using data sheet view. Can it be done in data sheet view?

Clay
 
Dausa67,
I believe your question regarding datasheet view was already answered:
Missinglinq said:
This will only work, of course, if the Form is in Single View; otherwise it will flash or not flash according to the RequiredDate value in the Current Record.

Duane
Hook'D on Access
MS Access MVP
 
To do formatting in Datasheet View (as well as Continuous View) Forms, you have to use Conditional Formatting off of the Menu or Ribbon (depending on your Access version) and the best you could do, there, is to set either the BackColor or the FontColor to something to make it stand out, but you can't do flashing!

The Missinglinq

Richmond, Virginia

The Devil's in the Details!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top