Selasa, 10 Juli 2018

[MS_AccessPros] Re: query sort by date not working

 

Sarah - 

I don't see anything that would mess up the sorting unless it's in the properties sheet of the query. Have you checked that?

Also, what happens if you create a new query just on the MLTC table with only the enrollmentdate in the SELECT clause.

SELECT enrollmentdate
FROM MLTC
ORDER BY enrollmentdate

-Bill


---In MS_Access_Professionals@yahoogroups.com, <sarahk@schemesoftware.com> wrote :

this is the complete SQL:

SELECT MLTC.*, [first name] & " " & [last name] AS [Registrant Name], studentworkfile.[preferred shift]
FROM MLTC LEFT JOIN studentworkfile ON MLTC.studentid = studentworkfile.[student id]
WHERE (((MLTC.enrollmentdate) Between [Forms]![zformcrwk]![pid from] And [Forms]![zformcrwk]![pid to]) AND ((studentworkfile.[billing type]) Like [Forms]![zformcrwk]![pmb]) AND (([last name] & ", " & [first name] & " " & [mi]) Between [Forms]![zformcrwk]![ln from] And [Forms]![zformcrwk]![ln to])) OR (((MLTC.disenrollmentdate) Between [Forms]![zformcrwk]![pid from] And [Forms]![zformcrwk]![pid to]) AND ((studentworkfile.[billing type]) Like [Forms]![zformcrwk]![pmb]) AND (([last name] & ", " & [first name] & " " & [mi]) Between [Forms]![zformcrwk]![ln from] And [Forms]![zformcrwk]![ln to])) OR (((MLTC.disenrollmentdate) Between DateAdd("d",-1,[Forms]![zformcrwk]![pid from]) And [Forms]![zformcrwk]![pid to]) AND ((studentworkfile.[billing type]) Like [Forms]![zformcrwk]![pmb]) AND (([last name] & ", " & [first name] & " " & [mi]) Between [Forms]![zformcrwk]![ln from] And [Forms]![zformcrwk]![ln to]))
ORDER BY MLTC.enrollmentdate;



Sarah

---In MS_Access_Professionals@yahoogroups.com, <wrmosca@...> wrote :

Hi Sarah - The sort should work. Something else is influencing the sort order. Can you switch to SQL view and post the SQL for you original query?

Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
My nothing-to-do-with-Access blog
http://wrmosca.wordpress.com



---In MS_Access_Professionals@yahoogroups.com, <sarahk@...> wrote :

I am trying to sort my query results by date, the field is defined as a short date in the table, however the sort does not work.:6/30/2017 sorts before 3/1/2017.


If I add  Format([mydate],"yyyymmdd") AS sortdte and then run another query sorting by sortdte, it sorts correctly.


I would like to just run one query that sorts correctly, i have tried 'Order by mydate' and 'Order BY  Format([enrollmentdate],"yyyymmdd"), neither version works.


Is there a way to 'fix' this?.


Thanks for all help


Sarah

 

 
 

__._,_.___

Posted by: wrmosca@comcast.net
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


SPONSORED LINKS
.

__,_._,___

Tidak ada komentar:

Posting Komentar