Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide Forms

Status
Not open for further replies.

mgmslate

Technical User
Feb 18, 2002
24
0
0
US
I am drilling down through forms and only want the current form to be visible. In the command button on each form I am trying to call the following routine and I get a type mismatch.
What am I doing wrong.
Thanks
Mike
Public Sub formhide()
Dim frmcurrent As Form
Set frmcurrent = Screen.ActiveControl
Dim frm As Form
If frm.Name <> Forms!frmcurrent Then
For Each frm In Application.Forms
frm.Visible = False
Next frm
End If

End Sub
 
On your command button's OnClick event, why don't you just put

DoCmd.Close acform, &quot;form name that command button is on&quot;

Neil
 
I have a main customer form with buttons to open related forms
which the users go up and down like a ladder. I thought it would be better to hide the forms as they go up the ladder, then make them visible as they go back down rather than open and close the same forms constantly. Hope this makes sense.
Thanks
Mike
 
To hide the previous form try this

docmd.openform &quot;formname&quot;,acnormal,,,achidden

this will keep the form open and then hide it, you can then call the form by typing.

docmd.openform &quot;formname&quot;,acnormal

hope this is what you were lookin for Later.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top