RobertWaring
New member
- Local time
- Today, 09:52
- Joined
- Jan 5, 2025
- Messages
- 1
Hello All. This is my first post and for that matter my first database build. Arguably not one of my best decisions, but I am determined to figure this out. I am okay with my VBA skills, but they are limited to Microsoft Excel. I am trying to create an inventory database as it is the only option available to me that can be used my multiple users simultaneously with all having the same current data - you know, what a database was designed for. (lol)
Ive gotten pretty far but am stuck trying to build a rather complex query (to me anyhow) to get an accurate count of inventory items per location. The query is based on the below table:
It lists each transaction by type (Receipt, Shipment, Adjustment, Move, CycleCount). These should determine how the quantities are totaled. There are 4 additional key fields. The FromLocationType, FromLocationID, ToLocationType, and ToLocationID. These serve to determine where product came from and where it went. Each type has three posibilities (Customer, Supplier, Warehouse). In case your wondering why, we rent - but do provide consumables that are tracked for billing purposes. The To/FromIDs are to differentiate which specific location based on the type. If this were excel I could figure this relatively easily, but being as I am VERY new to Access - I am lost!! I have the following query (qryTransactionSummary), but it doesn't calculate the totals correctly. I can get close, but it goes without saying that that's not good enough.
To sum it up - Any transactiontype=Receipt, shipment, or Move need to be added to the ToLocationID(based on type) but also subtracted from the FromLocationID(based on type)
Any transactiontype=Adjustment or CycleCount needs to be subtracted from the ToLocationID(based on type)
The quantity is in the Quantity field in the table. It will ALWAYS be a positive value with the exception of the Adjustments or CycleCounts as this quantity is the value of the variance (which is stored on separate tables, merely trandferred to this table for convenience.)
Can someone please help me determine what I am doing wrong - bare in mind I am a complete novice, so easy on the terminology (lol). Thank you in advance! - Robert
PS If more information is required or this doesn't make sense, please let me know.
Ive gotten pretty far but am stuck trying to build a rather complex query (to me anyhow) to get an accurate count of inventory items per location. The query is based on the below table:
It lists each transaction by type (Receipt, Shipment, Adjustment, Move, CycleCount). These should determine how the quantities are totaled. There are 4 additional key fields. The FromLocationType, FromLocationID, ToLocationType, and ToLocationID. These serve to determine where product came from and where it went. Each type has three posibilities (Customer, Supplier, Warehouse). In case your wondering why, we rent - but do provide consumables that are tracked for billing purposes. The To/FromIDs are to differentiate which specific location based on the type. If this were excel I could figure this relatively easily, but being as I am VERY new to Access - I am lost!! I have the following query (qryTransactionSummary), but it doesn't calculate the totals correctly. I can get close, but it goes without saying that that's not good enough.
SQL:
SELECT InventoryTransactions.ItemID, InventoryTransactions.ToLocationType, InventoryTransactions.ToLocationID, Sum(Switch([TransactionType]="Receipt",[Quantity],[TransactionType]="Adjustment",[Quantity],[TransactionType]="Move",[Quantity],[TransactionType]="Shipment",-[Quantity],[TransactionType]="CycleCount",[Quantity],True,0)) AS NetQuantity, InventoryItems.[Item#], InventoryItems.VendorItemName, InventoryItems.CasePrice, InventoryItems.PackCount, InventoryItems.PackSize, InventoryItems.PackUOM, InventoryTransactions.FromLocationType, InventoryTransactions.FromLocationID
FROM InventoryItems INNER JOIN InventoryTransactions ON InventoryItems.InventoryID = InventoryTransactions.ItemID
GROUP BY InventoryTransactions.ItemID, InventoryTransactions.ToLocationType, InventoryTransactions.ToLocationID, InventoryItems.[Item#], InventoryItems.VendorItemName, InventoryItems.CasePrice, InventoryItems.PackCount, InventoryItems.PackSize, InventoryItems.PackUOM, InventoryTransactions.FromLocationType, InventoryTransactions.FromLocationID;
Any transactiontype=Adjustment or CycleCount needs to be subtracted from the ToLocationID(based on type)
The quantity is in the Quantity field in the table. It will ALWAYS be a positive value with the exception of the Adjustments or CycleCounts as this quantity is the value of the variance (which is stored on separate tables, merely trandferred to this table for convenience.)
Can someone please help me determine what I am doing wrong - bare in mind I am a complete novice, so easy on the terminology (lol). Thank you in advance! - Robert
PS If more information is required or this doesn't make sense, please let me know.
Last edited: