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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flashing Colors

Status
Not open for further replies.

fabby1

Technical User
Mar 9, 2004
206
0
0
GB
Hi

I have a form with 60 textboxes that represent the chutes on a sorter.

I build a record set based on the number of time the chutes become full.

I then change the color of the chute to red and display the total number of chute fulls in each box

This works fine


What I would like to do is, if a chute has say more than 10 chute fulls still change it to red but make it flash as well.

What could I use to store the ever changing list of chutes that have more than 10 chute fulls and then use the timer event to make it flash ???


This is the code I currently use to build and display the chute fulls

Code:
Function ChuteAvailability()

Dim dbsCurrent As Database
Dim rstChutes As DAO.Recordset
Dim sqltext As String
Dim TmpChute As String

Set dbsCurrent = CurrentDb

CalledForm = G_CalledForm
G_NumberDays = DateDiff("d", G_DATE, G_DATE1) + 1
G_Availability100 = G_NumberDays * DateDiff("s", G_Time, G_Time1)

Set rstChutes = dbsCurrent.OpenRecordset( _
"SELECT Sum(dur) AS Duration, var1, Count(msg) AS Total " _
& "FROM TMP_DAILY_ALARMS " _
& "WHERE (((msg) Like "" Chute Blocked"" Or (msg) Like "" Chute Out Of Service"" Or (msg) Like "" Emergency Stop"") AND ((dur)>0)) AND jtime BETWEEN #" & G_Time & "# AND #" & G_Time1 & "# " _
& "GROUP BY var1 " _
& "HAVING ((var1) Like ""Chute *"")", dbOpenDynaset)
              
Set_Green
With rstChutes
  .MoveLast
  .MoveFirst
  Do Until .EOF
    TmpChute = !var1
    TmpDuration = !Duration
    TmpCount = !Total
    PopulateChuteScreen (TmpChute), (TmpDuration), (TmpCount)
    .MoveNext
   Loop
  
End With
End Function

-----------------------------------------------------------

Sub PopulateChuteScreen(TmpChute As String, TmpDuration As Long, TmpCount As Long)

Dim lngRed As Long, lngYellow As Long, lngWhite As Long
lngRed1 = RGB(255, 200, 200)
lngRed2 = RGB(255, 100, 100)
lngRed3 = RGB(255, 0, 0)
lngGreen = RGB(0, 255, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)

Forms(G_CalledForm).Controls(TmpChute).BackColor = lngRed3
Forms(G_CalledForm).Controls(TmpChute).SpecialEffect = 2
Forms(G_CalledForm).Controls(TmpChute).Value = TmpCount

Forms(G_CalledForm).Repaint
Forms(G_CalledForm).Requery

End Sub
 
Use the On Timer event of the form and set the property to 1000 this would be 1 second, then check the value of each textbox that is representing a chute and then based on it's value toggle the color from your forms background color to the color that you want to flash.

Kramerica
 
Thanks Kram

I'll give it a whirl

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top