Results 1 to 9 of 9
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sorting Records in a Form Datasheet View (2003)

    I'm trying to sort the records in the datasheet view of the startup form of the attached mdb by setting the OrderBy box in the form property sheet to the DateChecked field by when the form opens, the records are still not sorted by date.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sorting Records in a Form Datasheet View (2003)

    Setting the OrderBy property of the form in the Properties window doesn't work. Create a query based on tblFilesFromFolder that sorts the records on the DateChecked field, and use the query as Record Source for the form.

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sorting Records in a Form Datasheet View (2003)

    Thank you Hans,
    I've created the query(Query1) which is also shown below but still the records don't get sorted by date.

    SELECT tblFilesFromFolder.FileName, tblFilesFromFolder.DateChecked, tblFilesFromFolder.Client, tblFilesFromFolder.TapeLength, tblFilesFromFolder.rate
    FROM tblFilesFromFolder
    ORDER BY tblFilesFromFolder.DateChecked;

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sorting Records in a Form Datasheet View (2003)

    It would help if you set the Record Source of the form to the name of the query.

  5. #5
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sorting Records in a Form Datasheet View (2003)

    Sorry Hans <img src=/S/blush.gif border=0 alt=blush width=15 height=15>
    I hadn't set the Record Source of the form to the name of the query because I saw the query itself wasn't properly sorting the records so I figured the form wouldn't as well and in fact it doesn't.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sorting Records in a Form Datasheet View (2003)

    I hope you realize that the table contains records for September 2004 and September 2005. The records for 2004 are obviously sorted before those of 2005, so 16 September 2004 comes before 12 September 2005. Could this be causing confusion?

  7. #7
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sorting Records in a Form Datasheet View (2003)

    <img src=/S/blush.gif border=0 alt=blush width=15 height=15>I hadn't realised that. So it was working properly all along! <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22> <img src=/S/stupidme.gif border=0 alt=stupidme width=30 height=30> I'm so sorry Hans and I'm glad the OrderBy property of forms does work. Thank you again.

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sorting Records in a Form Datasheet View (2003)

    But you can't rely on setting OrderBy in the Properties sheet of a form. If the user sorts the form on another field, the form may get saved with the changed OrderBy. By setting the sort order in the Record Source, you force the records to be sorted the way you want.

  9. #9
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sorting Records in a Form Datasheet View (2003)

    That's a very useful piece of advice. Thank you my friend. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

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