Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine if object already exists? 1

Status
Not open for further replies.

tmcnutt

Programmer
May 17, 2002
83
US
Is there a way to check for existence of a specific object. I have an application that creates an object the first time a user enters data in a form and if they access the form again, I want to load data from the object. If it is the first time the user enters the form, the object will not be created until they click on the OK button. I know that I could set a boolean variable, but was wondering if there was a function for this. Thanks in advance.

Tom
 
If objMyObject Is Nothing Then
'object hasn't been created
End If

Where objMyObject is a variable dimmed as the type of object or the generic type Object.

Paul Bent
Northwind IT Systems
 
Object? Custom, Standard, via CreateObject or New. Some more details. However GetObject("ProjectName.clsName") should do the trick. If there is no Object it Returns (I believe, not 100% Error 429).

Good luck, let me know
 
Another way is to use ObjPtr function.

If ObjPtr(object) = 0 Then
'object does not exist
Else
'object exists
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top