Re: Close form from command button

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Slow Learner (SlowLearner_at_discussions.microsoft.com)
Date: 12/15/04


Date: Wed, 15 Dec 2004 12:11:05 -0800

Thank you now working.

"Marshall Barton" wrote:

> Slow Learner wrote:
>
> >Access 2002 with Win 2000
> >Have a form, named party, with a command button and an onclick event to take
> >a person back to the switchboard form with this code:
> >Private Sub cmdswitch_Click()
> >On Error GoTo Err_Command1_Click
> >
> > Dim stDocName As String
> > Dim stLinkCriteria As String
> >
> > stDocName = "Main SwitchBoard"
> > DoCmd.OpenForm stDocName, , , stLinkCriteria
> >
> >Exit_Command1_Click:
> > Exit Sub
> >
> >Err_Command1_Click:
> > MsgBox Err.Description
> > Resume Exit_Command1_Click
> >End Sub
> >
> >Clicking the command button does open the switchboard but I also would like
> >the Party Form to close when this happens. Can someone assist on how to do
> >this?
>
> Add this line after the DoCmd.OpenForm ... line
>
> DoCmd.Close acForm, Me.Name, acSaveNo
>
> --
> Marsh
> MVP [MS Access]
>


Quantcast