Re: How do you compare bookmarks in DAO recordsets?



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




"Marshall Barton" wrote:

> "David Anderson" <David Anderson@xxxxxxxxxxxxxxxxxxxxxxxxx>
> wrote:
>
> >I'm using fairly standard code in Access 2000 to move a form to a specific
> >record (see code fragment below). It all works fine, but other parts of my
> >coding depend on the bookmarking process triggering the Form_Current event -
> >something that does not happen if the form is already at the record being
> >requested (a situation that may occasionally happen).
> >
> >I would like to be able to test if the RecordsetClone bookmark is the same
> >as the form's bookmark but I haven't been able to find a method that works
> >for DAO recordsets. Can anyone help, please?
>
>
> A Bookmark is a string, just save it in a string variable
> and compare that to the RecordsetClone's Bookmark.
>
> --
> Marsh
> MVP [MS Access]
>
.



Relevant Pages

  • Re: Checkbox to delete text field
    ... The only way I can get it to work is if I leave the checkbox unchecked, ... Dim NewTxt As String ... Dim FFld As FormField ... It is inadvisable to use 'Text1' as a document bookmark name when working with vba and formfields since, ...
    (microsoft.public.word.vba.general)
  • Re: Checkbox to delete text field
    ... You could bookmark the text to link it to its CB ... Dim pStrTest As String ... 'Clean up the string text. ... Dim FFld As FormField ...
    (microsoft.public.word.vba.general)
  • Re: Checkbox to delete text field
    ... paragraph in this code? ... Dim pStrTest As String, oFF As FormField ... The other thing to be aware of is that, if the last bookmark has any ...
    (microsoft.public.word.vba.general)
  • Re: Checkbox to delete text field
    ... Dim NewTxt As String ... It is inadvisable to use 'Text1' as a document bookmark name when working with vba and formfields since, ...
    (microsoft.public.word.vba.general)
  • Re: Checkbox to delete text field
    ... While all the checkboxes are in the same paragraph, ... Dim pStrTest As String, oFF As FormField ... You could bookmark the text to link it to its CB ...
    (microsoft.public.word.vba.general)

Loading