Not Valid Bookmark Error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

when I run the following code:

Dim db As Database
Dim rs As Recordset
Dim rs1 As Recordset
Dim strsql1 As String
Dim qry As QueryDef
Dim str2 As String


Set db = CurrentDb
Set qry = db.QueryDefs("QryEducatorLogistics")
Set rs = qry.OpenRecordset(dbOpenDynaset)
rs.FindFirst "[REVIEW_COURSE]= '" & Me![Combo47] & "' "
str2 = Me.REVIEW_COURSE
If rs.NoMatch Then
MsgBox "No Entry Found.", vbInformation
Else
Me.Bookmark = rs.Bookmark= rs.Bookmark
End If

I receive an "Not a Valid Bookmark". Even when I change "Me.Bookmark" to
"Forms!FrmEducatorInformationMain!FrmEducatorLogistics.form.Bookmark" I get
an "Object does not support this property" error

the criteria is coming from an unbound combo box thats located on the same
subform as the data that I'm attempting to search.

PS, the subform is located on a tab control

Thanks for your help
 
Hi Elyse

Bookmarks are only valid in the same recordset, or a clone of it.

I assume that the recordsource of your subform is the query
QryEducatorLogistics? Even so, bookmarks will not be transferrable between
a recordset based on the query and a form based on the query, because those
recordsets are not identical.

The trick is to use the form's RecordsetClone property:

With Me.RecordsetClone
.FindFirst "[REVIEW_COURSE]= '" & Me![Combo47] & "' "
If .NoMatch Then
MsgBox "No Entry Found.", vbInformation
Else
Me.Bookmark = .Bookmark
End If
End With
 
Back
Top