Help with run time error 3122 RRS feed

  • Question

  • with this query i get the error:

    Set ElRegPedidos = LaBase.OpenRecordset("SELECT DISTINCTROW Pedidos.PedidoNum, Pedidos.FechaPed, Pedidos.FechaDespacho, First(DetalleDelPedido.CodigoProducto) AS [PriCodigoProducto], " & _
            "Sum(DetalleDelPedido.Cantidad) AS [SumaDeCantidad], Count(*) AS [Cuenta De DetalleDelPedido]FROM Pedidos INNER JOIN DetalleDelPedido ON Pedidos.[PedidoNum] = DetalleDelPedido.[PedidoNum] " & _
            "WHERE(Pedidos.FacturaPedido =" & 0 & ")and (Pedidos.PedidoNum <> " & ElPedidoNum & ")GROUP BY Pedidos.PedidoNum,Pedidos.FechaPed ORDER BY FechaPed WITH OWNERACCESS OPTION", dbOpenDynaset)

    error msg says: Your query does not include the specified expression 'FechaDespacho' as part of an aggregate function.

    cant get what im doing wrong, tryed in query editor and cant make it work either.

    thx for your help in advance.

    Tuesday, October 27, 2015 11:28 PM