Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Delta, Br. Columbia
    Posts
    116
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Bookmark problems (2000/XP/2003)

    I am using Bookmarks in a continuous sub-form. When the user enters the sub-form for the first time he is able to move through about 3-4 master records (form level) making changes to a number of fields in records in the sub-form. After each change a recalculation has to take place that affects the entire form/sub-forms. On the 4th or 5th record to change, even though he is performing the same action he gets an error #3021 Record Not Found.

    The Bookmark is set at the beginning of the AfterUpdate event; the event then does some calculations and finally returns to the bookmarked record. The error occurs in setting the Bookmark.

    What am I doing wrong??

    The following is a sample of one of the AfterUpdate events:

    Dim varBookmark As Variant
    Dim rstPlanning_Data As DAO.Recordset
    Dim dbsPlantAdmin As DAO.Database


    'Set current record bookmark
    Set dbsPlantAdmin = CurrentDb
    Set rstPlanning_Data = Me.Recordset
    varBookmark = rstPlanning_Data.Bookmark '*****Error occurs here*****
    Me.PL_Reqd = Me.PL_1Gal_Reqd + Me.PL_2Gal_Reqd + Me.PL_Bron_Reqd + Me.PL_Early_Reqd + Me.PL_Future_Reqd + Me.PL_PanAm1_Reqd + Me.PL_PanAm2_Reqd + Me.PL_Shorts_Reqd + Me.PL_Star_Reqd
    Me.PL_to_Take = TottoTake(Me.IN_LEFT, Me.PL_Reqd, Forms!frmPlanning_Master!Cutpercent)
    'Recalculate main form
    Forms!frmPlanning_Master.Recalc
    'Return to current record
    Forms!frmPlanning_Master!subPlanning_Subform_Data. SetFocus
    rstPlanning_Data.Bookmark = varBookmark
    Forms!frmPlanning_Master!subPlanning_Subform_Data! PL_Shorts_Reqd.SetFocus

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Bookmark problems (2000/XP/2003)

    As far as I can tell, you're not moving to another record, so there doesn't seem to be any need to set bookmarks. What am I missing?

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Bookmark problems (2000/XP/2003)

    You are first doing ths: Set rstPlanning_Data = Me.Recordset

    I'm not 100% sure that rstPlanning_Data inherits the bookmark from Me. You might want to do this immediately after the above:
    rstPlanning_Data.bookmark = me.recordset.bookmark
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Delta, Br. Columbia
    Posts
    116
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Bookmark problems (2000/XP/2003)

    Thank you Mark and Hans for your replies.

    Hans first:

    The line of code

    Forms!frmPlanning_Master.Recalc

    automatically puts the cursor back at the form level rather than the record in the subform from which the recalc was executed.

    Mark: I tried your suggestion but the same problem occurred.

    However after thinking about what Hans wrote I have change the requery to a refresh and no longer need the bookmarks so the problem has gone away. I am still curious as to why I was getting the error

    Peter

  5. #5
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bookmark problems (2000/XP/2003)

    I vaguely remember something about recordset clones and bookmarks becoming invalid when you requery a form.
    I am not able to research it further at present but it might spark a memory in someone out there.
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Bookmark problems (2000/XP/2003)

    It's probably a timing problem. The interaction between a main form and a subform is complicated and confusing - when you requery the main form, the subform is probably requeried several times, and at one stage, it may not have any records. That would cause the error message you mentioned.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •