Closing forms

D

Derek Brown

Hi All

How do I close a form using a command button on another form only if the
form is open. When I click the button on the form to close the other form
when it's not open I get an error.

Any ideas?
 
A

Allen Browne

Assuming Access 2000 or later:

Dim strForm As String
strForm = "NameOfYourOtherFormHere"
If CurrentProject.AllForms(strForm).IsLoaded Then
DoCmd.Close acForm, strForm
End If
 
D

Derek Brown

Thanks Allen!! Straight to the point!

Would you beleieve I have a brother Named Alan Brown
 
Top