F
Fredrick A. Zilz
I have an access 2003 adp using a SQL 2005 database as the datasource. I
have a list which uses a function as the data source. When I execute the
function the results are sorted per the order by fields, but when I look at
the list in Access the list is seemingly random? Any ideas as to why?
SQL Function:
ALTER FUNCTION [dbo].[QtyByOrderNo_PendingOrders]()
RETURNS TABLE
AS
RETURN ( SELECT TOP 100 PERCENT CustomerOrders.IDCUST,
CustomerOrders.NAMECUST, dbo.Tbl_IH_LotNo.LotID, dbo.Tbl_IH_LotNo.MaLotNo,
dbo.Tbl_Inventory.OrderID, dbo.Tbl_IH_LotNo.OrderCode,
SUM(dbo.Tbl_Inventory.Qty) AS QtyOrdered, dbo.Tbl_Inventory.ORDUNIQ,
dbo.Tbl_Inventory.LINENUM, CustomerOrders.ORDDATE, CustomerOrders.EXPDATE,
CustomerOrders.ORIGQTY
FROM dbo.Tbl_Drums INNER JOIN
dbo.Tbl_SubLots ON dbo.Tbl_Drums.SubLotID = dbo.Tbl_SubLots.SubLotID INNER
JOIN
dbo.Tbl_IH_LotNo ON dbo.Tbl_SubLots.LotID = dbo.Tbl_IH_LotNo.LotID INNER
JOIN
dbo.Tbl_Inventory ON dbo.Tbl_Drums.DrumID = dbo.Tbl_Inventory.DrumID INNER
JOIN
dbo.CustomerOrders() CustomerOrders ON dbo.Tbl_Inventory.ORDUNIQ =
CustomerOrders.ORDUNIQ AND
dbo.Tbl_Inventory.LINENUM = CustomerOrders.LINENUM
WHERE (dbo.Tbl_Inventory.[Shipped Date] IS NULL)
GROUP BY dbo.Tbl_IH_LotNo.LotID, dbo.Tbl_IH_LotNo.MaLotNo,
dbo.Tbl_IH_LotNo.OrderCode, dbo.Tbl_Inventory.ORDUNIQ,
dbo.Tbl_Inventory.LINENUM,
dbo.Tbl_Inventory.OrderID, CustomerOrders.NAMECUST, CustomerOrders.IDCUST,
CustomerOrders.ORDDATE, CustomerOrders.EXPDATE,
CustomerOrders.ORIGQTY
HAVING (NOT (dbo.Tbl_Inventory.LINENUM IS NULL))
ORDER BY CustomerOrders.NAMECUST, dbo.Tbl_Inventory.OrderID )
What would make the Access 2003 list sort differently than the datasource?
have a list which uses a function as the data source. When I execute the
function the results are sorted per the order by fields, but when I look at
the list in Access the list is seemingly random? Any ideas as to why?
SQL Function:
ALTER FUNCTION [dbo].[QtyByOrderNo_PendingOrders]()
RETURNS TABLE
AS
RETURN ( SELECT TOP 100 PERCENT CustomerOrders.IDCUST,
CustomerOrders.NAMECUST, dbo.Tbl_IH_LotNo.LotID, dbo.Tbl_IH_LotNo.MaLotNo,
dbo.Tbl_Inventory.OrderID, dbo.Tbl_IH_LotNo.OrderCode,
SUM(dbo.Tbl_Inventory.Qty) AS QtyOrdered, dbo.Tbl_Inventory.ORDUNIQ,
dbo.Tbl_Inventory.LINENUM, CustomerOrders.ORDDATE, CustomerOrders.EXPDATE,
CustomerOrders.ORIGQTY
FROM dbo.Tbl_Drums INNER JOIN
dbo.Tbl_SubLots ON dbo.Tbl_Drums.SubLotID = dbo.Tbl_SubLots.SubLotID INNER
JOIN
dbo.Tbl_IH_LotNo ON dbo.Tbl_SubLots.LotID = dbo.Tbl_IH_LotNo.LotID INNER
JOIN
dbo.Tbl_Inventory ON dbo.Tbl_Drums.DrumID = dbo.Tbl_Inventory.DrumID INNER
JOIN
dbo.CustomerOrders() CustomerOrders ON dbo.Tbl_Inventory.ORDUNIQ =
CustomerOrders.ORDUNIQ AND
dbo.Tbl_Inventory.LINENUM = CustomerOrders.LINENUM
WHERE (dbo.Tbl_Inventory.[Shipped Date] IS NULL)
GROUP BY dbo.Tbl_IH_LotNo.LotID, dbo.Tbl_IH_LotNo.MaLotNo,
dbo.Tbl_IH_LotNo.OrderCode, dbo.Tbl_Inventory.ORDUNIQ,
dbo.Tbl_Inventory.LINENUM,
dbo.Tbl_Inventory.OrderID, CustomerOrders.NAMECUST, CustomerOrders.IDCUST,
CustomerOrders.ORDDATE, CustomerOrders.EXPDATE,
CustomerOrders.ORIGQTY
HAVING (NOT (dbo.Tbl_Inventory.LINENUM IS NULL))
ORDER BY CustomerOrders.NAMECUST, dbo.Tbl_Inventory.OrderID )
What would make the Access 2003 list sort differently than the datasource?