How to maintain a dates on subforms descending sorted

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ericks
    New Member
    • Jul 2007
    • 74

    How to maintain a dates on subforms descending sorted

    I have several subforms (datasheet mode), each with a date. The default dates are that of the system but they can be altered at will by the user. I want these dates to remain sorted descending, that is, the most recent date first and later dates in the subsequent rows. Although I entered Subform.[Date] DESC in the subforms Design View "Order by" it keeps mixing up every time I open the main form. I guess the subform sorts by real input date and not by date given in the date control. How can I force descending sort for the dates as in the control?
  • Jim Doherty
    Recognized Expert Contributor
    • Aug 2007
    • 897

    #2
    Originally posted by Ericks
    I have several subforms (datasheet mode), each with a date. The default dates are that of the system but they can be altered at will by the user. I want these dates to remain sorted descending, that is, the most recent date first and later dates in the subsequent rows. Although I entered Subform.[Date] DESC in the subforms Design View "Order by" it keeps mixing up every time I open the main form. I guess the subform sorts by real input date and not by date given in the date control. How can I force descending sort for the dates as in the control?
    Consider basing the recordsource of your subform on either a saved query that sorts by the date you require descending or an SQL statement typed directly into the recordsource property of the form. so the recordsource of your subform should look something like either one of these

    Record source: qryTheNameOfMyS avedQuery

    OR

    Record source: SELECT fieldname1,fiel dname2,MyDate1 FROM tblMyTable ORDER BY MyDate1 DESC;

    Regards

    Jim

    Comment

    • Ericks
      New Member
      • Jul 2007
      • 74

      #3
      Originally posted by Jim Doherty
      Consider basing the recordsource of your subform on either a saved query that sorts by the date you require descending or an SQL statement typed directly into the recordsource property of the form. so the recordsource of your subform should look something like either one of these

      Record source: qryTheNameOfMyS avedQuery

      OR

      Record source: SELECT fieldname1,fiel dname2,MyDate1 FROM tblMyTable ORDER BY MyDate1 DESC;

      Regards

      Jim

      Thanks Jim. Gosh do I feel stupid. Somehow I wanted the Form to be based on the table so I kept staring myself blind on that. So I made a query and now it works. I guess you're not surprised I chose that Avatar...

      Thanks again,

      Eric

      Comment

      • Jim Doherty
        Recognized Expert Contributor
        • Aug 2007
        • 897

        #4
        Originally posted by Ericks
        Thanks Jim. Gosh do I feel stupid. Somehow I wanted the Form to be based on the table so I kept staring myself blind on that. So I made a query and now it works. I guess you're not surprised I chose that Avatar...

        Thanks again,

        Eric
        Ahahahaha you know something I did look at that and I thought "now you know something?" this person is cool

        Jim :)

        Comment

        Working...