If you open the form Modally - then you wont even be able to press the command button
VB Code:
Dim oForm as New frmX
oForm.ShowDialog()
However, if you don't want the form to be displayed modally, then you could just set a module level variable whenever the form is opened.
If you do this though you would need a property in the new form (frmX) that holds the object reference of the parent form, and a property in the parent form that allows the module variable to be reset when the form is closed...
Have I made sense or just confused?
VB Code:
Dim oForm as New frmX
mbooFormShowing = True
oForm.ParentForm = Me 'ParentForm defined as a public property of frmX
oForm.Show
Then in frmX - when it closes/is disposed...
VB Code:
Me.ParentForm.FormShowing = False 'Property in the parent Form that updates mbooFormShowing