A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macro Not Running



 
 
Thread Tools Display Modes
  #1  
Old December 11th, 2006, 05:22 PM posted to microsoft.public.access.forms
awach
external usenet poster
 
Posts: 198
Default 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  
Old December 11th, 2006, 05:39 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default 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  
Old December 11th, 2006, 06:07 PM posted to microsoft.public.access.forms
awach
external usenet poster
 
Posts: 198
Default 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  
Old December 11th, 2006, 06:24 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default 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  
Old December 12th, 2006, 07:54 PM posted to microsoft.public.access.forms
awach
external usenet poster
 
Posts: 198
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:45 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.