Reference below, can someone please help me to create a code that when ActualD field is empty the SchedD field is flashing/blinking (in red color text)
Once a value is added in the ActualD field the blinking in SchedD field will stop and back to color black text.
Is that a form? Otherwise, I think you'll have to use a form.
PS. Also, the common impression about blinking/flashing text is that it is very annoying. You might consider simply using Conditional Formatting to just change the background color to red.
You can put ONE timer event on each form. (There are no "control" timer events.) Your issue will hit you in multiple parts.
First, you will need to make the test for "blink this control" be very simple because you will probably have to run this test code frequently. You can do it on forms that are NOT set up like continuous-mode datasheets. If you wanted a continuous form to blink, give that up now. That is not possible without a lot of work. In the form that we see in post #4 or #5, it IS possible.
Second, the OnTimer event can easily become a major drag on your system, particularly if you wanted a fast blink. Enough of a drag as to make the form appear to be very sluggish to respond. If you want a blink more often than once per second, listen to the advice of others as well as me. Don't do a fast blink. IMMEDIATELY give up the "fast blink" idea.
Third, debugging something when a timer is running becomes an experience all on its own.
There are many ways to handle this - but they are generally tedious.
1. Put a variable in the declaration area of the form.
Dim FlipFlop As Boolean
2. At some point you set the timer for the number of milliseconds you want to have as your interval. Do this in the Form_Load routine. NEVER EVER set a number less than 1000 in the Me.Timer slot. Also set the FlipFlop to FALSE. (Or TRUE, whatever floats your boat as a starting point.)
3. In the form timer,
Code:
Private Sub Form_Timer()
FlipFlop = NOT FlipFlop
If Nz( Actual1, "" ) = "" Then
If Sched1.Foreground = vbBlack then
Sched1.Foreground = Me.Background
Else
Sched1.Foreground = vbBlack
End If
Else
Sched1.ForeGround = vbBlack
End If
... 'repeat for each schedule and actual ID on the form.
End Sub
Remember you can ONLY do this if you have discrete controls. You CANNOT do this on a continuous form (because there, the controls are virtual). It might be possible to define a function to encapsulate that logic for flipping the foreground color, but that won't work for continuous forms either.
theDBguy - the only think I could think of to do would be to alternately define conditional or non-conditional formats to the entire column in question and I have zero clue about how to do that.
theDBguy - the only think I could think of to do would be to alternately define conditional or non-conditional formats to the entire column in question and I have zero clue about how to do that.
I actually already gave that a try where I had the CF expression check for the current time to try and blink the background color every second. Unfortunately, CF seems to only get applied once when the form opens. And since nothing was connected to the system clock, as in changing or updating it, the CF seems to only get applied once and don't get reevaluated again.
I kind of expected that it would be that way. Probably would take a .Repaint or .Requery to get the form to redo the CF and the overhead there would eat your socks doing a .Re-anything on a timer.
I don't see any reasonable way to do this offhand. Still thinking but the problem is that this used to be a hardware function when you put the display in some particular low-numbered mode. However, when you put your display in the typical 16-million-color mode (24 bits of color info), there is no "blink" bit in the hardware in that mode. If you were to drop the screen into something DOS-like <shiver>, it might work but your screen would look like crap.
This won't address the continuous form issue. Here is a method of flashing text without using a timer that I have on one of my forms. It does a quick flash that is noticeable.
Code:
If InStr(Me.txtExcelName, "V&V") = 0 Then
For i = 1 To 10
Me.lblNoteVV.Visible = True
DoEvents
Me.lblNoteVV.Visible = False
DoEvents
Next
Me.lblNoteVV.Visible = True
Else
Me.lblNoteVV.Visible = False
End If