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

Coding For CoLoR in Access. How?

Status
Not open for further replies.

SteverZ

Technical User
Nov 8, 2000
16
0
0
US
I have a form where I have added a blinking effect to label1. Here is the code, and the code works fine:

Private Sub Form_Timer()
With Me.Label1
.ForeColor = (IIf(.ForeColor = vbBlue, vbBlack, vbBlue))
End With
End Sub

-------------------
Private Sub Form_Current()
Me.TimerInterval = 1000
End Sub
------------------
That above code allows for two colors to alternate. But, why can't more colors be allowed to alternate at one time? Next is the code that I successfully used in Visual Basic 6 that gives all colors possible:

Private Sub Timer1_Timer()
Label2.ForeColor = Val(Label2.ForeColor) + 1000
End Sub
-------------------
So my question is, what would the code be that would work in Access to allow the 1000 colors? The Visual Basic code above does not work in Access.

Thank You.


 
Hi Steverz...

I looked at your coding and found it original in the fact that I never programmed anything glitzy enough to do flashing... However, I thought what I could do to bring it just a step further... Try this coding:

Private Sub Timer1_Timer()
Label2.ForeColor = (16000 * Rnd) + 1
End Sub

What this will do is cycle through the colors of 1 - 16000... Now, your thought would be to increment by 1000 so I don't see why 1000 couldn't take the place of 1... The only drawback to my code is that some colors are so close together, that they're hard to discern whether or not it's changing color... I also decreased the Timer Value to 250 so that the flash will be faster... Of course, 16000 can be increased to 256000 or better yet, into the 16M or 24M range for a wider variety of colors and then, it's dependant on the user's monitor...

Thanks for the idea...

Roy aka BanditLV
Las Vegas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top