I
InventoryQueryGuy
I have this update query that needs more functionality, can anyone help
please?!
UPDATE ToolData AS T INNER JOIN ToolCribSignOut AS S ON
T.ToolCribDesignation=S.ToolCribDesignation SET T.Inventory =
T.Inventory+S.ReturnQuantity
WHERE S.[TIMESTAMP] = (SELECT MAX([TIMESTAMP]) FROM ToolCribSignOut);
Now I need to add a bit of a more complicated function to it:
if the T.Inventory is now greater than the T.MinQuantity then determine the
time difference in days between LeadStart and Now. This value needs to
multiply the result of:
UPDATE ToolData AS T SET T.MinQuantity =
(DSum("SignOutQuantity","ToolCribSignOut","[ToolCribDesignation] = '" &
T.ToolCribDesignation & "' AND [DateModified] >= DateSerial(Year(Date()),
Month(Date()) -3, Day(Date()))")/90)*1.2; (multiply here by date difference
in days)
.....which i need to run only for the current record. After all this i need
the T.LeadStart to be cleared of any value.
If the inventory is still not larger than MinQuantity then i don't want the
second update portion to run.
I may be in over my head here!
In brief: run Update1, next if Inventory > MinQuantity then take difference
between LeadStart and Now, multiply the result of Update 2 by this value
(that was calculated in days) and clear LeadStart, else only run Update 1
Again, any help or suggestions are welcomed.
please?!
UPDATE ToolData AS T INNER JOIN ToolCribSignOut AS S ON
T.ToolCribDesignation=S.ToolCribDesignation SET T.Inventory =
T.Inventory+S.ReturnQuantity
WHERE S.[TIMESTAMP] = (SELECT MAX([TIMESTAMP]) FROM ToolCribSignOut);
Now I need to add a bit of a more complicated function to it:
if the T.Inventory is now greater than the T.MinQuantity then determine the
time difference in days between LeadStart and Now. This value needs to
multiply the result of:
UPDATE ToolData AS T SET T.MinQuantity =
(DSum("SignOutQuantity","ToolCribSignOut","[ToolCribDesignation] = '" &
T.ToolCribDesignation & "' AND [DateModified] >= DateSerial(Year(Date()),
Month(Date()) -3, Day(Date()))")/90)*1.2; (multiply here by date difference
in days)
.....which i need to run only for the current record. After all this i need
the T.LeadStart to be cleared of any value.
If the inventory is still not larger than MinQuantity then i don't want the
second update portion to run.
I may be in over my head here!
In brief: run Update1, next if Inventory > MinQuantity then take difference
between LeadStart and Now, multiply the result of Update 2 by this value
(that was calculated in days) and clear LeadStart, else only run Update 1
Again, any help or suggestions are welcomed.