I'm using Access 2010. I'm calling a query.
SELECT P.ClientID, P.PlanId, P.PlanName, P.Participants, P.PlanStatus, Iif(P.DocTypeNo=1,"C",iif(P.DocTypeNo=2,"P","V")) as DocTypeNo
FROM tbl_Plans AS P;
Based on selections I add a sort field to the query
strField = "[PlanID]"
strField = "[PlanName]"
strField = "[Participants]"
strField = "[PlanStatus]"
strField = "[DocTypeNo]"
My issue is with DocTypeNo. When I pass it DocTypeNo I get an Error. Sort order cannot be applied. All other sort work fine.
At first I thought it was do to the alias AS DocTypeNo so I changed it to DocType in the query and in Access but I still get the same error. I even tried encasing the entire evaluation in () but I still get the error. Running the query outside of the access form works fine.