Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Jul 2002
    Location
    Petersburg, Virginia
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Order on Subform (97/SR2)

    One particular subform--and not others--on a tab control does not ORDER records according to primary key (two fields are key). Records retain order in which they are added to table. Even running a Requery command does not alter order. ???

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Order on Subform (97/SR2)

    Is this subform linked to the mainform by some field? (for example, the subform may contain detail lines of the mainform's invoice). If so, then it will use an index the starts with that field.

    If you want a different order, use the OrderBy property.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Star Lounger
    Join Date
    Jul 2002
    Location
    Petersburg, Virginia
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Order on Subform (97/SR2)

    I tried Order By solution without success. The main "form" is actually a subform on a tab control. Within that subform is the subform in question. The main "form" is filtered for a given client register number (also the primary key) and, therefore, has no "order" (one client, nothing to order). The subform inquestion is based on a query which is based on a table with two key fields: [PriorityNumber] and [SupportNumber], both numeric fields. There may be multiple supports for a given priority; I want the records on the subform to be ordered by Priority first, Support second, e.g., P1S1, P1S2, P1S3, P2S1, P2S2, etc.
    I have tried the order by property, and I have tried running code with the OnLoad event of the subform:
    Me.OrderBy = "[prioritynumber],[supportnumber]"
    Me.OrderByOn = True

    Do you know what I'm doing wrong? Thanks.

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

    Re: Order on Subform (97/SR2)

    Why don't you just set the order in the query the subform is based on?
    Charlotte

  5. #5
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Order on Subform (97/SR2)

    That the parent of the subform in question is actually a subform itself shouldn't be a factor here. Your code should work. YOu might try removing the brackets, to see if that helps. Or as Charlotte suggested, set the Order By sequence in the query.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  6. #6
    Star Lounger
    Join Date
    Jul 2002
    Location
    Petersburg, Virginia
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Order on Subform (97/SR2)

    I guess because it was too obvious!! Your solution worked, thanks.

Posting Permissions

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