I have a form that we'll call frmParent for the sake of simplicity that has three sub-forms, each of which includes VBA which inspects fields on frmParent. The code under each sub-form works fine when they're are opened as sub-forms to frmParent, but when I run them as stand-alone forms (for debugging purposes only), the VBA throws an error. It's not a big deal, the end users aren't going to see the error, but it would be kind of nice to splice in a little piece of VBA on each sub-form that stipulates, "If you don't open as a sub-form to frmParent, then don't call the following code that looks for values on frmParent."
How do I pull this off? In other words, I need some VBA that determines if frmParent is currently present as a parent form or not present as a parent form. Alternatively, I need some code that recognizes if a form has opened in a stand-alone environment or a sub-form environment.