If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Macro Not Running
I created a macro that stores a calculated value from a field in my form
(FieldA) to another field that will be stored in a table(FieldB). (I know that you normally shouldn't store calculated values but in this case it was necessary.) I created a macro that used the SetValue action to set the value of FieldB to the value in FieldA (so that the value can be stored in the table). I created a command button that runs the macro OnClick and it works. However, I want the macro to run when FieldA is updated. I tried putting the macro under the OnUpdate property of FieldA but it isn't working. I tried putting it on all on the On...Properties and it doesn't work. Is there a problem because it's a calculated value? How can I run the macro without using a command button? Thanks. |
#2
|
|||
|
|||
Macro Not Running
Is it really necessary to store this calculated value? What is it about this
value that makes it so it can't be calculated whenever you need to display it? Have you tried: Docmd.RunMacro "MyMacroName" In the After Update event of FieldA "awach" wrote: I created a macro that stores a calculated value from a field in my form (FieldA) to another field that will be stored in a table(FieldB). (I know that you normally shouldn't store calculated values but in this case it was necessary.) I created a macro that used the SetValue action to set the value of FieldB to the value in FieldA (so that the value can be stored in the table). I created a command button that runs the macro OnClick and it works. However, I want the macro to run when FieldA is updated. I tried putting the macro under the OnUpdate property of FieldA but it isn't working. I tried putting it on all on the On...Properties and it doesn't work. Is there a problem because it's a calculated value? How can I run the macro without using a command button? Thanks. |
#3
|
|||
|
|||
Macro Not Running
Unfortunately, I do have to store this value-it's very complex and involves
pulling values from many other subforms and is just too complex to do each time I need to pull it up. I tried the afterupdate and it's not working. I know that the macro works because the button works. So, does the afterupdate have an issue? Does is not count as an "update" if it is a calculated field (field as is updated and the values are changed in the subforms and is a sum of those values, i.e. calculated). What can I do? "Klatuu" wrote: Is it really necessary to store this calculated value? What is it about this value that makes it so it can't be calculated whenever you need to display it? Have you tried: Docmd.RunMacro "MyMacroName" In the After Update event of FieldA "awach" wrote: I created a macro that stores a calculated value from a field in my form (FieldA) to another field that will be stored in a table(FieldB). (I know that you normally shouldn't store calculated values but in this case it was necessary.) I created a macro that used the SetValue action to set the value of FieldB to the value in FieldA (so that the value can be stored in the table). I created a command button that runs the macro OnClick and it works. However, I want the macro to run when FieldA is updated. I tried putting the macro under the OnUpdate property of FieldA but it isn't working. I tried putting it on all on the On...Properties and it doesn't work. Is there a problem because it's a calculated value? How can I run the macro without using a command button? Thanks. |
#4
|
|||
|
|||
Macro Not Running
Did you trace the code to see if the After Update event is firing?
Since this is an unbound control, it may not fire at all. Try using the Lost Focus event. "awach" wrote: Unfortunately, I do have to store this value-it's very complex and involves pulling values from many other subforms and is just too complex to do each time I need to pull it up. I tried the afterupdate and it's not working. I know that the macro works because the button works. So, does the afterupdate have an issue? Does is not count as an "update" if it is a calculated field (field as is updated and the values are changed in the subforms and is a sum of those values, i.e. calculated). What can I do? "Klatuu" wrote: Is it really necessary to store this calculated value? What is it about this value that makes it so it can't be calculated whenever you need to display it? Have you tried: Docmd.RunMacro "MyMacroName" In the After Update event of FieldA "awach" wrote: I created a macro that stores a calculated value from a field in my form (FieldA) to another field that will be stored in a table(FieldB). (I know that you normally shouldn't store calculated values but in this case it was necessary.) I created a macro that used the SetValue action to set the value of FieldB to the value in FieldA (so that the value can be stored in the table). I created a command button that runs the macro OnClick and it works. However, I want the macro to run when FieldA is updated. I tried putting the macro under the OnUpdate property of FieldA but it isn't working. I tried putting it on all on the On...Properties and it doesn't work. Is there a problem because it's a calculated value? How can I run the macro without using a command button? Thanks. |
#5
|
|||
|
|||
Macro Not Running
I'm not sure how you trace the code.
I tried using the LostFocus event and even that doesn't work. It is an unbound control. I'm not sure what else to try.? "Klatuu" wrote: Did you trace the code to see if the After Update event is firing? Since this is an unbound control, it may not fire at all. Try using the Lost Focus event. "awach" wrote: Unfortunately, I do have to store this value-it's very complex and involves pulling values from many other subforms and is just too complex to do each time I need to pull it up. I tried the afterupdate and it's not working. I know that the macro works because the button works. So, does the afterupdate have an issue? Does is not count as an "update" if it is a calculated field (field as is updated and the values are changed in the subforms and is a sum of those values, i.e. calculated). What can I do? "Klatuu" wrote: Is it really necessary to store this calculated value? What is it about this value that makes it so it can't be calculated whenever you need to display it? Have you tried: Docmd.RunMacro "MyMacroName" In the After Update event of FieldA "awach" wrote: I created a macro that stores a calculated value from a field in my form (FieldA) to another field that will be stored in a table(FieldB). (I know that you normally shouldn't store calculated values but in this case it was necessary.) I created a macro that used the SetValue action to set the value of FieldB to the value in FieldA (so that the value can be stored in the table). I created a command button that runs the macro OnClick and it works. However, I want the macro to run when FieldA is updated. I tried putting the macro under the OnUpdate property of FieldA but it isn't working. I tried putting it on all on the On...Properties and it doesn't work. Is there a problem because it's a calculated value? How can I run the macro without using a command button? Thanks. |
Thread Tools | |
Display Modes | |
|
|