Results 1 to 4 of 4
  1. #1
    Join Date
    May 2016
    Posts
    82
    Provided Answers: 3

    Unanswered: Navigation Form : How To return on calling Page Record

    Hi,

    I have a navigation form with 2 tabs (pages).

    1. tab1 = purchase order
    2. tab2 : purchase order detail


    What I want is reselecting the tab1 record selected before calling tab2 when I come back on tab1?

    Thanks for your help

  2. #2
    Join Date
    Mar 2009
    Posts
    5,440
    Provided Answers: 14
    You don't supply enough information on how the form is built, however:
    a) If the recordsource of the form has a primary key, you can store it's value in a member variable (i.e. a variable declared in the declaration section of the form module and, when Tab1 is activated go back to the corresponding record:
    Code:
    ' In de declaration section.
    '
    Dim lngPK as Long
    
    ' Wen Tab1 is activated.
    '
    Dim rst as DAO.Recordset
    
    Set rst = Me.RecordsetClone
    rst.FindFirst "PrimaryKey = " & lngPK ' Replace PrimaryKey with its actual name.
    If rst.EOF = False Then 
        Me.Bookmark = rst.Bookmark
    End If
    rst.Close
    Set rst = Nothing
    b) You can also declare the recordset clone as a member variable:
    Code:
    ' In de declaration section.
    '
    Dim rst as DAO.Recordset
    
    ' Wen Tab1 is activated.
    '
    Me.Bookmark = rst.Bookmark
    Now you have to figure out how and when assign the proper value to the member variable (lngPK or rst). Without knowing any details on how the form is built, this is a question I cannot answer.
    Have a nice day!

  3. #3
    Join Date
    May 2016
    Posts
    82
    Provided Answers: 3
    Hi Sinndho

    Thanks a lot for your relevant solution. I implement it and it works perfectly !




  4. #4
    Join Date
    Mar 2009
    Posts
    5,440
    Provided Answers: 14
    You're welcome!
    Have a nice day!

Tags for this Thread

Posting Permissions

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