I want to be able to move to record in another while working on the current
form. The current form has the identical recordset. I'm trying the code
below but I get an invalid book mark error.
****************code starts here********************
***************************************************************
where msFrmName is a variable holding the name of the calling form. I want
to be able to move to this record in the calling form but I'm having
difficulty as I get an invalid bookmark (the form is open). Does anyone
know why I get this message and/or how to move to a specific in another form
based on current record in this form.
Thanks,
Rewdee
form. The current form has the identical recordset. I'm trying the code
below but I get an invalid book mark error.
****************code starts here********************
Code:
Public Function GotoData(sFieldName As String, rs As DAO.Recordset,
sValueToCheck As String) As Boolean
Dim sSearchPart As String
Dim rsClone As DAO.Recordset
On Error GoTo errHandler
'iterate through recordset until we find a match
Set rsClone = rs
With rsClone
If Not (.BOF And .EOF) Then .MoveLast
If .RecordCount = 0 Then Exit Function
.MoveFirst
Do While Not .EOF
'watch for blanks
If Not IsNull(.Fields(sFieldName)) Then
'search for match of only the amount typed in
sSearchPart = Left$(.Fields(sFieldName), Len(sValueToCheck))
If LCase(sValueToCheck) = LCase(sSearchPart) Then
rs.Bookmark = rsClone.Bookmark
Forms(msFrmName).Bookmark = rsClone.Bookmark
'**Error Invalid Bookmark here**
GotoData = True
Exit Function
End If
End If
.MoveNext
Loop
End With
errHandler:
Exit Function
where msFrmName is a variable holding the name of the calling form. I want
to be able to move to this record in the calling form but I'm having
difficulty as I get an invalid bookmark (the form is open). Does anyone
know why I get this message and/or how to move to a specific in another form
based on current record in this form.
Thanks,
Rewdee