close form

  • Thread starter Thread starter Sam
  • Start date Start date
S

Sam

Hi All,

On closing my form i have coded the on close event to 'show' the
previous form that was hidden upon opening this current form. this
works fine allowing me to keep the screen tidy. Unfortunately where i
fall over, is that the code 'shows' the previous form... but will not
then close the current form. code is as follows:

Private Sub cmdCloseForm_Click()
On Error GoTo Err_cmdCloseForm_Click

'show form
Forms![frmPerson].Visible = True

DoCmd.Close acForm, [frmEqualOpportunities]

Exit_cmdCloseForm_Click:
Exit Sub

Err_cmdCloseForm_Click:
MsgBox Err.Description
Resume Exit_cmdCloseForm_Click

End Sub


I am wondering if i have to fully declare the form i am closeing?

can anyone lend a hand to a novice : ) ?

Many thanks,
Sam
 
Sam said:
Hi All,

On closing my form i have coded the on close event to 'show' the
previous form that was hidden upon opening this current form. this
works fine allowing me to keep the screen tidy. Unfortunately where i
fall over, is that the code 'shows' the previous form... but will not
then close the current form. code is as follows:

Try this in your button's Click event:

DoCmd.Close acForm, Me.Name

and this in the form's Close event:

Forms("frmPerson").Visible = True

That way it will make the other form visible if the second form is closed
using a method other than your "close" button.

HTH - Keith.
www.keithwilby.com
 
Back
Top