macro in a query?

  • Thread starter Thread starter Guest
  • Start date Start date
I really doubt you can do this. If you provided some requirements of what
you have and what you would like to accomplish, we might be able to suggest
a solution.
 
Thanks Duane. I just thought it might make a good solution to my problem, but
i know that i could also just trigger the macro to run the query and then a
macro.

...Could you take a look at my syntax here and see whats up with it?

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;

Cheers.
 
I'm not sure what database you are working in but your SQL should not work.
NZ is a function name so I would not use it as a field name. Also, an update
query contains only one "SET". Try something like:

UPDATE tblMyTable
SET [fieldA] = ....,
[FieldB]= .....
WHERE [FieldC] = ....;

You can use IIf() in place of "IF THEN".


--
Duane Hookom
MS Access MVP

InventoryQueryGuy said:
Thanks Duane. I just thought it might make a good solution to my problem,
but
i know that i could also just trigger the macro to run the query and then
a
macro.

..Could you take a look at my syntax here and see whats up with it?

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;

Cheers.




Duane Hookom said:
I really doubt you can do this. If you provided some requirements of what
you have and what you would like to accomplish, we might be able to
suggest
a solution.

--
Duane Hookom
MS Access MVP

in
message news:[email protected]...
 
Back
Top