Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bookmark error on datasheet search

Status
Not open for further replies.

projecttoday

Programmer
Feb 28, 2004
208
US
I have a single-record form with a datasheet subform of the entire table in the footer per the user's request. When the user clicks on a record on the datasheet, the single record goes to that record. It is accomplished with the code below in the on-click event of the datasheet subform. The problem is that it doesn't work after sorting the datasheet. I get an invalid bookmark error.

Private Sub Form_Click()

Dim num1 As Integer
num1 = [id]

Dim rs As Object
Set rs = Me.RecordsetClone
rs.FindFirst "[id] = " & num1
If Not rs.EOF Then
Forms.frmattendanceupdate.Bookmark = rs.Bookmark 'Error on this statement: invalid bookmark
End If
Set rs = Nothing

End Sub

Can anyone suggest a way so that this record search will work after the datasheet has been sorted.
 
You may try this:
Code:
Private Sub Form_Click()
Forms!frmattendanceupdate.Recordset.FindFirst "id=" & Me!id
End Sub

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top