Hello All,
I need Help with the below script i got over the net, i want to close the form once the messages end.
any ideas what to write and where within the code ??
Thanks,
MK
I need Help with the below script i got over the net, i want to close the form once the messages end.
any ideas what to write and where within the code ??
Code:
Option Compare Database
Option Explicit
Public txtScrollStatus As String
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
Dim MyDb As Database
Dim sMessage As String
Dim sMessages As String
Dim rMessage As Recordset
Set MyDb = CurrentDb()
sMessage = ""
sMessages = ""
sMessages = "SELECT tMessage.Message FROM tMessage WHERE (((tMessage.Message) Is Not Null));"
Set rMessage = MyDb.OpenRecordset(sMessages)
rMessage.MoveFirst
Do Until rMessage.EOF = True
sMessage = sMessage & Space(10) & rMessage!Message
If Not rMessage.EOF Then rMessage.MoveNext
Loop
TimerInterval = 100
Me.lMessage.Caption = sMessage
txtScrollStatus = sMessage
Set MyDb = Nothing
Set rMessage = Nothing
Exit_Form_Open:
Exit Sub
Err_Form_Open:
MsgBox Err.Number & " " & Err.Description
Resume Exit_Form_Open
End Sub
Private Sub Form_Timer()
On Error GoTo Err_Form_Timer
Me.lMessage.Caption = Mid(Me.lMessage.Caption, 2, (Len(Me.lMessage.Caption) - 1)) & Left(Me.lMessage.Caption, 1)
SysCmd acSysCmdSetStatus, txtScrollStatus
txtScrollStatus = Mid(txtScrollStatus, 2, (Len(txtScrollStatus) - 1)) & Left(txtScrollStatus, 1)
Exit_Form_Timer:
Exit Sub
Err_Form_Timer:
MsgBox Err.Number & " " & Err.Description
Resume Exit_Form_Timer
End Sub
Thanks,
MK