Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Location
    Kansas, USA
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    orderby property (ACC2000 SR1a)

    I have a form that opens in datasheet view based on a query. It has columns (fields) like InvDate, InvNum, LinNum, SKU, Description, Price, Total, Quantity, etc. When the form is open, and I click on the sort button on the toolbar, it changes the default "orderby" property. I would like to be able to set that with an "on Open" event on the form and have the orderby property=Date, Invnum, Linnum. When I say Me!Orderby="date" I get a message saying it can't find that field. What is the correct syntax (if this is possible)?

  2. #2
    TracyF
    Guest

    Re: orderby property (ACC2000 SR1a)

    That syntax works for me in the Open event of a form. In your post, you don't mention "date" being one of your fields, do you need to say Me.OrderBy = "InvDate"?

    Also, be sure that you set OrderByOn = true.

    Tracy

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: orderby property (ACC2000 SR1a)

    If you actually do have a field named "date", it will bite you here because that is also the name of a built-in function and Access won't be able to figure out which thing you're trying to use.
    Charlotte

  4. #4
    Star Lounger
    Join Date
    Jan 2001
    Location
    Kansas, USA
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: orderby property (ACC2000 SR1a)

    Thanks Tracy, I got it to work. I found out too, that if I want to sort by multiple fields, I need to enclose them in quotation marks, separated by commas like this: Me.orderby="InvDate, OrderNum, LineNum"

  5. #5
    Star Lounger
    Join Date
    Jan 2001
    Location
    Kansas, USA
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: orderby property (ACC2000 SR1a)

    Thanks Charlotte, and yes, I had to fix the field named "Date". Can you explain to me the difference between a period and an exclamation point as in Me.Orderby and Me!Orderby?

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: orderby property (ACC2000 SR1a)

    The period indicates the what follows is a method or property of the object. So "Me.OrderBy" refers to the OrderBy property of the current form. You will sometimes see control names preceded by the dot, which works because the controls are also treated as properties of the form as well as members of the form's controls collection. The exclamation point (or "bang" in jargon) indicates members of a collection, which means that Me!OrderBy would be interpreted as a control called OrderBy on the current form or report, while Me.OrderBy is recognized as a property.
    Charlotte

Posting Permissions

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