Results 1 to 8 of 8
  1. #1
    2 Star Lounger
    Join Date
    Jul 2005
    Location
    North Carolina, USA
    Posts
    195
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Last record in a form to view First (2003)

    My brain is about to burn. I am trying to set the last record in a form to view first when you open the form. I am trying the SortByOrder in the form properties but I guess i am doing it wrong

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

    Re: Last record in a form to view First (2003)

    You must use a bit of code to set the sort order, for example in the On Load event of the form:

    Private Sub Form_Load()
    Me.OrderBy = "[OrderID] DESC"
    Me.OrderByOn = True
    End Sub

    where OrderID is the field you want to sort on in reverse order (DESC stands for descending).

  3. #3
    2 Star Lounger
    Join Date
    Jul 2005
    Location
    North Carolina, USA
    Posts
    195
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: Last record in a form to view First (2003)

    Hans thank again.

  4. #4
    2 Star Lounger
    Join Date
    Jul 2005
    Location
    North Carolina, USA
    Posts
    195
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: Last record in a form to view First (2003)

    I try the code. but is not showing the last record first when the form open up. I used the code to be applyied to the form in VB. Inside the form I have a tab control. and the information inside the tab name "EventTracker". I also have the Navigation bottoms showing and the first record that display is the first in the field. Any help.

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

    Re: Last record in a form to view First (2003)

    Do you have a subform on the tab control?

  6. #6
    2 Star Lounger
    Join Date
    Jul 2005
    Location
    North Carolina, USA
    Posts
    195
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: Last record in a form to view First (2003)

    not subform. I am using just the normal fields on the tab.

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

    Re: Last record in a form to view First (2003)

    Try this then:

    Private Sub Form_Load()
    On Error Resume Next
    RunCommand acCmdRecordsGoToLast
    End Sub

  8. #8
    2 Star Lounger
    Join Date
    Jul 2005
    Location
    North Carolina, USA
    Posts
    195
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: Last record in a form to view First (2003)

    The code did the job. Thank you again. <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>

Posting Permissions

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