bookmark not returned

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

Guest

My environment is access 2000 + dao 3.6. The following code, invoked in a
forms eventprocedure prints True ? ? . This is the case whichever record in
tabell I move to. Tabell is a Table without a primary key. How should I
access the correct bookmarks?

Private Sub Öppnaprovat_Click()
Dim tabell As Recordset
Set tabell = Me.Recordset
tabell.MoveFirst
Debug.Print tabell.Bookmarkable, tabell.Bookmark, Me.Bookmark
End Sub
 
The following code, invoked in a
forms eventprocedure prints True ? ? . This is the case whichever
record in tabell I move to.

The Bookmark property is cast as a string, but it's not necessarily
printable. The only thing you can sensibly do with a Bookmark is to compare
it with another bookmark from the same recordset. What are you actually
trying to _do_ with this code?

By the way, if it hasn't got a Primary Key, I don't think it's a table.

Best wishes


Tim F
 
A table in Access does not need a primary key. Nor can I find anything in the
Help documentation that requires this for the Bookmark Property to work.

I wish to view a record from a Bookmarkable Recordset (Table in Access
terminology) differently in different forms i.e. I wish to switch from one
form to another keeping the current record of the underlying table. I
understand that this can be done by using Find or Search (simplified by a
unique key) but I was trying to establish the correspondance through
Bookmarks claimed to be unique identifiers for records. The code shown is
simply to demonstrate that the string supposedly different for different
records does not print differently (actually it prints as ? followed by a
square). Is it really the case that this should be expected as you say? Also
the result remains the same if a primary key is added to the table.
 
OK. I am learning.. I now better understand the limitations of Bookmarks as
identifiers of records. It seems that they are local to the object instance.
 
A table in Access does not need a primary key. Nor can I find anything
in the Help documentation that requires this for the Bookmark Property
to work.

You can commit all kinds of things in Access that have no place in a
decent relational database schema -- but that doesn't mean it's sensible.
The long and short of it is that if it hasn't got a PK then it's not a
relation: that was true in the sixties and it's true now. We all know
that Access is not a true RDBMS and we all just live with its
shortcomings.

You are also correct that the presence or absence of a PK has nothing to
do with bookmarks. All I said about bookmarks is that they are not
necessarily printable (and generally aren't, in my experience).

You can always try this:

bookmarkString = myRecordset.BookMark
for i = 1 to Len(bookmarkString)
debug.print Hex$(Asc(Mid(bookmarkString, i,1)));
Next i
debug.print

Best wishes



Tim F
 
Back
Top