Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

FindRecord

I am a new learner in Access 2003 and have found myself stuck on a very simple act. I am trying to find records in a datasheet which is a subform (subfrmCompaniesList) of the form (frmCompaniesList). A command button open on the form (frmCompaniesList) OpenForm "frmFindCompany" where you enter the company to find.

This work interms of finding the record but I don't know how to move the bookmark (record pointer) in the subform (subfrmCompaniesList).

Private Sub cmdFind_Click()
Dim rs As Object
Set rs = Me.Recordset.Clone

rs.FindFirst "[Name] Like '" & Me![txtCoName] & "*'"
If rs.NoMatch Then
MsgBox Me![txtCoName] & " not found"
Else
Me.Bookmark = rs.Bookmark

Forms!frmCompaniesList!subfrmCompaniesList!Name.SetFocus
End If
End Sub

I am basically trying to achive a similar effect you get with this!!Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Please help!!!
[1073 byte] By [LeKool] at [2007-11-11 7:53:26]