I would create a pass-through query to the SQL server with a UNION query SQL to normalize the data and make it much easier to question:
You could use a subquery to find the most recent 3 based on the union query's SupplierLastOrderDate.
SELECT CompanyCode, PartNumber, 1 as Supplier,
Supplier01Code SupplierCode, Supplier01LastOrderedDate SupplierLastOrderDate, Supplier01LastPurchaseOrderNumber SupplierLastPurchaseOrderNumber, Supplier1PartNumber SupplierPartNumber
FROM PARTS_SupplierCosts
UNION ALL
SELECT CompanyCode, PartNumber, 2, Supplier02Code, Supplier02LastOrderedDate, Supplier02LastPurchaseOrderNumber, Supplier2PartNumber
FROM PARTS_SupplierCosts
UNION ALL
SELECT CompanyCode, PartNumber, 3, Supplier03Code, Supplier03LastOrderedDate, Supplier03LastPurchaseOrderNumber, Supplier3PartNumber
FROM PARTS_SupplierCosts
UNION ALL
SELECT CompanyCode, PartNumber, 4, Supplier04Code, Supplier04LastOrderedDate, Supplier04LastPurchaseOrderNumber, Supplier4PartNumber
FROM PARTS_SupplierCosts
UNION ALL
SELECT CompanyCode, PartNumber, 5, Supplier05Code, Supplier05LastOrderedDate, Supplier05LastPurchaseOrderNumber, Supplier5PartNumber
FROM PART_SupplierCosts
... through 10 ...
FROM PART_SupplierCosts
Then you can create a nice query of
SELECT *
FROM [My Passthrough Name]
WHERE SupplierCode = [Forms]![frmInventoryReport]![txtVendorLookup] and CompanyCode = "01"
From: MS_Access_Professionals@yahoogroups.com <MS_Access_Professionals@yahoogroups.com> on behalf of jfakes@rocketmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: Wednesday, May 1, 2019 12:16 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Vendor select by last ordered date
Sent: Wednesday, May 1, 2019 12:16 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Vendor select by last ordered date
__._,_.___
Posted by: Duane Hookom <duanehookom@hotmail.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.
SPONSORED LINKS
.
__,_._,___
Tidak ada komentar:
Posting Komentar