I've run into something strange with a mainform/subform situation, where everything behaves as desired if the main form is opened from design view. But if I close it, and double click it in the navigation pane, it doesn't work right. If I then put a breakpoint at various places, it does work right. After lots of futzing around, I can focus to the nut of the problem with the following fragment:
Code:
..................
Set rst = Me!sbfShotList.Form.RecordsetClone
With rst
Debug.Print .RecordCount
.MoveLast
Debug.Print .RecordCount
....................
This code is from the AfterUpdate event of an unbound combobox (which is used to filter the subform), but is called from the onload event of the main form. It is not relevant to the actual desired functionality, but used here to illustrate the problem. If the form is loaded from design view, both print statements give the same (>0) number. But if loaded fresh, the first number is zero and the .movelast statement triggers a 3021 error (empty recordset). If I then press F8, the program moves on, and there is no more error and the second print statement gives the proper value for the full complement of records in the recordset.
So it appears something keeps the recordset from filling fast enough to keep up with the code when the form is first loaded, but not thereafter. FWIW, there are only 29 records in the entire (unfiltered) subform recordset. I thought it might have something to do with some conditional formatting I have built into the form controls, but removing the formatting makes no difference.
Any ideas? Is there some global setting I've missed?
Thx, Ron