In the student information management system, the bookmark function (mybookmark) is often used for information modification ). It plays an important role in deleting records. Therefore, Bookmarks have the best understanding of your heart.
As the name implies, bookmarks are marked to allow us to better control data tables, through bookmarks, we can jump to the record we want to see at Will (provided that you mark the record for your purpose ), in addition, Bookmarks can also be used to determine whether there are null records under the current cursor (for empty records, mybookmark will return 0)
The following example shows how to delete a record in the student information management system to describe the usefulness of bookmarks:
[Html]
<Span style = "font-size: 18px;"> Private sub deletecommand_click ()
Mybook = mrc. bookmark' tag the current record
Str = msgbox "are you sure you want to delete the current record", vbokcancel, "prompt"
If str = vbokthen
Mrc. movenext
If mrc. eof then ', the record to be deleted must be the last one (not sure If it is the first one)
Mrc. movefirst
Mybookmark = mrc. bookmark' label the first entry
Mrc. movelast
Mrc. delete
Mrc. bookmark = mybookmark 'display the record back to the previously defined bookmarks
If mybookmark = 0 then', you give the tag to the first record, but the first record is empty (the record to be deleted must be a unique record)
</Span> <span style = "font-size: 18px;">
Msgbox "you will delete the last record", "prompt"
Exit sub
End if
Call viewData
Else' the record to be deleted is not the last record
Mybookmark = mrc. bookmark' label mrc. movenext
Mrc. moveprevious 'back to the record to be deleted
Mrc. delete
Mrc. bookmark = mybookmark 'display the record back to the previously defined bookmarks
Call viewData
End if
Else' cancel deleting record
Mrcbookmark = mybookmark' show the position of the newly defined bookmark in the record
Call viewData
End if
End sub
</Span>
So why didn't we define bookmarks when using cursors to view records? In fact, this is really not the case. When we view records, the cursor points to the bookmarks without defining bookmarks.
This is what I know about bookmarks. If there is something wrong, I hope to help me correct it.