Avatar of xp310
xp310
 asked on

Blinking Text and/or Scrolling Marquee

Hello,

I highly doubt this is even possible - but I have made a form, which only looks up records that have been rejected.  At the very top of the form - I have a label box saying "This record has been rejected... etc..."

For a lil touch of eye candy - I'd like for that text to blink/flash - whatever to definitly get the employees attention.  (I know I could approach this other ways, by making popups or warning boxes or whatever...  but I really only want what I specifically what I ask for)

If blinking/flashing text isn't possible, is a scrolling marquee possible?

Thanks,
Jay
Microsoft Access

Avatar of undefined
Last Comment
JohnK813

8/22/2022 - Mon
JohnK813

You can play around with the Timer function for blinking or scrolling.

Blinking:

'TimerInterval=1000 is for 1 second (5000 for 5 seconds, etc)
Private Sub Form_Load()
    Me.TimerInterval = 1000
End Sub

'on each Timer interval, flip-flop the label between
'being blank or showing the rejection text
PrivateSub Form_Timer()
  If MyLabel.Caption = "" Then
    MyLabel.Caption = "This application has been rejected!"
  Else
    MyLabel.Caption = ""
  End If
End Sub


For a blinking effect, try this in your Form_Timer (assuming Access XP or later):

Label4.Move Label4.Left - 1
JohnK813

Correction:

Label4.Move Label4.Left - 1

is for a scrolling effect.  I haven't tried it, so I don't know how good it will look.
xp310

ASKER
JohnK813,

When I add this code into the OnLoad event...

'TimerInterval=1000 is for 1 second (5000 for 5 seconds, etc)
Private Sub Form_Load()
    Me.TimerInterval = 1000
End Sub

'on each Timer interval, flip-flop the label between
'being blank or showing the rejection text
PrivateSub Form_Timer()
  If RejectLabel.Caption = "" Then
    RejectLabel.Caption = "This application has been rejected!"
  Else
    RejectLabel.Caption = ""
  End If
End Sub

I get an error...

It says...

Compile Error:

Only comments may appear after End Sub, End Function, or End Property

Then it highlights in yellow:

Private Sub Form_Load()

And then it highlights in blue:

Form_Timer()

The only thing I did change in the code was "MyLabel" to "RejectLabel" as that's the name of the label.

Any ideas what I'm doing wrong?

Thanks,
Jay
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
JohnK813

First, I see I had a small typo.  There should be a space between Private and Sub in Private Sub Form_Timer()

This part should be added to the OnLoad event:

'TimerInterval=1000 is for 1 second (5000 for 5 seconds, etc)
Private Sub Form_Load()
    Me.TimerInterval = 1000
End Sub

This part should be added to the OnTimer event:

'on each Timer interval, flip-flop the label between
'being blank or showing the rejection text
Private Sub Form_Timer()
  If RejectLabel.Caption = "" Then
    RejectLabel.Caption = "This application has been rejected!"
  Else
    RejectLabel.Caption = ""
  End If
End Sub


If you have problems with this, you can go to View menu -> code and try copying and pasting the entire thing into this Visual Basic code window.
hairyminga

Just a thought... What might be a more elegant solution for the Form_Timer event might be as follows:

Private Sub Form_Timer()
    Dim objControl as Object

    For Each objControl In Me
        On Error Resume Next
        If Nz(UCase(objControl.Tag)) = "BLINK" Then
            objControl.Visible = Not(objControl.Visible)
        End If
        On Error Goto 0
    Next
End Sub

This would mean that ANY control on a form can be set to blink.  All you need to do is use the following line of code:

Me![ControlName].Tag = "BLINK"

Say, for instance:

Me![RejectLabel].Tag = "BLINK"

And, that would start the blinking effect.  To stop it, use:

Me![RejectLabel].Tag = ""
xp310

ASKER
JohnK813,

I recieved an error when I opened my form.

The expression On Load you entered as the event property setting produced the following error:  Ambiguous name detected:  Form_Load.

*The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro.

I don't know if this means anything, but for some reason I recieve that error message twice.

Below is the entire code I have for the form.

Option Compare Database

       Private Sub comboCreditCode_AfterUpdate()
           If Me.comboCreditCode.Column(1) = "1a" Or Me.comboCreditCode.Column(1) = "29" Then
             Me.txtChildAccountNumber.Enabled = False
             Me.[Label209].Visible = False                    '<<<<insert this line
          Else
              Me.txtChildAccountNumber.Enabled = True
            Me.[Label209].Visible = True                       'insert this line
          End If
        End Sub

Private Sub Form_Load()
'TimerInterval=1000 is for 1 second (5000 for 5 seconds, etc)
Private Sub Form_Load()
    Me.TimerInterval = 1000
End Sub

Private Sub Form_Timer()
'on each Timer interval, flip-flop the label between
'being blank or showing the rejection text
Private Sub Form_Timer()
  If RejectLabel.Caption = "" Then
    RejectLabel.Caption = "Important:  This record has been rejected, please refer to the "Billing Notes" section for more information."
  Else
    RejectLabel.Caption = ""
  End If
End Sub
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
xp310

ASKER
HairyMinga,

I wasn't able to test out your code.  I understand where to place the first part of code.  But in placing the 'single line' of code, I have no clue where it belongs.

IE:  Me![RejectLabel].Tag = "BLINK"
ASKER CERTIFIED SOLUTION
JohnK813

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
xp310

ASKER
I didn't realize I had that in there.

Anyhow, I copied the new code in.  After about 1 second of the form loading, I recieve an error message:

Compile error:
Syntax error

It highlights in yellow...
"Private Sub Form_Timer()

And highlights text red...
    RejectLabel.Caption = "Important:  This record has been rejected, please refer to the "Billing Notes" section for more information."
xp310

ASKER
I figured out the problem.  It was the quotes within the quotes.

It works great.  Thakn you very much!
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
JohnK813

Good deal.  Glad to see it worked!