Results 1 to 3 of 3

Thread: BookMarks

  1. #1
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941

    Unanswered: BookMarks

    I'm having trouble using a bookmark to move to a record.

    I have 2 forms, each is bound to 1 table.
    Product Master
    Product_Xref

    From the PM form I can Open the PX form. In the PX form,
    I'll change the status of the product. Changing to a certain status
    will delete the record from the PM table. What I'd like to do at this point
    is have the PM form move to the record that was right before the record I deleted. The problem is, I always end up on the first record.

    Here's the code I'm using:

    If SysCmd(acSysCmdGetObjectState, acForm, "Product Master") = acObjStateOpen Then
    'the product master form is open
    Dim rstfrm As DAO.Recordset, strBkMk As String
    Set rstfrm = Forms![product master].RecordsetClone
    rstfrm.MovePrevious
    If rstfrm.BOF Then
    rstfrm.MoveFirst
    End If
    strBkMk = rstfrm.Bookmark
    Forms![product master].Requery
    Forms![product master].Bookmark = strBkMk
    rstfrm.Close
    Set rstfrm = Nothing
    End If

    Does anyone see anything I'm missing????

    Thanks
    Mark
    Inspiration Through Fermentation

  2. #2
    Join Date
    Sep 2003
    Location
    Cobalt, CT
    Posts
    7

    BookMarks

    are you executing that code before or after you delete the record. I would think you would need to do it before.

  3. #3
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Thanks dscroth!

    I was trying to run this AFTER deleting the record.

    A 2nd problem was that:
    Set rstfrm = Forms![product master].RecordsetClone
    for some reason was not lined up with the current record.
    I had to insert this line:
    rstfrm.FindFirst "[product] = '" & forms![product master]!product & "'"

    Works fine now.

    Thanks again

    Mark
    Inspiration Through Fermentation

Posting Permissions

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