Close pop-up forms efficiently

B

BruceM

I have a database with a tabbed form. Sometimes when the user is on a tab
they need to see information on another, but without losing sight of the
information on the current tab. To help with that I have created some small
pop-up forms that show the information that is displayed on other tabs. In
some cases there could be three such pop-up forms open. This works OK, but
I would like to know the most efficient way of closing them when I navigate
to another record (I will ask you to accept that this is necessary). I
could do something like this in the form's Current event:

If CurrentProject.AllForms("FirstForm").IsLoaded Then
DoCmd.Close acForm, "FirstForm"
End If
If CurrentProject.AllForms("SecondForm").IsLoaded Then
DoCmd.Close acForm, "SecondForm"
End If
If CurrentProject.AllForms("ThirdForm").IsLoaded Then
DoCmd.Close acForm, "ThirdForm"
End If

Or I could just close the forms:

DoCmd.Close acForm, "FirstForm"
DoCmd.Close acForm, "SecondForm"
DoCmd.Close acForm, "ThirdForm"

Is there any advantage to testing whether they are open first? Is there a
more efficient way than I have described, or a better event than the Current
event?
 
M

Marshall Barton

BruceM said:
I have a database with a tabbed form. Sometimes when the user is on a tab
they need to see information on another, but without losing sight of the
information on the current tab. To help with that I have created some small
pop-up forms that show the information that is displayed on other tabs. In
some cases there could be three such pop-up forms open. This works OK, but
I would like to know the most efficient way of closing them when I navigate
to another record (I will ask you to accept that this is necessary). I
could do something like this in the form's Current event:

If CurrentProject.AllForms("FirstForm").IsLoaded Then
DoCmd.Close acForm, "FirstForm"
End If
If CurrentProject.AllForms("SecondForm").IsLoaded Then
DoCmd.Close acForm, "SecondForm"
End If
If CurrentProject.AllForms("ThirdForm").IsLoaded Then
DoCmd.Close acForm, "ThirdForm"
End If

Or I could just close the forms:

DoCmd.Close acForm, "FirstForm"
DoCmd.Close acForm, "SecondForm"
DoCmd.Close acForm, "ThirdForm"

Is there any advantage to testing whether they are open first? Is there a
more efficient way than I have described, or a better event than the Current
event?


I can't think of another way to do that.

As always, you have to evaluate performance in the context
of your own situation. In general it is faster to test if
it is open than it is to trap and ignore the error caused by
trying to close a form that is not open. It's unlikely that
any difference is significant though.

It strikes me as a bit odd that you have the screen real
estate available for these little forms but need to use a
tab control to conserve space.
 
B

BruceM

The small forms are just a selection of fields, not all of the fields. The
data are contained in small text boxes with small font and scroll bars. It
is adequate for reference, but would be inconvenient for data entry. Also,
each of the four tabs is a separate section of the form: Problem
Description, Response, Follow-up, and Final Approval.
The three Problem Description fields are on the first tab; the seven
Response fields are on the second tab, and so forth. When filling out the
Follow-up it is sometimes convenient to see the preceding sections. By
having the data in pop-up forms the user can drag them around, or close them
if they are no longer needed (or not open them at all). If everything is on
one screen, divided into sections, the text boxes and other controls are
inconveniently small and difficult to read.
It all comes down to the appearance of the user interface. Since the people
using the database may do so only once or twice a year, it seemed best to
make it as clear as it could be. If somebody needs to respond to a problem,
they click the Response tab and find everything then need to fill in right
there.
Anyhow, thanks for the response. I will go ahead and test to see if the
forms are open, and close them if they are. I expect they won't be used
very much, but it was a simple enough way to respond to the requests for a
way to see all of the information at once.
 
M

Marshall Barton

BruceM said:
The small forms are just a selection of fields, not all of the fields. The
data are contained in small text boxes with small font and scroll bars. It
is adequate for reference, but would be inconvenient for data entry. Also,
each of the four tabs is a separate section of the form: Problem
Description, Response, Follow-up, and Final Approval.
The three Problem Description fields are on the first tab; the seven
Response fields are on the second tab, and so forth. When filling out the
Follow-up it is sometimes convenient to see the preceding sections. By
having the data in pop-up forms the user can drag them around, or close them
if they are no longer needed (or not open them at all). If everything is on
one screen, divided into sections, the text boxes and other controls are
inconveniently small and difficult to read.
It all comes down to the appearance of the user interface. Since the people
using the database may do so only once or twice a year, it seemed best to
make it as clear as it could be. If somebody needs to respond to a problem,
they click the Response tab and find everything then need to fill in right
there.
Anyhow, thanks for the response. I will go ahead and test to see if the
forms are open, and close them if they are. I expect they won't be used
very much, but it was a simple enough way to respond to the requests for a
way to see all of the information at once.

Ahhh, now I see what you're doing and it makes sense.
 

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

Similar Threads


Top