sophistiKate
MIS
I am working with an Access 2003 database. Since adding a timer event to check for idle time to a form, a custom toolbar button that creates a snapshot has stopped working properly. Until the first time the timer event procedure is run, the button works fine, but after that, it produces an error "The Object Type argument for the action or method is blank or invalid."
The button runs a macro which runs the action "OutputTo" with the following settings:
Object Type: Report
Object Name: (blank)
Output Format: Snapshot Format
The code for the timer procedure is:
Private Sub Form_Timer()
'************************************************* *********************
'* This timer event procedure will shut down the application
'* after a specified number of minutes of inactivity. Inactivity
'* is measured based on how long a control remains the ActiveControl.
'************************************************* *********************
Dim sngElapsedTime As Single
Dim ctlNew As Control
Dim currObject As String
On Error Resume Next
Set ctlNew = Screen.ActiveControl
If Err <> 0 Then
'* No activecontrol
sngElapsedTime = Timer - sngStartTime
Err.Clear
Else
If ctlNew.Name = "InactiveShutDownCancel" Then
'* The warning form has appeared, and the cancel button
'* is the active control
sngElapsedTime = Timer - sngStartTime
Else
If ctlNew.Name = ctlSave.Name Then
'* Still at same control
sngElapsedTime = Timer - sngStartTime
Else
'* Some change has occured, we're at a new control
Set ctlSave = ctlNew
resetTimer
End If
If Err <> 0 Then
Set ctlSave = Screen.ActiveControl
End If
End If
End If
Err.Clear
On Error GoTo Err_Path
Set ctlNew = Nothing
If sngElapsedTime > (intMinutesUntilShutDown * 60) Then ' First interval has passed; present idle warning.
DoCmd.OpenForm "frmInactiveShutDown", , , , , , sngElapsedTime & "|" & sngStartTime & "|" & intMinutesUntilShutDown & "|" & intMinutesWarningAppears
End If
Exit Sub
Err_Path:
MsgBox (ErrorLogRuntime(Error$, Screen.ActiveForm.Name, Screen.ActiveControl.Name))
Exit_Section:
End Sub
Any help is most appreciated.
The button runs a macro which runs the action "OutputTo" with the following settings:
Object Type: Report
Object Name: (blank)
Output Format: Snapshot Format
The code for the timer procedure is:
Private Sub Form_Timer()
'************************************************* *********************
'* This timer event procedure will shut down the application
'* after a specified number of minutes of inactivity. Inactivity
'* is measured based on how long a control remains the ActiveControl.
'************************************************* *********************
Dim sngElapsedTime As Single
Dim ctlNew As Control
Dim currObject As String
On Error Resume Next
Set ctlNew = Screen.ActiveControl
If Err <> 0 Then
'* No activecontrol
sngElapsedTime = Timer - sngStartTime
Err.Clear
Else
If ctlNew.Name = "InactiveShutDownCancel" Then
'* The warning form has appeared, and the cancel button
'* is the active control
sngElapsedTime = Timer - sngStartTime
Else
If ctlNew.Name = ctlSave.Name Then
'* Still at same control
sngElapsedTime = Timer - sngStartTime
Else
'* Some change has occured, we're at a new control
Set ctlSave = ctlNew
resetTimer
End If
If Err <> 0 Then
Set ctlSave = Screen.ActiveControl
End If
End If
End If
Err.Clear
On Error GoTo Err_Path
Set ctlNew = Nothing
If sngElapsedTime > (intMinutesUntilShutDown * 60) Then ' First interval has passed; present idle warning.
DoCmd.OpenForm "frmInactiveShutDown", , , , , , sngElapsedTime & "|" & sngStartTime & "|" & intMinutesUntilShutDown & "|" & intMinutesWarningAppears
End If
Exit Sub
Err_Path:
MsgBox (ErrorLogRuntime(Error$, Screen.ActiveForm.Name, Screen.ActiveControl.Name))
Exit_Section:
End Sub
Any help is most appreciated.