Eric -Thank you so much, the Macro is working !!!
I have another problem, maybe you can help me with that: all this macro is
for database that I’m building for Work Orders. I have Form that have
following fields:
Primary key- PM#-auto number.
Job Plan #
JP# Name
Equipment
Location
Frequency: X months
Status: a list of different statuses
Scheduled date:
Next Scheduled Date: (Query: DateAdd-that calculating the scheduled date
+frequency).
What I am doing is: when the status of the PM is “Completed†it will open a
new record in this form (new row) with the same JP#, JP Name, Equipment,
Location-from the original PM and Next Scheduled Date now become the
Scheduled Date, and the new Next Scheduled date will calculated from the
query as before. The purpose is to have a new PM for the same Equipment that
scheduled to next scheduled date. Is it making sense?
The problem is on the duplicated PM the Next_Scheduled_Date stayed the same,
as well the Scheduled Date. I tried to add the DateAdd calculation to the
Scheduled date on the Append Query in order that it will calculate the new
date according to the frequency, but it's not working. Neither the Next
Scheduled Date. What am I missing again?
I’m really appreciate your help.
Eric Blitzer said:
It should be put in a vb module not in the line of the after update event
if me.[Status]=â€Completed†then
DoCmd.RunMacro â€mcrAppendPmsâ€
end if
:
When I'm living the if open it's giving me "Compile Error Expected: )
But when I'm closing the IIF, it's fiving new Compile error Syntax error.
:
I think I see
Instead of putting on the line of the after update event put a [ and the
click on the three ...
That will open a vb module trhen put
if([Status]=â€Completed†then
DoCmd.RunMacro â€mcrAppendPmsâ€
I do not think the macro name can have a ' in it
rename it to mcrAppendpms
:
At first, thank you so much for the quick response and the help!
the error is: "The expression you entered contains invalid syntax or you
need to enclose your text data in quotes".
My line After Undeta Event says:" =iif
me.([Status]="Comp-Completed",DoCmd.RunMacro"mcrAppendPm's")"
Where am I wrong?
Thanks again.
:
What is the error msg
Does your run macro line look like this?
Docmd.RunMacro "MacroName"
:
It’s giving an error; I think I’m missing something –a dot or a comma or
something else.
Thanks again for your help.
:
I think you want
if me.[status] ="Completed" then
docmd.runmacro......
else
end if
:
I have Macro that Opens Append Query. I would like to assign that Macro into
the Form in After Update Event that would say: when Status is “Completed†run
the Macro, else lives the previous Status.
I started to write the IIF expression, but it’s not working:
=iif([Status]=â€Completedâ€,DoCmd.RunMacroâ€mcrAppendPm’sâ€)
What am I doing wrong?
Thanks a lot for any help.