Hi, folks. I made a label (named "RecordNumber") in a subform that's supposed to display the Current Record Number and the Record Count.
To do that, I put the following VBA code into the subform's On Current event:
Code:
Me.RecordNumber.Caption = "Case # " & CurrentRecord & " of " & RecordsetClone.RecordCount
When I open the subform on its own, it works just fine.
But when I open the main form with the subform in it, the label only displays "Case # 1 of 1", even though there are multiple cases. If I click on the next record button, though, the label correctly says "Case # 2 of 2". So, the problem is only happening when it loads.
I stepped through the code, and I found that, for some reason, when I load the main form, it fires the subform's On Current event 3 times. After it fires the first time, the label displays the correct caption: "Case # 1 of 2". But, after it fires the 2nd time, it incorrectly says "Case # 1 of 1". And the when it fires the 3rd time, it incorrectly says "Case # 1 of 1" again.
So, perhaps the solution is making sure the On Current event fires just once. The question is, how do I that? Or perhaps there's another solution? Please help! Many thanks.
Matt