Marquee style or ticker tape scrolling of information across MS Access form

Hi experts,

I am trying to a Marquee style or ticker tape scrolling of information across MS Access form.  A little while ago I found the following code on the net but have mislaid the name of its source.  I have used the code in my application but am getting a very juddery result.  I am trying to achieve a smooth marquee style of scrolling.

The code I am using is as follows:

Option Compare Database
Public vCount As Integer
Public vMessage As String
Public vLen As Integer
Public vTicker As String
Private Sub Form_Load()
' -------- the following code is needed for the right to left scrolling text box ---------
    Me.txtScroll.Enabled = False
    Me.txtScroll.Locked = True
    Me.txtScroll.TextAlign = 3 ' 3 - enters from right to left
    vCount = 1
 
    ' modify these settings to your liking
    Me.TimerInterval = 10  '1000 = 1 second delay for each character
    vMessage = "Ticker tape example. Need to find better solution so that the message does not judder." ' do not have more than 250 characters
    vMessage = vMessage + "     " ' add 5 spaces for effect
    ' end user modify settings
    vLen = Len(vMessage)
'----------- end scrolling text -------------

End Sub

Private Sub Form_Timer()
'-------- code for scrolling text box -------------
    If vCount <= (vLen) Then ' repeat when the counter is same as the message length
        vTicker = vMessage + Mid(vMessage, 1, vCount) ' change the display message by 1 character
        Me.txtScroll = vTicker 'display the message
        vCount = vCount + 1
    Else
        vCount = 1 ' reset counter
    End If
' ------------ end code scrolling text box -------------
End Sub


I would be grateful if anyone could suggest either an alternative approach that produces a smoother result or alternatively could help me with additional code to improve the above scrolled message.

Many thanks,
Terry
TerenceHewettAsked:
Who is Participating?
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Connect With a Mentor Infotrakker SoftwareCommented:
DoEvents is a function that basically allows the machine to 'catch up' during intensive code operations. You use it liket his:

Private Sub Form_Timer()
'-------- code for scrolling text box -------------
    If vCount <= (vLen) Then ' repeat when the counter is same as the message length
        vTicker = vMessage + Mid(vMessage, 1, vCount) ' change the display message by 1 character
        Me.txtScroll = vTicker 'display the message
        vCount = vCount + 1
    Else
        vCount = 1 ' reset counter
    End If
    DoEvents <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
' ------------ end code scrolling text box -------------
End Sub

Same with Me.Redraw

And the Timer function on a Form seems (at least to me) to be very low priority in the hierarchy of Events, which may mean you're beating a dead horse on this one.
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You might try adding some DoEvents to the code in your Timer ... or a Me.Repaint in your timer loop. That said, this sort of thing is very dependent on many factors, including machine power, video adapter, refresh/resolution rates, monitor specs, machine "load" etc etc etc ...
0
 
TerenceHewettAuthor Commented:
Hi LSM,

Thanks for your help and comments.  If I wanted to add either the me.Repaint into the timer loop or add some DoEvents code, how would I go about doing this? DoEvent coding is not something I have had experience of.

Any further help would be gratefully received.

Regards,
Terry
0
 
Jeffrey CoachmanMIS LiasonCommented:
TerenceHewett,

I have never seen "Smooth" scrolling text in an Access form.
(For all the reasons LSM mentioned above)

Even the dedicated "Marque" control available in Data Access Pages is "Jittery"

You can ante up and buy a dedicated control, if this is that important to you:
http://www.fmsinc.com/Products/components/ControlTour/marquee.htm

JeffCoachman
0
 
TerenceHewettAuthor Commented:
Thank you for all comments made and for the help in getting me to understand the DoEvent functon.

Best regards, Terry
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.