View Full Version : 7952 You made an illegal function call.


chris01252
03-15-2007, 03:44 AM
I am trying to create a scolling message and found this code on a previous thread but when I run it I get the error '7952 You made an illegal function call.' When I click OK it just comes back again, and again and again. The only way to exit is restarting my computer.

ANY HELP WOULD BE MUCH APPRECIATED!


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 tblMessage.Message FROM tblMessage WHERE (((tblMessage.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

'Thanks to Ricky Hicks for his excellent use of the Mid function with a 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

chris01252
03-15-2007, 04:35 AM
If I get rid of the Timer code I then get the error '13 type mismatch'

So would this indicate the original error is in the timer code?