Need to close mulitple forms

I

Iram

Hello,
I need help writing code to close two forms at the click of a button. I have
the below code but it keeps erroring out.
I want to close a form called "frm_AddtlToolsCasesUIBAll" and the current
form that I am on/the form that has the button to close both forms.

How should I rewrite this?

Private Sub Command87_Click()
Dim frm_theOtherForm As Form

Set frm_theOtherForm = Forms![frm_AddtlToolsCasesUIBAll].Form
frm_theOtherForm.Close
Set frm_theOtherForm = Nothing

DoCmd.Close

End Sub


Your help is greatly appreciated.

Thanks.
Iram
 
D

Douglas J. Steele

Setting a reference to the form isn't what you want.

All you need is

Private Sub Command87_Click()

DoCmd.Close acForm, "frm_AddtlToolsCasesUIBAll"
DoCmd.Close acForm, Me.Name

End Sub
 
L

Linq Adams via AccessMonster.com

Not sure what's causing your problem, but I think you're over complicating
this. This should work just fine:

Private Sub Command87_Click()
DoCmd.Close acForm, "frm_AddtlToolsCasesUIBAll"
DoCmd.Close
End Sub
 

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