Results 1 to 6 of 6
  1. #1
    kennyritch
    Guest

    Ordering Data in a Subform (2000)

    HI Folks

    I've got a form containing a number of fields and a subform. How can I instruct Access to sort the records in my subform (descending by date in field salesDate) without having to do it everytime I open the form?

    Cheers,
    Kenny.

  2. #2
    New Lounger
    Join Date
    Nov 2002
    Location
    Dundas, Ontario, Canada
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Ordering Data in a Subform (2000)

    Hi,
    Use the sorting in the query upon which the subform is based. Select sorted "Desc" for the field you specified. This should automatically sort the field when in form view.
    HTH
    Val

  3. #3
    kennyritch
    Guest

    Re: Ordering Data in a Subform (2000)

    Ah Ha! Which brings me on to my next terribly naive question! ...

    How do I see the query on which my subform is based? In my few weeks of working with Access I still haven't figured this out.

    Thanks,
    Kenny.

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

    Re: Ordering Data in a Subform (2000)

    Open the subform in design view. You can't have the parent form open in any view when you do this, but as an alternative, you can simply select the subform in the parent form's design view. You may have to click on it twice to get into the subform itself rather than the subform control if you do this from the parent form's design view.

    Bring up the properties dialog and select the Data tab. The recordsource for the subform may be a table name or a query name, but if you click on it, you should see a little button appear next to the field with 3 dots on it. That's a builder button and clicking on it will either open the query in the query grid or bring up a new query based on the table. In the query grid, you can set the fields you want to sort by. Then just close the query grid and save the changes.
    Charlotte

  5. #5
    New Lounger
    Join Date
    Nov 2002
    Location
    Dundas, Ontario, Canada
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Ordering Data in a Subform (2000)

    Thanks Charlotte for elaborating on this for me. This was my first attempt to post a response so I appreciate the patience shown to newcomers.

    I might add that, once the subform's underlying query is known, it can be edited from the design view of the query by clicking on the "Queries" button in the database window's object bar (in Access 2000). This shows all the queries in the database. Select the right query and and choose design view. Changes to sort order can then be made in the query design grid.

    Again, thanks for the patience in dealing with the "young" (even when they are much older) <g>. A smashing site to complement your e-zines.

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

    Re: Ordering Data in a Subform (2000)

    That works if the recordsource is a saved query. If it's a select statement, then you have to do it from the design view of the form. Of course, saved queries are already optimized, so it's always best to use them for this purpose instead of a select statement.

    As for "even when they are much older", don't count on it. My nickname around here is <img src=/S/granny.gif border=0 alt=granny width=20 height=20> and I often smack young whippersnappers with my cane ... when I've forgetten to take my medicine! <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>
    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
  •