Flashing Text Control

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Flashing Text Control

Post by D Willett »

Hi. There's a text control on a datasheet view form which needs to flash if it contains the text "***TBA***".
I've applied the following code to the forms timer event:

Code: Select all

Private Sub Form_Timer()
With ECD
If InStr(.Value, "***TBA***") Then
.ForeColor = (IIf(.ForeColor = -2147483640, -2147483633, -2147483640))
.BackColor = (IIf(.BackColor = -2147483633, -2147483640, -2147483633))
End If
End With
End Sub
Everything flashed bar the text's containing "***TBA***".


I've tried a couple of code snippets but the result is always the same?
Can you guys suggest a resolution?
You do not have the required permissions to view the files attached to this post.
Cheers ...

Dave.

User avatar
HansV
Administrator
Posts: 78589
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Flashing Text Control

Post by HansV »

Hi Dave,

I would recommend not to use flashing controls. It quickly becomes very irritating, and it can be dangerous - it can trigger an epileptic seizure in some people.
Moreover, when the value changes, the colours will be left as they were at that moment.
Using conditional formatting to highlight ***TBA*** should be sufficient.
Best wishes,
Hans

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Re: Flashing Text Control

Post by D Willett »

Hi Hans.
The display is a 50" TV in the workshop so the flashing irritation isn't really a problem, quite the opposite really and meant to annoy :-)
Production managers tend to think ***TBA*** as a get out of jail card and the pressure to produce a date takes 2nd place, hence the flashing annoys them so they provide a date.

Method in the madness so to speak..

Can the issue be fixed?

Cheers
Cheers ...

Dave.

User avatar
HansV
Administrator
Posts: 78589
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Flashing Text Control

Post by HansV »

From your screenshot, I gather that it is a continuous form. Any change you apply to the 'regular' formatting of a text box on a continuous form applies to all visible records at once.
So if the current record has ***TBA***, ALL records will start flashing. But conditional formatting overrides regular formatting, so in records where conditional formatting is active, the flashing won't be visible.

So the only thing I can think of, is: set a conditional formatting rule for all values <> ***TBA***, and remove the conditional formatting rule for ***TBA*** itself. That way, the flashing still applies to all records but it will not be visible unless the value is ***TBA***
Best wishes,
Hans

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Re: Flashing Text Control

Post by D Willett »

Hi Hans
I don't quite get this bit:
set a conditional formatting rule for all values <> ***TBA***
You do not have the required permissions to view the files attached to this post.
Cheers ...

Dave.

User avatar
HansV
Administrator
Posts: 78589
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Flashing Text Control

Post by HansV »

Try this as expression:

[ECD]<>"***TBA***"
Best wishes,
Hans

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Re: Flashing Text Control

Post by D Willett »

Yep, that works.

Thanks Hans


Cheers
Cheers ...

Dave.

User avatar
HansV
Administrator
Posts: 78589
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Flashing Text Control

Post by HansV »

Don't forget to take the If ... End If condition out of the On Timer event procedure:

Code: Select all

Private Sub Form_Timer()
    With ECD
        .ForeColor = IIf(.ForeColor = -2147483640, -2147483633, -2147483640)
        .BackColor = IIf(.BackColor = -2147483633, -2147483640, -2147483633)
    End With
End Sub
Best wishes,
Hans