Versions: 97 +
There are occasions when you will want to know, for example, if a given form is open. This can be quite easily done using SysCmd, a technique I quite often use to automatically close form A when closing B. In the example that follows SysCmd is used to check whether the frmSales form is open and, if so, closes it.
Private Sub Form_Close()
'Code sample from Accessory http://www22.brinkster.com/accessory
    'There are four states you can check for:
    'acObjStateOpen - open
    'acObjStateNew - new
    'acObjStateDirty - changed but not saved
    '0 (zero) - closed or non-existant
    If SysCmd(acSysCmdGetObjectState, acForm, "frmSales") = acObjStateOpen Then DoCmd.Close acForm, "frmSales"
End Sub


Site requires Javascript and IFRAME support.
Visitors:
© Accessory 2001-.
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 2.5 License.