FindFirst - Top of SubForm?

wrightyrx7

Registered User.
Local time
Today, 16:19
Joined
Sep 4, 2014
Messages
104
Hi all,

Users open a record from 1 of 2 SubForms (sForm_DetailsOpen/sForm_DetailsClosed). They click the ID and it opens the data in another form.

When they Save and Close the record I use the below code to Requery the Subform and to go back to the record that was selected before the requery.

The 2 SubForms are on two different Tabs/Pages (Open/Closed)

When a record is opened I store the name of the SubForm used in a textbox, so that i know which SubForm to requery after Save and Close is pressed.

Anyway, i use the code below which works fine but the FindFirst leaves the selected record at the bottom of the SubForm, is there anyway to bring it to the top of the SubFrom.

Code:
Public Sub RequeryOrRefresh()
Dim RecId As Integer

Select Case Forms![frm_MAIN].tbTabName
    Case "sForm_DetailsOpen"
                RecId = [Forms]![frm_MAIN]!sForm_DetailsOpen.Form.CaseID
                [Forms]![frm_MAIN]!sForm_DetailsOpen.Form.Requery
                    With [Forms]![frm_MAIN]!sForm_DetailsOpen.Form.RecordsetClone
                    .FindFirst "CaseID" & "=" & RecId
                    [Forms]![frm_MAIN]!sForm_DetailsOpen.Form.Bookmark = .Bookmark
                    [Forms]![frm_MAIN]!sForm_DetailsOpen.Form.RecordsetClone.Close
                    End With
    Case "sForm_DetailsClosed"
                RecId = [Forms]![frm_MAIN]!sForm_DetailsClosed.Form.CaseID
                [Forms]![frm_MAIN]!sForm_DetailsClosed.Form.Requery
                    With [Forms]![frm_MAIN]!sForm_DetailsClosed.Form.RecordsetClone
                    .FindFirst "CaseID" & "=" & RecId
                    [Forms]![frm_MAIN]!sForm_DetailsClosed.Form.Bookmark = .Bookmark
                    [Forms]![frm_MAIN]!sForm_DetailsClosed.Form.RecordsetClone.Close
                    End With
End Select

End Sub
 

Users who are viewing this thread

Back
Top Bottom