I would like the data that shows on my Continous form to be sorted by a date field. I entered the sort order in the query that the form is based upon but it is still not sorted. How can I do this?
I would like the data that shows on my Continous form to be sorted by a date field. I entered the sort order in the query that the form is based upon but it is still not sorted. How can I do this?
SELECT Scheduled_Appts.Appt_Date, Scheduled_Appts.Carrier, Scheduled_Appts.Sch_Time, Scheduled_Appts.Arr_Time, Scheduled_Appts.Missing_PaperWork, Scheduled_Appts.Incoming, Scheduled_Appts.Appt_ID, Scheduled_Appts.Outgoing, Scheduled_Appts.Dep_Time, Scheduled_Appts.Created_by, Scheduled_Appts.Created_Date, Scheduled_Appts.Last_Modified_by, Scheduled_Appts.Last_Modified_Date, Scheduled_Appts.Confirmation_Num
FROM Scheduled_Appts
WHERE (((Scheduled_Appts.Incoming)=[Forms]![frmScheduled_Appts]![cbViewRec])) OR (((Scheduled_Appts.Outgoing)=[Forms]![frmScheduled_Appts]![cbViewShip]))
ORDER BY Scheduled_Appts.Sch_Time;
SELECT qryFilterByType.Appt_Date, qryFilterByType.Carrier, qryFilterByType.Sch_Time, qryFilterByType.Arr_Time, qryFilterByType.Dep_Time, qryFilterByType.Missing_PaperWork, qryFilterByType.Incoming, qryFilterByType.Outgoing, qryFilterByType.Appt_ID, qryFilterByType.Created_by, qryFilterByType.Last_Modified_by, qryFilterByType.Last_Modified_Date, qryFilterByType.Confirmation_Num
FROM qryFilterByType
WHERE (((qryFilterByType.Appt_Date)=[Forms]![frmScheduled_Appts]![cldrApptDates]))
ORDER BY qryFilterByType.Sch_Time;
ok it is working, my fault, but the issue is I wanted to know if I can get the Blanks to sort to the bottom? Also, I want to be able to allow the user to change the sort between Time or Carrier. How do I do this in code?
The issue with that is then the time will also be descending. Well a bigger issue is how do I make it so the user can click on a button and change the sort?
ORDER BY qryFilterByType.Sch_Time, qryFilterByType.Carrier, qryFilterByType.Arr_Time;
That is the SQL statement sometimes I will need Carrier to be the first sort. Depending on what Columns the user Clicks on.
Dim strSort As String
strSort = "SELECT Scheduled_Appts.Appt_Date, Scheduled_Appts.Carrier, Scheduled_Appts.Sch_Time, " & _
"Scheduled_Appts.Arr_Time, Scheduled_Appts.Missing_PaperWork, Scheduled_Appts.Incoming, " & _
"Scheduled_Appts.Appt_ID, Scheduled_Appts.Outgoing, Scheduled_Appts.Dep_Time, Scheduled_Appts.Created_by, " & _
"Scheduled_Appts.Created_Date, Scheduled_Appts.Last_Modified_by, Scheduled_Appts.Last_Modified_Date, " & _
"Scheduled_Appts.Confirmation_Num " & _
"FROM Scheduled_Appts " & _
"WHERE ((((Scheduled_Appts.Incoming) = Forms!frmScheduled_Appts!cbViewRec)) Or " & _
"(((Scheduled_Appts.Outgoing) = Forms!frmScheduled_Appts!cbViewShip))) And " & _
"(((Scheduled_Appts.Appt_Date) = Forms!frmScheduled_Appts!cldrApptDates)) " & _
"ORDER BY Scheduled_Appts.Sch_Time, Scheduled_Appts.Arr_Time, Scheduled_Appts.Carrier;"
DoCmd.RunSQL strSort
What do you mean by create a dynamic RecordSource? Couldn't I just run an SQL statement as a user clicks on the label for the column?
Here is the code that I tried:
PHP:Dim strSort As String strSort = "SELECT Scheduled_Appts.Appt_Date, Scheduled_Appts.Carrier, Scheduled_Appts.Sch_Time, " & _ "Scheduled_Appts.Arr_Time, Scheduled_Appts.Missing_PaperWork, Scheduled_Appts.Incoming, " & _ "Scheduled_Appts.Appt_ID, Scheduled_Appts.Outgoing, Scheduled_Appts.Dep_Time, Scheduled_Appts.Created_by, " & _ "Scheduled_Appts.Created_Date, Scheduled_Appts.Last_Modified_by, Scheduled_Appts.Last_Modified_Date, " & _ "Scheduled_Appts.Confirmation_Num " & _ "FROM Scheduled_Appts " & _ "WHERE ((((Scheduled_Appts.Incoming) = Forms!frmScheduled_Appts!cbViewRec)) Or " & _ "(((Scheduled_Appts.Outgoing) = Forms!frmScheduled_Appts!cbViewShip))) And " & _ "(((Scheduled_Appts.Appt_Date) = Forms!frmScheduled_Appts!cldrApptDates)) " & _ "ORDER BY Scheduled_Appts.Sch_Time, Scheduled_Appts.Arr_Time, Scheduled_Appts.Carrier;" DoCmd.RunSQL strSort
I thought this might work but it is given me an error
[/COLOR]
"WHERE ((((Scheduled_Appts.Incoming) = Forms!frmScheduled_Appts!cbViewRec)) Or "
Will Become:
"WHERE ((((Scheduled_Appts.Incoming) = [B][COLOR=red]'[/COLOR]"[/B] & Forms!frmScheduled_Appts!cbViewRec & [B]"[COLOR=red]'[/COLOR][/B])) Or "[COLOR=black][/COLOR]
[COLOR=black]
Couldn't I just run an SQL statement as a user clicks on the label for the column?
DoCmd.RunSQL strSort
I thought this might work but it is given me an error
Bob,
thank you for helping but how do I assign it as a recordset or use it as a dlookup and which should I use?
You realize, of course, that htis thread is over three years old?