That exact code really makes no sense...if you only have one Record, why would you need to navigate to the last Record, then back to the first Record, which are actually one and the same?
Moving to the last Record then back to the first Record is commonly done when you're using a custom 'Record # x of y Records' hack. It forces Access to load the entire Record Source, which is not always done when first opening a Form...especially in cases where a huge number of records are present. This causes the real/correct number of Records to be displayed.
The problem is that doing this kind maneuver causes an error to pop (the error is
No Current Record, I believe), when there are no Records in the Record Source. The proper way around this would be
Code:
Private Sub Form_Load()
If Recordset.RecordCount > 0 Then
Recordset.MoveLast
Recordset.MoveFirst
End If
End Sub
Notice that the
If clause has changed. Only running
Recordset.MoveLast
Recordset.MoveFirst
if there was one Record, as stated above, would make no sense...you'd want it to run anytime there were Records present...hence the
If Recordset.RecordCount > 0 Then
If you don't have a custom 'Record # x of y Records' hack, I have no idea why the code would be present! Possibly it was germane in one Form that you've since copied and reused?
Linq
;0)>