Rajesh Candamourty said:
Dear All,
I would like to have the status bar msg to scroll. Right now am using
the code
SysCmd acSysCmdClearStatus
SysCmd acSysCmdSetStatus, "My Message"
Any help highly appreciated.
Thanks.
Raj.
You'll need to use a Timer event. Here's the complete code module from
a form I made a long time ago to test this out. On the form are two
text boxes; one for a message to be displayed in the morning, and one
for an message to be displayed in the afternoon. You don't need to be
this elaborate; I just made it this way in response to a question that
was asked in the newsgroup.
Watch out for any line wraps that may have been caused by the
newsreader.
'----- start of code -----
Option Compare Database
Option Explicit
Private Sub StatusMarquee( _
ByVal ActionCode As Integer, _
Optional MarqueeText As String)
Static strMarqueeText As String
If ActionCode = 1 And Len(MarqueeText) = 0 Then
ActionCode = 3 ' turn off marquee
End If
Select Case ActionCode
Case 1
strMarqueeText = MarqueeText & " "
Me.TimerInterval = 100
SysCmd acSysCmdSetStatus, strMarqueeText
Case 2
strMarqueeText = Mid$(strMarqueeText, 2) &
Left$(strMarqueeText, 1)
SysCmd acSysCmdSetStatus, strMarqueeText
Case 3
strMarqueeText = ""
Me.TimerInterval = 0
SysCmd acSysCmdClearStatus
End Select
End Sub
Private Sub Form_Close()
StatusMarquee 3 ' Shut off the marquee
End Sub
Private Sub Form_Timer()
Static lngTickCount As Long
Static lngTicksPerMinute As Long
Static strAMPM As String
If lngTickCount = 0 Then
lngTicksPerMinute = 60000 / Me.TimerInterval
If Format(Time, "AMPM") <> strAMPM Then
strAMPM = Format(Time, "AMPM")
If strAMPM = "AM" Then
StatusMarquee 1, Me!txtMorningMessage & ""
Else
StatusMarquee 1, Me!txtAfternoonMessage & ""
End If
End If
Else
StatusMarquee 2
End If
lngTickCount = lngTickCount + 1
If lngTickCount > lngTicksPerMinute Then lngTickCount = 0
End Sub
Private Sub txtMorningMessage_AfterUpdate()
If (Len(Me!txtMorningMessage & "") = 0 _
And Len(Me!txtAfternoonMessage & "") = 0) _
Then
StatusMarquee 3
Else
If Me.TimerInterval = 0 Then
StatusMarquee 1, Me!txtMorningMessage & ""
End If
End If
End Sub
Private Sub txtAfternoonMessage_AfterUpdate()
If (Len(Me!txtMorningMessage & "") = 0 _
And Len(Me!txtAfternoonMessage & "") = 0) _
Then
StatusMarquee 3
Else
If Me.TimerInterval = 0 Then
StatusMarquee 1, Me!txtAfternoonMessage & ""
End If
End If
End Sub
'----- end of code -----