Solved

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

Posted on 2008-10-16
5
1,613 Views
Last Modified: 2013-11-28
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
0
Comment
Question by:TerenceHewett
  • 2
  • 2
5 Comments
 
LVL 84
ID: 22730476
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
 

Author Comment

by:TerenceHewett
ID: 22731711
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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22737590
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
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 22739086
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
 

Author Comment

by:TerenceHewett
ID: 22889628
Thank you for all comments made and for the help in getting me to understand the DoEvent functon.

Best regards, Terry
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now