Asked by:
Bookmark bug not resolved? (Access 2010)

Question
-
Is the bookmark bug considered "fixed"? .. because I'm experiencing it in Access 2010 and I've posted detailed info about it, and a sample application to demonstrate it (with a couple of workaround methods), here: http://www.atworksoftware.com/MicrosoftAccessBookmarkBug.phpWednesday, February 24, 2016 9:19 AM
All replies
-
Hi JezPerth,
Based on my understanding, the bookmark is for the position for the same recorderset2 object. However, from the sample you provide you were clone the recorderset2 object and set the bookmark for the different object.
The recommend way should bookmark the current record before you filter the data and if the data doesn't find we can use the bookmark to navigate the origin recorder.
Here is the sample code for your reference:
Public Sub FindItOnDataFormWithBookmarkBug(pFrm As Form, pFrmSub As Form, pcFldName As String, pvValue As Variant, pcTblName As String, pcDataName_Sing As String, pcErrMsg As String) 'USE: Variant of FindItOnDataForm, for dev test purposes only. This has no fixes for the bookmark bug. ' Find and display the specified record. If cannot find the record but it does ' exist, and a filter is set, give user the chance to clear the filter. ' If fail to display specified record return msg in pcErrMsg else "" to indicate ' success. Dim lRs As Recordset Dim llExists As Boolean Dim llRsOpened As Boolean Dim lnValueN_ToFind As Long Dim lvValueN_CurrentRecord As Variant Dim llRequery As Boolean pcErrMsg = "" llRsOpened = False On Error GoTo Error_FindIt lnValueN_ToFind = CLng(pvValue) 'If editing is underway If pFrm.FormEditing() Then lvValueN_CurrentRecord = pFrmSub(pcFldName) If DiffValue_VarAndLong(lvValueN_CurrentRecord, lnValueN_ToFind) Then pcErrMsg = "The specified " & pcDataName_Sing & " cannot be displayed at the moment because data on the " & pFrm.Caption & " form is being edited." End If 'If no ErrMsg it means that the required record is already current so, despite it being edited 'at present, the form can be displayed as if the record has just been found. Else 'Assume form is not opened in DataEntry mode and assume user has no way to enter it 'so no need to check/remove it. llRsOpened = True Set lRs = pFrmSub.RecordsetClone Dim varbookmark As Variant varbookmark = pFrmSub.Recordset.Bookmark pFrmSub.Recordset.FindFirst pcFldName & " = " & lnValueN_ToFind 'If did not find the specified record in the CURRENT VIEW (which may be filtered): If pFrmSub.Recordset.NoMatch Then pcErrMsg = "Failed to find the specified record in the current view." pFrmSub.Bookmark = varbookmark 'else, found it: Else 'pFrmSub.Bookmark = lRs.Bookmark 'pFrmSub.Bookmark = lRs.Bookmark End If If ZeroLen(pcErrMsg) Then 'Test for wrong record found due to bookmark bug. If pFrmSub(pcFldName) <> lnValueN_ToFind Then pcErrMsg = "Found wrong record. (Found " & pFrmSub(pcFldName) & " instead of " & lnValueN_ToFind & ")." End If End If End If AfterError_FindIt: If llRsOpened Then On Error Resume Next 'In case following does not exist lRs.Close End If On Error GoTo 0 Exit Sub Error_FindIt: pcErrMsg = ErrMsg("Failed to find the specified " & pcDataName_Sing) Resume AfterError_FindIt End Sub
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Marked as answer by Fei XueMicrosoft employee Friday, March 4, 2016 8:21 AM
- Unmarked as answer by Fei XueMicrosoft employee Thursday, March 10, 2016 8:28 AM
Friday, February 26, 2016 6:47 AM -
Fei, Thank you for your response, however it should not be marked as the answer because it has not addressed the issue of the MS Access "bookmark bug" and is appears to be incorrect.
You have copied a chunk of the code I provided (via the specified website link) and edited it to provide something which I think is fundamentally wrong. The RecordsetClone is a COPY of the form recordset, so if the sought record is not found in the RecordsetClone there is no need to set the form bookmark to anything.
The issue I posted on is related to the case of appearing to successfully find the sought record but then either: 1. the wrong record is displayed; or 2. if the displayed record is edited the edits get saved to the preceding record, not the displayed record.
The sample application provided demonstrates these issues - i.e. that there appears to be a bug in MS Access.
The way I have now got around it in the commercial applications my company produces is to initially open the form in Data Entry mode - and to then programmatically clear this when a find is performed.
Wednesday, March 9, 2016 6:19 AM -
Hi JezPerth,
Thanks for the detail explanation.
The solution in the preview post is bookmark the current recordset first and then searching using this reccordset. If failed then set the bookmark to that recrdeser to restore the state.
Since the issue is complex, I suggest you contacting Microsoft support to raise an incident so that our engineer could work closely with him to identify the root cause and resolve this issue as soon as possible.
If the support engineer determines that the issue is the result of a bug the service request will be a no-charge case and you won't be charged.Please visit the below link to see the various paid support options that are available to better meet your needs.
https://msdn.microsoft.com/subscriptions/bb266240.aspx
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Thursday, March 10, 2016 8:28 AM