BUG: Bookmark for Unbound DBGrid is Incorrect for the Last RowLast reviewed: November 10, 1997Article ID: Q176486 |
The information in this article applies to:
SYMPTOMSThe Bookmark property of the DBGrid control can be used to save a reference to the current row. By setting the Bookmark property, the current row can be updated as well. If the Bookmark property of an unbound DBGrid control is saved while the last row is selected, setting the Bookmark property back to the saved value will update the current row to be the first row, rather than the last.
RESOLUTIONAs a workaround, use the RowBookmark method of the DBGrid control when saving the Bookmark of the current row:
Private MyBookmark Private Sub cmdSaveBookmark_Click() MyBookmark = DBGrid1.RowBookmark(DBGrid1.Row) End SubAlso, the following error handling code will need to be included when updating the current row:
Private Sub cmdRestoreBookmark_Click() On Error GoTo err_handler DBGrid1.Bookmark = MyBookmark Exit Sub err_handler: Dim r If Err.Number = 6149 Then For r = 0 To DBGrid1.VisibleRows - 1 DBGrid1.Row = r Next r Resume Else Err.Raise Err.Number End If End SubThe above error handling code is necessary because the bug associated with the Bookmark property for the last row will also cause run-time error 6149.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Steps to Reproduce Behavior
Keywords : vb5all VBKBAX VBKBComp VBKBCtrl VBKBDB VBKBStd Version : WINDOWS:5.0 Platform : WINDOWS Issue type : kbbug |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |