• sorting records on a form or report

    Author
    Topic
    #356559

    Hi,

    In my database the records can be sorted in several different ways. I gave them all a UID (unique identifier) so that they could be sorted chronilogically. However most of the items are also tied to reference numbers. I can sort the table by reference number, but when I go to my report or form the records will not sort properly. I need to compare records with the same reference numbers to see if they overlap and can be combined into one entry.

    I tried this code

    Private Sub Command19_Click()
    Private Sub CmdSort_Click()
    Me.OrderBy = “Reference”
    Me.OrderByOn = True
    End Sub
    End Sub

    Private Sub Sort_by_Reference_Click()

    End Sub

    But it doesn’t seem to work.
    Can someone suggest what I might do to get my records sorted on either the form or report?

    Thanks.

    Viewing 1 reply thread
    Author
    Replies
    • #527975

      I’m not sure about the code, but … Couldn’t you use a query, that sorts the table records the way you want to see them, as the source of the form or report?

    • #527988

      Your code has too many lines – Try this:
      Private Sub CmdSort_Click()
      Me.OrderBy = “Reference”
      Me.OrderByOn = True
      End Sub

      You may want to Me.Refresh after the OrderByOn property. Don’t know if you need it, though…..

      Also, try referencing the form as

      Forms(“frmname”).OrderBy=”Reference”

      • #528017

        Thanks for the replies.
        I tried the new code, but it still wouldn’t work, so I went back and created a query as suggested and now have the form in the order that I wanted.

    Viewing 1 reply thread
    Reply To: sorting records on a form or report

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: