Re: How do you compare bookmarks in DAO recordsets?



David Anderson wrote:

>Thanks for the help, Marshall. I've used the following code to implement your
>suggestion, and it works the first time I find that the form is already where
>I want to be. However, subsequent passes through the code, when a move IS
>required, still indicate (wrongly) that the form is already at the specified
>record. Is there perhaps something about bookmarks that I don't understand?
>
>Dim varBM1 As String
>Dim varBM2 As String
>
>varBM1 = Me.Bookmark
>varBM2 = rstFrames.Bookmark
>
>If Not varBM1 = varBM2 Then
> MsgBox "About to move to selected record"
> Me.Bookmark = rstFrames.Bookmark
>Else
> MsgBox "Subform already at required record"
>End If


As I understand what you're doing, the logic I would use is
something like:

With Me.RecordsetClone
.FindFirst . . .
If Not .NoMatch Then
If .Bookmark = Me.Bookmark Then
MsgBox "Already there"
Else
MsgBox "Moving"
Me.Bookmark = .Bookmark
End If
Else
MsgBox "Not found"
End If
End With

The check for NoMatch seems critical to me. If the search
is unsuccessful, the recordset's bookmark is kind of
unknown.

If none of that helps, then I think I need to see the rest
of your code.

--
Marsh
MVP [MS Access]
.



Relevant Pages

  • Re: User Form & ComboBox
    ... want to insert into a series of bookmarks, the data from the columns for the ... Dim strAAA As String ... number of bkmarks in the form. ...
    (microsoft.public.word.vba.general)
  • Need Help With Run-Time Errors
    ... I have the following code (Note the RecordNumber is alphanumeric, ... Dim BookmarkName As String ... ' Checks for the existance of the required bookmarks and document variables. ...
    (microsoft.public.word.vba.general)
  • Re: VBA User Forms
    ... to display the data entry - I've used the sub AddDocumentVariable() and then ... Dim txtDocVersion As String ... End Sub lines for this by choosing UserForm in the left-hand dropdown at the ... Although you can extract the values from the bookmarks in your current ...
    (microsoft.public.word.docmanagement)
  • Absolute positioning in a Word Document
    ... Several bookmarks occur on the same line, ... so substituting text for spaces will screw up the alignment despite my ... insertion point when actually used. ... The length of string "John Doe" in Times New Roman 9 point ...
    (microsoft.public.word.vba.beginners)