PC Review


Reply
Thread Tools Rate Thread

check if object set

 
 
=?Utf-8?B?c21rMjM=?=
Guest
Posts: n/a
 
      28th Jun 2005
Is there something more elegant than this to determine if an object is set?
frm is a form object:

If Not frm is Nothing Then
....

TIA

--
sam
 
Reply With Quote
 
 
 
 
=?Utf-8?B?T2Zlcg==?=
Guest
Posts: n/a
 
      28th Jun 2005
You can use
if isloaded("formname")then

"smk23" wrote:

> Is there something more elegant than this to determine if an object is set?
> frm is a form object:
>
> If Not frm is Nothing Then
> ...
>
> TIA
>
> --
> sam

 
Reply With Quote
 
=?Utf-8?B?T2Zlcg==?=
Guest
Posts: n/a
 
      28th Jun 2005
Sorry, but this is the function isloaded

public function IsLoaded(FormName as String) As Boolean
dim strFName as String ' convert to lcase
dim frm as Form ' iterate forms collection

' ignore case
strFName = LCase$(FormName)

' assume it's not there
IsLoaded = False

' look through open forms
For Each frm in Forms
' could use StrComp if you prefer
If LCase$(frm.Name) = strTemp
' found it
IsLoaded = True
' don't bother going round any more
Exit For

End If
Next frm
End Function

"smk23" wrote:

> Is there something more elegant than this to determine if an object is set?
> frm is a form object:
>
> If Not frm is Nothing Then
> ...
>
> TIA
>
> --
> sam

 
Reply With Quote
 
=?Utf-8?B?c21rMjM=?=
Guest
Posts: n/a
 
      28th Jun 2005
Thanks Ofer! But what I am looking for is how to determine whether a variable
such as a form, recordset, etc. has been set.
--
sam


"smk23" wrote:

> Is there something more elegant than this to determine if an object is set?
> frm is a form object:
>
> If Not frm is Nothing Then
> ...
>
> TIA
>
> --
> sam

 
Reply With Quote
 
Brendan Reynolds
Guest
Posts: n/a
 
      29th Jun 2005
What is your objection to ...

If Not frm Is Nothing Then

?

I am not aware of any alternative that would not be much less elegant than
this.

--
Brendan Reynolds (MVP)


"smk23" <(E-Mail Removed)> wrote in message
news:694FB46C-3DE0-4E81-AD35-(E-Mail Removed)...
> Thanks Ofer! But what I am looking for is how to determine whether a
> variable
> such as a form, recordset, etc. has been set.
> --
> sam
>
>
> "smk23" wrote:
>
>> Is there something more elegant than this to determine if an object is
>> set?
>> frm is a form object:
>>
>> If Not frm is Nothing Then
>> ...
>>
>> TIA
>>
>> --
>> sam



 
Reply With Quote
 
=?Utf-8?B?c21rMjM=?=
Guest
Posts: n/a
 
      29th Jun 2005
My gradeschool teacher taught me never to use double negatives. :-)
Okay. Thanks!!
--
sam


"Brendan Reynolds" wrote:

> What is your objection to ...
>
> If Not frm Is Nothing Then
>
> ?
>
> I am not aware of any alternative that would not be much less elegant than
> this.
>
> --
> Brendan Reynolds (MVP)
>
>
> "smk23" <(E-Mail Removed)> wrote in message
> news:694FB46C-3DE0-4E81-AD35-(E-Mail Removed)...
> > Thanks Ofer! But what I am looking for is how to determine whether a
> > variable
> > such as a form, recordset, etc. has been set.
> > --
> > sam
> >
> >
> > "smk23" wrote:
> >
> >> Is there something more elegant than this to determine if an object is
> >> set?
> >> frm is a form object:
> >>
> >> If Not frm is Nothing Then
> >> ...
> >>
> >> TIA
> >>
> >> --
> >> sam

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Check to see if object key is in collection Dirk Goldgar Microsoft Access VBA Modules 0 16th Oct 2009 07:42 PM
Check an object reference =?Utf-8?B?WFA=?= Microsoft Excel Programming 2 19th Oct 2007 10:57 PM
Check if an object is a type object Fredrik Strandberg Microsoft VB .NET 13 1st Mar 2006 08:11 AM
WMI object to check IP printer? Carlton Whitmore Microsoft Windows 2000 Deployment 0 1st Feb 2004 09:08 PM
How can I check whether or not a registry key object is = Nothing? Christian Blackburn Microsoft VB .NET 10 20th Sep 2003 02:16 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:31 AM.