Hi all,
I have a query named Inventory_Warning_Query which is designed to display the products that have an inventory value projected to fall below zero, when factoring in a new production date. The results are shown in a report and act as a warning when the production date is entered so it can be amended to a suitable date when the required stock is next available. This query is part of a chain of queries (shown in the attachment) and it does work as intended, however it is quite slow to run. I know that the speed to run these queries will be a problem when users start to use it so I think I need to go a different route and use VBA instead.
The queries can be broken down to the following steps:
Thanks so much,
Chris
I have a query named Inventory_Warning_Query which is designed to display the products that have an inventory value projected to fall below zero, when factoring in a new production date. The results are shown in a report and act as a warning when the production date is entered so it can be amended to a suitable date when the required stock is next available. This query is part of a chain of queries (shown in the attachment) and it does work as intended, however it is quite slow to run. I know that the speed to run these queries will be a problem when users start to use it so I think I need to go a different route and use VBA instead.
The queries can be broken down to the following steps:
- Identify the product codes relevant for use in production of the shipment in question
- Filter the table containing the bill of materials (BOM) data for all products to only include products relevant for use in production (these first two steps were included to speed up the process and are not essential)
- Calculate the BOM data for all shipments using the results from step 2 (or all product data if not including the first two steps)
- Identify the maximum production date for all products found in step 3
- Identify the goods in records where the due in date is less than or equal to the max production dates found in step 4
- Sum the goods in records from step 5
- Sum the BOM data from step 3
- Identify the goods in records where the due in date is greater than the max production date
- Calculate the projected inventory for each product code using the summed values from step 6 and 7
- Merge the projected inventory information (step 9) with postproduction goods in data (step 8) where applicable
- Inventory_Warning_Query - only includes records where the projected inventory is less than zero. Includes the production record ID referencing the form where the production date is entered. Includes the BOM data relevant to production so the required quantity can be included in the report, alongside the projected inventory value
Thanks so much,
Chris