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

.seek method and bookmarks

Status
Not open for further replies.

EKelly

Programmer
Jul 3, 2002
49
IE
Hi guys,

I have searched previous strings but i can't seem to find the answer i'm looking for. I'm sure its something simple though.

I am implementing a multi user version of our current application. In short i use the .seek method of DAO to find specific records. When i find the record i am looking for i want to save the bookmark value of that record. However when i assign the bookmark value to a variable all i get as a value is a square box symbol!? Here is the code

Code:
entys.Index = "entity"
entys.Seek "=", value

'this records bookmark to be locked
lockUser = LockDbRecord(entys.bookmark, "entys")
If lockUser <> "Lock" Then
    MsgBox "Locked", vbOKOnly
    Unload Me
    Exit Sub
End If


the LockDbRecord function simply writes a record to a lock table with the name of the table the bookmark is from and the bookmark value. The written record is useless however as the bookmark value i get is not correct.

I have two questions. Can bookmarks be used with the .seek method. I have read posts were people refer to populating records by doing a movefirst and movelast. However my recordset is just one record as it is created by a .seek.

Also i have seen code that refers to a recordset by using the keyword Me.bookmark. However when i try to do this the keyword Me is seen as refering to the current form and not the current recordset.

This is driving me crazy so any help would be very appriciated

Erin
 
Hi,

I don't know why you are saving a bookmark to a table. To quote from Access Help.

'Bookmarks are not saved with the records they represent and are only valid while the form is open. They are re-created by Microsoft Access each time a bound form is opened.'

Bookmarks are really just for temporary use, in other words.
 
To quote D.A.O. help

Bookmark
A property of the Recordset object that contains a binary string identifying the current record. If you assign the Bookmark value to a variable and then move to another record, you can make the earlier record current again by setting the Bookmark property to that string variable.

According to DAO you can use bookmarks to achieve what I am trying to do. It does say that some databases don't support bookmarks but that you can check the bookmarkable property of the recordset and if it is true then bookmarks are supported. I have checked with the access recordset and it says they are.

Any ideas?
 
Hi,

As a bookmark is a binary string, it is quite possible it may appear as a square box symbol. Binary strings can contain non-printable characters.

I am still wondering why you are writing a bookmark to a table?

It seems to me you are trying to uniquely identify a record to lock. You could try doing this by using a Primary Key field rather than trying to manipulate a bookmark value.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top