Hi Guys,

I would like to group the records in a table and sort the 'servtype' field in DESC order. Based on the code below, the records are grouped as I wanted it to be but why does it not sorted in DESC order? I guess I'm missing something. Please help me out, thanks in advance!

'*******************************************************
strSQL = "SELECT services.joborder, services.description, services.laborcost, services.servtype, services.totalcost, partsactual.amount, partsactual.partstype, partsactual.qty, partsactual.particulars, partsactual.up FROM services INNER JOIN partsactual ON services.servtype = partsactual.servtype WHERE (partsactual.joborder = '" & vjo & "') AND (services.joborder = '" & vjo & "') Order by services.servtype DESC"

dbreport 'open ms data shape connection

Set rs = New ADODB.Recordset

rs.Open " SHAPE(SHAPE {" & strSQL & "} AS cmdGroup Compute cmdGroup, sum(cmdGroup.amount) as subtotal By 'servtype', 'description', 'laborcost', 'totalcost') as rsgroup Compute rsgroup, sum(rsgroup.subtotal) as grandtotal", cn, adOpenStatic, adLockOptimistic, cmdtext

'********************************************************