Daniel,
If you change the way you think about opening forms you can do it reliably.
Instead of using Docmd you set a module level variable code page for the
'parent' form of the type of the child form. Say the child form is called
frmChildForm this would look like the following;
Private frmChildForm As Form_frmChildForm
Where you would use Docmd you can now use;
Set frmChildForm=New Form_frmChildForm
frmChildForm.Show
This is actually opening an instance of the form rather than the form itself.
To get a link back to the parent you need to add some more code however. In
the child forms code module;
Private frmParentForm As Form
Public Property Get ParentForm() As Form
Set ParentForm = frmParentForm
End Property
Public Property Set ParentForm(frmNewValue As Form)
Set frmParentForm = frmNewValue
End Property
To establish a link between parent & child you would need to change the code
mentioned before on the parent form;
Set frmChildForm=New Form_frmChildForm
Set frmChildForm.ParentForm=Me
frmChildForm.Show
You can now access all properties/methods/controls on the parent form from
the child form reliably & 'know' who your parent is. To close the child form
you actually end up creating a method on the parent that you call from the
child ... it is quite different but a lot more powerful than Docmd (in my
opinion).
I think I have a toy solution using his knocking about if you are interested
- dig my email out of my details & drop me a line.
Regards,
Chris.