How to check if a Form is Open

  • Thread starter Thread starter Pele
  • Start date Start date
P

Pele

I had pasted this on the Macro newsgroup but have not
received any help yet and I am hoping that somebody can
help me on this forum.

=========================================================
In a macro I had written, I need to open a form and then
update the textboxes on the form. But I need the macro to
first check if the form is already open. If it was already
open, then I want the macro to close it and reopen it
again; otherwise, it should just open the form.

Can anybody give me a code that will do this. Thanks.

Pele
 
In Access 2000 and later, you can use:
CurrentProject.AllForms("MyForm").IsLoaded

In older versions, copy the IsLoaded() function from the Northwind sample
database (utilities module).

Would it be easier to execute an Update query statement to update the value
of the field directly in the table instead of bothering about the form?
 
Allen,

Thanks for your help.

Actually what I was trying to do was to update the
textboxes I had put on an Access Pivot table form. I had
made the control source of the textboxes equal to the
selections on conbo boxes on another open form.
Unfortunately, I noticed that the Pivot table forms is not
being updated when changes are made on the combo box. The
pivot form only gets updated after it's been opened and
closed. That was why I needed a macro to ensure that the
pivot form is closed if open.

If you have any better way of doing this that would be
good.

Pele
 
Back
Top