! How Do I Check Form is Opened !

  • Thread starter Thread starter TC
  • Start date Start date
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
 
Hi,

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

Thanks for your help.

Wembly
 
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
 
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.
 
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
 
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
 
Back
Top