Sort a form by default

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Max Harvey

    Sort a form by default

    Hi all,

    I have a form which is based on a table.

    The table (table1) has fields like Surname, Firstname, etc.

    I want to have the form sort by Surname, and then Firstname.

    I put the Orderby files as "table1.surname , table1.firstnam e", and all
    is fine. The along comes somebody and clicks a field, and clicks the
    A-Z button to sort it by that field, and from then on it is sorted by
    that field. I don't want to disable this button as it is useful to
    beable to do it to this field, I don't have a way which is just as
    easy to sort it by Surname,Firstna me again. If they click on the
    Surname field and click A-Z, surname is sorted, but the firstnames if
    the surname is the same aren't necessary sorted, and you can't seem to
    click to fileds and tell it to sort...

    So, can I (somehow) make a button on the form so if they click on
    that, it will sort by Surname, Firstname again? and if so... how
    (please).



    Thanks for reading.


    Max.
  • U N Me

    #2
    Re: Sort a form by default

    Max Harvey wrote:
    [color=blue]
    > Hi all,
    >
    > I have a form which is based on a table.
    >
    > The table (table1) has fields like Surname, Firstname, etc.
    >
    > I want to have the form sort by Surname, and then Firstname.
    >
    > I put the Orderby files as "table1.surname , table1.firstnam e", and all
    > is fine. The along comes somebody and clicks a field, and clicks the
    > A-Z button to sort it by that field, and from then on it is sorted by
    > that field. I don't want to disable this button as it is useful to
    > beable to do it to this field, I don't have a way which is just as
    > easy to sort it by Surname,Firstna me again. If they click on the
    > Surname field and click A-Z, surname is sorted, but the firstnames if
    > the surname is the same aren't necessary sorted, and you can't seem to
    > click to fileds and tell it to sort...
    >
    > So, can I (somehow) make a button on the form so if they click on
    > that, it will sort by Surname, Firstname again? and if so... how
    > (please).
    >
    > Thanks for reading.
    >
    > Max.[/color]

    I'll assume this is a single form or continuous as you can multiselect
    columns in a datasheet. You could create a command button then shrink it
    down until it's the same height of the surname contol and very narrow.
    Maybe put in an S (for sort) as it's caption. Put it to the left of the
    label for Surname. In the OnClick event enter
    Me.OrderBy = "Surname, FirstName"
    Me.OrderByOn = True


    Comment

    • Fredg

      #3
      Re: Sort a form by default

      Max,
      Base the form on a query sorted by LastName, FirstName.
      This then becomes the 'normal' sort for the form.

      If someone re-sorts, using the A-Z or Z-A toolbuttons,
      simply by right-clicking anywhere within the form and selecting
      'Remove Filter/Sort' you'll be back where you want to be.
      Or ...
      you can click on Records + Remove Filter/Sort.

      --
      Fred

      Please reply only to this newsgroup.
      I do not reply to personal e-mail.


      "Max Harvey" <google@DELTAL. org> wrote in message
      news:7a09b211.0 310071200.1fc7c 7cc@posting.goo gle.com...[color=blue]
      > Hi all,
      >
      > I have a form which is based on a table.
      >
      > The table (table1) has fields like Surname, Firstname, etc.
      >
      > I want to have the form sort by Surname, and then Firstname.
      >
      > I put the Orderby files as "table1.surname , table1.firstnam e", and all
      > is fine. The along comes somebody and clicks a field, and clicks the
      > A-Z button to sort it by that field, and from then on it is sorted by
      > that field. I don't want to disable this button as it is useful to
      > beable to do it to this field, I don't have a way which is just as
      > easy to sort it by Surname,Firstna me again. If they click on the
      > Surname field and click A-Z, surname is sorted, but the firstnames if
      > the surname is the same aren't necessary sorted, and you can't seem to
      > click to fileds and tell it to sort...
      >
      > So, can I (somehow) make a button on the form so if they click on
      > that, it will sort by Surname, Firstname again? and if so... how
      > (please).
      >
      >
      >
      > Thanks for reading.
      >
      >
      > Max.[/color]


      Comment

      Working...