Make a variable text box flash red

G

Guest

I want to make several text boxes flash red on my form. The text box that
flashes is dependant on the value of a list box (lstTypeOfCall). I have the
code below for the Form Timer event and below that the module code to hold
the name of the control, either textSales, textService or textOther.

Private Sub Form_Timer()
Static lngCount As Long
Static conControl As Control

conControl = getControl()

If lngCount = 0 Then
lngCount = 8
End If

If conControl.BackColor = 255 Then
conControl.BackColor = 16777215
Else
conControl .BackColor = 255
End If

lngCount = lngCount - 1
If lngCount = 0 Then
Me.TimerInterval = 0
End If
End Sub

Module:
Private m_nControl As Control

Public Function setControl(nControl As Control)
m_nControl = nControl
End Function

Public Function getControl() As Control
getControl = m_nControl
End Function

and
Call setControl("lstTypeOfCall")
to send the value to the module.

As the moment none of it works as this is more sudo code than anything else
so I don't know if i'm using the correct references. Any ideas?
 
J

Jeff Boyce

Adam

Reconsider this user interface. Folks susceptible to epilepsy can have a
seizure triggered by strobing red lights. Perhaps you could simply set the
background color to red to flag your users' attention...

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/
 
G

Guest

If I ever have a user with epilepsy joining my work place I will redesign the
form then, in the mean time I need to make it as obvious to my users as
possible what text box they need to fill in.
 
G

Guest

Actually it turns out we do have a guy with epilepsy. How would I go about
having jsut the red box then for a variable text box?
 
S

SusanV

I use this sort of thing in a lot of reports - but it will work just as well
on a form... Substitute your actual control and criteria:

If me.YourTextControl = 'YourCriteria' then
me.YourOtherBox.Backcolor = 255
me.You2ndTextbox.Backcolor = 255
End If

You can also change the font to bold with:

Me.YouOtherBox.FontWeight = 600

And back to normal with:

Me.YouOtherBox.FontWeight = 400
 

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