Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 4.50 average. Display Modes
Old 06-30-2011, 08:37 PM   #1
brewmanz
Newly Registered User
 
Join Date: Jun 2011
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
brewmanz is on a distinguished road
Error 2467 .. object ... doesn't exist - how to check?

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

brewmanz is offline   Reply With Quote
Old 06-30-2011, 08:40 PM   #2
boblarson
Smeghead
 
boblarson's Avatar
 
Join Date: Jan 2001
Location: Oregon, USA
Posts: 32,068
Thanks: 97
Thanked 1,814 Times in 1,574 Posts
boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold
Re: Error 2467 .. object ... doesn't exist - how to check?

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?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
boblarson is offline   Reply With Quote
The Following User Says Thank You to boblarson For This Useful Post:
brewmanz (07-03-2011)
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Run-time error '2467': amirbilal General 7 05-24-2016 10:54 AM
Error in Macro-object doesn't contain the Automation object databasemon Macros 0 09-23-2010 05:09 AM
How to avoid an error deleting a table that doesn't exist? Balr14 Macros 4 01-25-2009 12:31 PM
Runtime Error 2471 Object doesn't contain Automation object wilsonee Modules & VBA 1 11-06-2004 08:47 AM
Check for an existing record and add if it doesn't exist Srubin Forms 5 07-24-2003 08:31 AM




All times are GMT -8. The time now is 09:41 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World