Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    May 2005
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    subform navigation (2007)

    I have a continuous subform which is on a tabbed page. I would like the subform to display the last x records i.e. whatever will fit into the window with a space for a new entry being the last visible record. So far I'm stumped. Thanks

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

    Re: subform navigation (2007)

    And what if the user scrolls up? Do you want to disable that?

  3. #3
    2 Star Lounger
    Join Date
    May 2005
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: subform navigation (2007)

    I am not trying to limit access to the data. As an example if there are 100 records in the subform, of which you can see 20 at a time, then I would like to see the last 20. If I needed to I would be able to scroll through any and all records
    nebbia

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

    Re: subform navigation (2007)

    You could put code in the On Current event of the main form:

    Private Sub Form_Current()
    Me.SubFormName.SetFocus
    RunCommand acCmdRecordsGoToNew
    End Sub

    If you wish, you could set the focus back to a control on the main form after the RunCommand instruction.

  5. #5
    2 Star Lounger
    Join Date
    May 2005
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: subform navigation (2007)

    One mistake I was making was placing the code in the subform. Your code does take me to a new record but it is the only record in view. My hope was that I can see all of the most recent records that can be visible in the subform- in my case that would be the last 10 records

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

    Re: subform navigation (2007)

    Try

    Private Sub Form_Current()
    On Error Resume Next
    Me.SubFormName.SetFocus
    RunCommand acCmdRecordsGoToNew
    With Me.SubFormName.Form
    If .SelTop > 9 Then
    .SelTop = .SelTop - 9
    End If
    End With
    End Sub

  7. #7
    2 Star Lounger
    Join Date
    May 2005
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: subform navigation (2007)

    Just as I hoped Thanks as always

    nebbia

Posting Permissions

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