docmd.close

T

Terri

What is happening withing Access 2002 that when I close a
form with Docmd.Close when I am going to another form,
then when I close the second form and try to return to
the first form, Access says it can't find the first
form. I do not like having a nest of forms open, it
causes too many problems for the users.

Thanks for any help you can give me!
 
T

Terri

Thanks hadn't thought of that, but I really want to close
these forms as they end up with up to 15 forms open.
I'll give it a try, but I really don't want all these
forms open at once.
Thanks
-----Original Message-----
Terri,
I use DoCmd.Minimize instead of DoCmd.Close because I
get a lot of error messages when I used DoCmd.Close.
Below is an example on how I use DoCmd.Minimize. I have
two forms, frm_Main and frm_Search when I click the
search button on frm_Search, it will minimize frm_Search
and open frm_Main (shown in the first private sub). When
I open frm_Search, access will close frm_Main (shown in
the second private sub). Hope this helps.
 
L

Lynn Trapp

Thanks hadn't thought of that, but I really want to close
these forms as they end up with up to 15 forms open.
I'll give it a try, but I really don't want all these
forms open at once.


Put some code like this in the Open event of the second form.

Private Sub Form_Open(Cancel As Integer)
DoCmd.OpenForm "frmYourForm", , , , , acHidden

End Sub

Then on the close event of your second form you can reverse the process.
 
L

Lynn Trapp

Terri,
Another, and probably better way to do it is to add this to the open event
of the second form.

Forms!frmYourForm.Visible = False

Then on the close event

Forms!frmYourForm.Visible = True
 
Top