我的Select语句运行正常:
rsCurrent.Source = "SELECT Calibrations.Cust_Ref, Calibrations.Rec_Date, Instruments.Inst_ID, Instruments.Description, Instruments.Model_no, Instruments.Manufacturer, Instruments.Serial_no, Instruments.Status, Instruments.Cust_Acc_No FROM Instruments INNER JOIN Calibrations ON Instruments.Inst_ID = Calibrations.Inst_ID WHERE Instruments.Cust_Name = '" & Session("MM_Username") & "' AND Instruments.Cust_Acc_No = '" & Session("MM_Password") & "' AND Instruments.Cust_Acc_No = '" + Replace(rsCurrent__MMColParam, "'", "''") + "' AND Instruments.Status IN ('E','F','G','H','I','K','L','M','N');"
我尝试了不同的方法尝试按降序设置我的记录,查找Calibrations.Rec_Date
我做错了什么?
答案 0 :(得分:0)
尝试,
rsCurrent.Source = "SELECT Calibrations.Cust_Ref, Calibrations.Rec_Date, Instruments.Inst_ID, Instruments.Description, Instruments.Model_no, Instruments.Manufacturer, Instruments.Serial_no, Instruments.Status, Instruments.Cust_Acc_No FROM Instruments INNER JOIN Calibrations ON Instruments.Inst_ID = Calibrations.Inst_ID WHERE Instruments.Cust_Name = '" & Session("MM_Username") & "' AND Instruments.Cust_Acc_No = '" & Session("MM_Password") & "' AND Instruments.Cust_Acc_No = '" + Replace(rsCurrent__MMColParam, "'", "''") + "' AND Instruments.Status IN ('E','F','G','H','I','K','L','M','N') ORDER BY Calibrations.Rec_Date DESC;"
http://www.w3schools.com/sql/sql_orderby.asp
您可能想尝试ORDER BY DATE(Calibrations.Rec_Date)