Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Closing a record on a subform (Access 2003 )

    Attached is a really rough db. I used this just as an example.
    I have a close button on the subform pndata_frm. I have the button so it closes the record and then moves to the next record. The code used for this works ok if the user closes say record 1 then record 2 in order. But if they skip to say record 10 and close it, and don't close any of the records prior, it jumps back to record 2. Not sure why this is happening. Do I have this wrong? Or is there another way to do this? When you open the form open PNData_tbl. Thanks..
    Code:
    Me.Parent.RecordsetClone.MoveNext
    Me.Parent.Bookmark = Me.Parent.RecordsetClone.Bookmark

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

    Re: Closing a record on a subform (Access 2003 )

    I don't understand your setup. Why do you have a main form and subform bound to the same table? Wouldn't it be easier to put everything on the main form? That would get rid of the problem too, I think.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Closing a record on a subform (Access 2003 )

    Your right this setup is awful. I just used this as an example. I use 2 different tables in the live db. The behavior is the same in the live db.

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

    Re: Closing a record on a subform (Access 2003 )

    You don't set the bookmark of the recordsetclone to that of the form, so all your code does is move one record forward from where your code last left it, not from where the form currently is.

    You could use

    With Me.Parent
    .RecordsetClone.Bookmark = .Bookmark
    .RecordsetClone.MoveNext
    .Bookmark = .RecordsetClone.Bookmark
    End With

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Closing a record on a subform (Access 2003 )

    Thanks again Hans..

Posting Permissions

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