! How Do I Check Form is Opened !

T

TC

Wembly said:
Hi,

How would I write the code to check whether a form is
opened or not?

Thanks for your help.

Wembly


dim s as string
on error resume next
s=forms("YourFormNameHere").name
if err.number <> 0 then s = ""
on error goto 0
if s = "" then
' form is not open.
else
' form is open.
endf

HTH,
TC
 
W

Wembly

Hi,

How would I write the code to check whether a form is
opened or not?

Thanks for your help.

Wembly
 
T

Tim Ferguson

TC said:
s=forms("YourFormNameHere").name

Am I getting old, or has the behaviour of this line changed? Did it not
previously cause the form to be loaded invisibly, and return the correct
name string?

Tim F
 
D

Douglas J. Steele

Tim Ferguson said:
Am I getting old, or has the behaviour of this line changed? Did it not
previously cause the form to be loaded invisibly, and return the correct
name string?

Don't think so. I don't have anything older than Access 97 loaded on this
machine, but it causes an error in 97 if the form isn't loaded.
 
T

TC

Tim Ferguson said:
Am I getting old, or has the behaviour of this line changed? Did it not
previously cause the form to be loaded invisibly, and return the correct
name string?


Owww! I hope not. As I understand it, only opened forms are present in the
forms collection. If the form isn't loaded, it is not in the collection, and
the code will throw an error.

It would be very unusual & unexpected behaviour, if referencing a
non-existant collection member, somehow caused that member to be opened or
loaded!

Yes? No?

TC
 
T

Tim Ferguson

TC said:
It would be very unusual & unexpected behaviour, if referencing a
non-existant collection member, somehow caused that member to be
opened or loaded!

Must be all the aluminium in the water again... Yes Matron... Perhaps it
was in VB instead... <muttering off>...


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top