hide inactive forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have built a basic database that has several 'menu' forms that are reached
from a main menu. This is working well with one exception: it looks really
busy (and confusing to non-computer literate users) when you open a form and
the previous form is still there. Granted, the previous form is behind the
active form and unless it is accidentally clicked on there is no problem.

In order to prevent the clutter, I would like to make the menu forms become
'hidden' when they lose the focus and remain hidden until the user exits to
the previous menu. I only want the form/menu that currently has the focus to
be visible.

TIA,
Ruth
 
You can set the visible property of the form to false, which will hide the
form.

Then when you close the called form, set the first form's visible property
to true.

If your FormB is always opened from FormA then that is all you need to do.
If FormB can be called from FormA or FormD or FormC then you will need to
pass the calling form's name to the called form using the openargs argument.

Simple case:
Code in Calling form
DoCmd.OpenForm "FormB"
Me.Visible = False


In FormB's closing event
DoCmd.Close acForm, Me.Name
Forms!FormA.Visible = True

More complex case

DoCmd.OpenForm "FormB",,,,,,Me.Name
Me.Visible = False

In FormB's closing event
Forms(me.openargs).Visible = True
DoCmd.Close acForm, Me.Name
 
Ok... I am going to try to understand this programming stuff, but I will need
a little help. Here is a basic description of how my forms are set up:

FormA has 5 forms that open from it: FormA1, FormA2, FormA3, FormA4, FormA5

Each of the forms opening from form a have 2 options - open form to edit or
open to add information. So - FormA > FormA1> FormA1-1 or FormA1-2

When I open FormA1, I want FormA to hide. When I open FormA1-1 or FormA1-2,
I want FormA1 to hide as well.

Each form except the first (FormA) has an option to 'return to previous
menu' command button that closes the form. How does this scheme relate to
your code?

TIA,
Ruth
 
What do you want to happen when you close form A1-2 (or A1-1)? Do you want
to show form A1? Or do you want to show FormA?

Button on FormA opens Form A1
Private Sub btnOpenA1_Click()
DoCmd.OpenForm "A1"
Me.Visible = False 'Hides formA
end sub


In the close event of Form A1.
Private Sub Form_Close()
Forms![A].Visible = True
End Sub

Button on FormA1 opens A1-2
DoCmd.OpenForm "A1-2"
Me.Visible = False

In the Close event of form A1-2
Private Sub Form_Close()
Forms![A1].Visible = True
End Sub
 
When I close one form, I want to show the previous form:

FormA1-1 > FormA1 > FormA

John Spencer said:
What do you want to happen when you close form A1-2 (or A1-1)? Do you want
to show form A1? Or do you want to show FormA?

Button on FormA opens Form A1
Private Sub btnOpenA1_Click()
DoCmd.OpenForm "A1"
Me.Visible = False 'Hides formA
end sub


In the close event of Form A1.
Private Sub Form_Close()
Forms![A].Visible = True
End Sub

Button on FormA1 opens A1-2
DoCmd.OpenForm "A1-2"
Me.Visible = False

In the Close event of form A1-2
Private Sub Form_Close()
Forms![A1].Visible = True
End Sub




iamrdbrown said:
Ok... I am going to try to understand this programming stuff, but I will
need
a little help. Here is a basic description of how my forms are set up:

FormA has 5 forms that open from it: FormA1, FormA2, FormA3, FormA4,
FormA5

Each of the forms opening from form a have 2 options - open form to edit
or
open to add information. So - FormA > FormA1> FormA1-1 or FormA1-2

When I open FormA1, I want FormA to hide. When I open FormA1-1 or
FormA1-2,
I want FormA1 to hide as well.

Each form except the first (FormA) has an option to 'return to previous
menu' command button that closes the form. How does this scheme relate to
your code?

TIA,
Ruth
 
Try playing with the suggested code. It should work for you.


iamrdbrown said:
When I close one form, I want to show the previous form:

FormA1-1 > FormA1 > FormA

John Spencer said:
What do you want to happen when you close form A1-2 (or A1-1)? Do you
want
to show form A1? Or do you want to show FormA?

Button on FormA opens Form A1
Private Sub btnOpenA1_Click()
DoCmd.OpenForm "A1"
Me.Visible = False 'Hides formA
end sub


In the close event of Form A1.
Private Sub Form_Close()
Forms![A].Visible = True
End Sub

Button on FormA1 opens A1-2
DoCmd.OpenForm "A1-2"
Me.Visible = False

In the Close event of form A1-2
Private Sub Form_Close()
Forms![A1].Visible = True
End Sub




iamrdbrown said:
Ok... I am going to try to understand this programming stuff, but I
will
need
a little help. Here is a basic description of how my forms are set up:

FormA has 5 forms that open from it: FormA1, FormA2, FormA3, FormA4,
FormA5

Each of the forms opening from form a have 2 options - open form to
edit
or
open to add information. So - FormA > FormA1> FormA1-1 or FormA1-2

When I open FormA1, I want FormA to hide. When I open FormA1-1 or
FormA1-2,
I want FormA1 to hide as well.

Each form except the first (FormA) has an option to 'return to previous
menu' command button that closes the form. How does this scheme relate
to
your code?

TIA,
Ruth


:

You can set the visible property of the form to false, which will hide
the
form.

Then when you close the called form, set the first form's visible
property
to true.

If your FormB is always opened from FormA then that is all you need to
do.
If FormB can be called from FormA or FormD or FormC then you will need
to
pass the calling form's name to the called form using the openargs
argument.

Simple case:
Code in Calling form
DoCmd.OpenForm "FormB"
Me.Visible = False


In FormB's closing event
DoCmd.Close acForm, Me.Name
Forms!FormA.Visible = True

More complex case

DoCmd.OpenForm "FormB",,,,,,Me.Name
Me.Visible = False

In FormB's closing event
Forms(me.openargs).Visible = True
DoCmd.Close acForm, Me.Name

I have built a basic database that has several 'menu' forms that are
reached
from a main menu. This is working well with one exception: it
looks
really
busy (and confusing to non-computer literate users) when you open a
form
and
the previous form is still there. Granted, the previous form is
behind
the
active form and unless it is accidentally clicked on there is no
problem.

In order to prevent the clutter, I would like to make the menu forms
become
'hidden' when they lose the focus and remain hidden until the user
exits
to
the previous menu. I only want the form/menu that currently has the
focus
to
be visible.

TIA,
Ruth
 

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

Back
Top