Sort a calculated query into descending order

eddie442

Registered User.
Local time
Today, 08:57
Joined
Jan 7, 2005
Messages
16
I hope someone can help me with this. I have a parameter query that asks the user what category they want to search on and then prompts them for two dates. The query then displays the amount of working hours elapsed between the two dates (thanks muchly for the advice given here earlier!). The query works fine but I want the query to display the minutes in descending order. I've tried sorting them into descending order in the query window but when run the query displays an extra prompt asking for more criteria. The code for the query is below;

SELECT [tblEnquiries].[EnquiryNo], [tblEnquiries].[EnquiryTopic], [tblEnquiries].[Request/ReturnedDate], [Request/ReturnedDate]+[Request/ReturnedTime] AS RequestTotal, [CompletedDate]+[CompletedTime] AS CompletedTotal, NetWorkHours([RequestTotal],[CompletedTotal]) AS Minutes, [Minutes]\60 & Format([Minutes] Mod 60,"\:00") AS [Time]
FROM tblEnquiries
WHERE ((([tblEnquiries].[EnquiryTopic])=[Forms]![frmSearch]![cboEnquiryCat]) And (([tblEnquiries].[Request/ReturnedDate]) Between [Forms]![frmSearch]![cboStartDate] And [Forms]![frmSearch]![cboEndDate])) Or ((([tblEnquiries].[Request/ReturnedDate]) Between [Forms]![frmSearch]![cboStartDate] And [Forms]![frmSearch]![cboEndDate]) And ((([tblEnquiries].[EnquiryTopic]) Like [Forms]![frmSearch]![cboEnquiryCat]) Is Null));

Any ideas?
Many Thanks
Dave
 
I believe that you will have to quote the whole calculation to sort on the field
So that
NetWorkHours([RequestTotal],[CompletedTotal]) AS Minutes
Becomes
NetWorkHours([Request/ReturnedDate]+[Request/ReturnedTime],[CompletedDate]+[CompletedTime]) AS Minutes

Brian
 
Thanks for this. Sorry for the delay in replying, I've not worked on the database until now. My department thinks I can do the work of three people so something had to give!

Thanks for your help!
Dave
 

Users who are viewing this thread

Back
Top Bottom