Can you spot the Syntax error??

G

Guest

My SQL isn't so good, but I know what I want to do.
Can anybody spot the errors and perhaps help me make a change to it?

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) and if
T.Inventory > T.MinQuantity then save datediff('d',[LeadStart],[Date()]) as
diff where LeadStart <> "", 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*diff then set LeadStart as NZ;

Thanks :)
 
G

Guest

Sorry that is wrong: this is the right code i'm after.

UPDATE ToolData AS T if T.Inventory>T.MinQuantity and T.LeadStart<> "" then
save datediff('d',[T.LeadStart],[Date()]) as diff and SET T.MinQuantity =
(DSum("SignOutQuantity","ToolCribSignOut","[ToolCribDesignation] = '" &
T.ToolCribDesignation & "' AND [DateModified] >= DateSerial(Year(Date()),
Month(Date()) -3, Day(Date()))")/90)*1.2*diff and then SET T.LeadStart as NZ;
 
G

Guest

Sorry again, here we go:

UPDATE ToolData AS T IF T.LeadStart <> NZ THEN SET T.MinQuantity =
(DSum("SignOutQuantity","ToolCribSignOut","[ToolCribDesignation] = '" &
T.ToolCribDesignation & "' AND [DateModified] >= DateSerial(Year(Date()),
Month(Date()) -3, Day(Date()))")/90)*1.2*datediff('d',[T.LeadStart],Date())
AND SET T.LeadStart as NZ;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top