Error 2467 .. object ... doesn't exist - how to check? (1 Viewer)

brewmanz

New member
Local time
Today, 16:33
Joined
Jul 1, 2011
Messages
1
I'm getting R/T Error 2467 "The expression you entered refers to an object that is closed or doesn't exist."
Yes, I know what that means.
But ... how do I check for that before it blows up?
The following code shows attempts to do so. None worked; anyone any ideas?
' original code
If (Form_subMyForm.Visible = True) Then
'do something
' attempts to fix by prequalifying that object exists
'If (Form_subBiddersList Is Nothing) Then
'If (Form_subBiddersList = Nothing) Then
'If (Form_subBiddersList Is Null) Then
'If (Form_subBiddersList = Null) Then
'If (IsNull(Form_subBiddersList)) Then
'If (IsEmpty(Form_subBiddersList)) Then
'If (Form_subBiddersList = Empty) Then
'If (Nz(Form_subBiddersList.Visible) = 0) Then
===
Some way to check for an uninitialised/closed variable/form would be appreciated.
PS BTW This is a very large app that I've been asked to fix up; saying something trite like 'initialise the variable before use' is NOT an option.

Thank you

Brewmanz
 

boblarson

Smeghead
Local time
Yesterday, 21:33
Joined
Jan 12, 2001
Messages
32,059
To check if a form is open:

Code:
If CurrentProject.AllForms("FormNameHereInQuotes").IsLoaded Then

Or are you wanting to find out if the form actually exists?
 

Users who are viewing this thread

Top Bottom