Originally Posted by
Minty
The Form_xx version will create an new instance of the form if I remember correctly. (I didn't know this it was pointed out to me in a thread on another forum here:
https://www.access-programmers.co.uk...9/post-1747913)
Also, assuming your code is in the parent form, if you were to refer to the subform container form the Main form using
Me.MySubformControl.Form .... It would always be referencing the correct instance.
Yes, that seems to be what was happening. Thank you for the link - this is something new to me and I need to read up on it thoroughly.
I set the object variables with this in the Load event of the parent form:
Code:
Set gbl_frmAkces = Me
Set gbl_frmPodrobnosti = gbl_frmAkces.sfPodrobnosti.Form
Seems to be working, mostly, except that I just ran into another oddity Not sure if it's the same issue, although the symptoms are the same.
In the subform, I have this, which again bombs.
Code:
If Recordset.RecordCount = 0 Then Stop
Changing it to this does not help:
Code:
If gbl_frmPodrobnosti.Recordset.RecordCount = 0 Then Stop
I had to again change it to use the clone
Code:
If RecordsetClone.RecordCount = 0 Then Stop
or
Code:
If gbl_frmPodrobnosti.RecordsetClone.RecordCount = 0 Then Stop
And if that wasn't enough, neither of these works.
Code:
If Forms("Podrobnosti").Recordset.RecordCount = 0 Then Stop
If Forms("Podrobnosti").RecordsetClone.RecordCount = 0 Then Stop