close form

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
 
K

Keith W

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
 

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

Top