Link to home
Start Free TrialLog in
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
Avatar of JohnK813
JohnK813
Flag of United States of America image

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
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.
Avatar of xp310
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
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.
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 = ""
Avatar of 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
Avatar of 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
Avatar of JohnK813
JohnK813
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 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."
Avatar of xp310

ASKER

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

It works great.  Thakn you very much!
Good deal.  Glad to see it worked!