Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Choose when to scroll text

Status
Not open for further replies.

knownote

Technical User
Feb 29, 2004
98
US
Hello all,

The below code works fine when the main form (switchboard replacement) starts up. I want to retain the below option by a user to choose the scrolling text message using InputBox, which isn't included in the searches on this fora. The only improvement would be to trigger the timer at will, rather than only being able to create a message when the main form starts up. So, how do you control triggering the form timer? Timer interval is 250. Thanks.
John

----Code

Private Sub Form_Timer()
Static strMsg As String, intLet As Integer, intLen As Integer
Dim strTmp As String
Dim strChng As Variant
Const TXTLEN = 90

If Len(strMsg) = 0 Then
strChng = InputBox("Create scrolling message.", "Create scrolling message")
strMsg = Space(TXTLEN) & strChng ' & vbCrLf _
' & "www. .com/ " & Space(TXTLEN)
intLen = Len(strMsg)
End If
intLet = intLet + 1
If intLet > intLen Then intLet = 1
strTmp = Mid(strMsg, intLet, TXTLEN)
lblScroll.Caption = strTmp

End Sub
 
How about a global variable set to true or false, accordingly?
 
You can "trigger" the timer by changing the timer interval.

To turn the timer off:

Me.TimerInterval = 0

To turn back on, at 250 as you specified:

Me.TimerInterval = 250

This could be done a number of ways, including using command buttons, a toggle button or even AfterUpdate on a control if a condition was/was not met.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Thanks, Remou and Missinglinq. I'll try a command button or control AfterUpdate - if I can think of an appropriate condition or control.
 
Not being familiar with programming, how do you split the code between the Timer and a command button, a toggle button or AfterUpdate on a control? I have tried variations with this code, including making it a separate function I pasted at the bottom of the form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top