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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 3159 Not a valid Bookmark 2

Status
Not open for further replies.

fileman1

Technical User
Feb 7, 2013
152
GB
I am getting a random warning Error 3159, Not a valid bookmark when I click on a list to select a record.

The form is a PopUp and the main form is bound to a table.

Code:
    Dim db As DAO.Database
    Dim MySql As String
    Dim rs1 As DAO.Recordset
    
    Set db = CurrentDb()
    Set rs1 = db.OpenRecordset("MAIN", dbOpenDynaset)

    rs1.MoveFirst
    rs1.FindFirst "ID1 =" & List0.Column(0) & ""
    PK1 = Me.List0.Column(0)
    Forms![Mainform].Bookmark = rs1.Bookmark

It's doing it occasionally on opening the database, making it difficult to step through. It gives the error on tha last line above.
 
Why not simply this ?
Code:
Forms![Mainform].Recordset.FindFirst "ID1=" & List0.Column(0)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Many thanks PHV. Another direct hit, hanks
 
And the reason your code did not work.

If you use the Clone method to create a copy of a Recordset object, the Bookmark property settings for the original and the duplicate Recordset objects are identical and can be used interchangeably. However, you can't use bookmarks from different Recordset objects interchangeably, even if they were created by using the same object or the same SQL statement.
 
Thanks for the explanation as to why it did not work, just wonder why it sometimes worked. Each time being a fresh opening of the database and going for the same record in the list.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top