PreviousControl

Tiro Cupidus

Registered User.
Local time
Today, 01:28
Joined
Apr 25, 2002
Messages
263
Code:
Private Sub Form_Current()
  Dim ctl As Control
  stuff...
  ...
  Set ctl = Screen.PreviousControl
End Sub
"Set ctl = Screen.PreviousControl" gives me this error:

Run-time error '2467':

The expression you entered refers to an object that is closed or doesn't exist.


For example, you may have assigned a Form to a form object variable, closed the form, and then referred to the object variable.
Any help? Or do I need to post more information?
 
When the form first opens, the OnCurrent event fires, so there may be no Screen.PreviousControl.
 
Include error handling

Private Sub Form_Current()
On Error GoTo Err_Form_Current
Dim ctl As Control
stuff...
...
Set ctl = Screen.PreviousControl


Exit_Form_Current:
Exit Sub

Err_Form_Current:
If Err =2467 then
Resume Exit_Form_Current
Else
Msgbox Err.Description
Resume Ext_Form_Current
End If

End Sub


HTH
Dave
 
Last edited:

Users who are viewing this thread

Back
Top Bottom