I've got a form that with a subdatasheet that gets requeried on the close event of a form that gets opened from the subdatasheet. As you know, the requery caused the current record to go back to record 1. To keep the current record the same as the current record before the requery, I've tried to record the record number and use GoToRecord to return.
I'm getting the error: "The object 'Forms![frmFilteredUnitSchedule].[subUnitSchedule]' isn't open." Does anyone have any ideas about how I can restore the current record?
Private Sub Form_Close()
Dim lngRecordNumber As Long
Dim strForm As String
intRecordNumber = Forms![frmFilteredUnitSchedule].[subUnitSchedule].[Form].CurrentRecord
strForm = "Forms![frmFilteredUnitSchedule].[frmUnitSchedule]"
DoCmd.GoToRecord acDataForm, strForm, acGoTo, intRecordNumber