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  

recalculating values in a subform



 
 
Thread Tools Display Modes
  #1  
Old September 17th, 2009, 03:28 PM posted to microsoft.public.access.forms
ronytimm
external usenet poster
 
Posts: 11
Default recalculating values in a subform

I have a subform where price, quantity and discount are entered and then
total net value is calculated. I have tried everything but the recalculation
does not happen automatically when these values (or one of these values) is
entered or changed. I call a requery to update the data in the underlying
table, and have linked this query to several event property (on change, after
update, etc...) but it simply doesn't work. I have now added a button on the
form to "recalculate" and that works, but I would prefer if the recalculation
would happen immediatly and automatically.

can someone pls advice pls?
thnx
  #2  
Old September 17th, 2009, 03:44 PM posted to microsoft.public.access.forms
Darrell Childress[_2_]
external usenet poster
 
Posts: 17
Default recalculating values in a subform

If everything is working as you'd like when you hit the "recalculate"
button, but you just don't want to have to hit the button and have it
happen automatically, you could simply enter code that says Me.Requery
in the After Update event of the price, quantity, and discount fields.

ronytimm wrote:
I have a subform where price, quantity and discount are entered and then
total net value is calculated. I have tried everything but the recalculation
does not happen automatically when these values (or one of these values) is
entered or changed. I call a requery to update the data in the underlying
table, and have linked this query to several event property (on change, after
update, etc...) but it simply doesn't work. I have now added a button on the
form to "recalculate" and that works, but I would prefer if the recalculation
would happen immediatly and automatically.

can someone pls advice pls?
thnx

  #3  
Old September 17th, 2009, 03:57 PM posted to microsoft.public.access.forms
ronytimm
external usenet poster
 
Posts: 11
Default recalculating values in a subform

Darell,

OK, I see what you mean, but how do I set the code. Just copy from the
select statement in the query, which is
UPDATE Offerte_Detail SET Offerte_Detail.Detail_Nettolijn =
(([Detail_aantal]*[Detail_Eenheidsprijs]))*(1-[Detail_Korting]/100);

If I enter this I get an error in VB. I assume I need to set different
paranthis and allocades. Does the me.requery com after the statement or
before?

Sorry, not very experienced in this... thnx


"Darrell Childress" wrote:

If everything is working as you'd like when you hit the "recalculate"
button, but you just don't want to have to hit the button and have it
happen automatically, you could simply enter code that says Me.Requery
in the After Update event of the price, quantity, and discount fields.

ronytimm wrote:
I have a subform where price, quantity and discount are entered and then
total net value is calculated. I have tried everything but the recalculation
does not happen automatically when these values (or one of these values) is
entered or changed. I call a requery to update the data in the underlying
table, and have linked this query to several event property (on change, after
update, etc...) but it simply doesn't work. I have now added a button on the
form to "recalculate" and that works, but I would prefer if the recalculation
would happen immediatly and automatically.

can someone pls advice pls?
thnx


  #4  
Old September 17th, 2009, 04:27 PM posted to microsoft.public.access.forms
Darrell Childress[_2_]
external usenet poster
 
Posts: 17
Default recalculating values in a subform

If you want to put the code in the After Update Event, it would be
something like:

Me.NetTotal = Me.Detail_aantal* Me.Detail_Eenheidsprijs *
(1-Me.Detail_Korting)/100
***change NetTotal to whatever is the field name of your field that
shows the total.

If you do this, you would not need to do the requery (someone may want
to verify this, I'm not an expert)

ronytimm wrote:
Darell,

OK, I see what you mean, but how do I set the code. Just copy from the
select statement in the query, which is
UPDATE Offerte_Detail SET Offerte_Detail.Detail_Nettolijn =
(([Detail_aantal]*[Detail_Eenheidsprijs]))*(1-[Detail_Korting]/100);

If I enter this I get an error in VB. I assume I need to set different
paranthis and allocades. Does the me.requery com after the statement or
before?

Sorry, not very experienced in this... thnx


"Darrell Childress" wrote:

If everything is working as you'd like when you hit the "recalculate"
button, but you just don't want to have to hit the button and have it
happen automatically, you could simply enter code that says Me.Requery
in the After Update event of the price, quantity, and discount fields.

ronytimm wrote:
I have a subform where price, quantity and discount are entered and then
total net value is calculated. I have tried everything but the recalculation
does not happen automatically when these values (or one of these values) is
entered or changed. I call a requery to update the data in the underlying
table, and have linked this query to several event property (on change, after
update, etc...) but it simply doesn't work. I have now added a button on the
form to "recalculate" and that works, but I would prefer if the recalculation
would happen immediatly and automatically.

can someone pls advice pls?
thnx



  #5  
Old September 17th, 2009, 04:44 PM posted to microsoft.public.access.forms
ronytimm
external usenet poster
 
Posts: 11
Default recalculating values in a subform

works like a charm. Thnx!!

"Darrell Childress" wrote:

If you want to put the code in the After Update Event, it would be
something like:

Me.NetTotal = Me.Detail_aantal* Me.Detail_Eenheidsprijs *
(1-Me.Detail_Korting)/100
***change NetTotal to whatever is the field name of your field that
shows the total.

If you do this, you would not need to do the requery (someone may want
to verify this, I'm not an expert)

ronytimm wrote:
Darell,

OK, I see what you mean, but how do I set the code. Just copy from the
select statement in the query, which is
UPDATE Offerte_Detail SET Offerte_Detail.Detail_Nettolijn =
(([Detail_aantal]*[Detail_Eenheidsprijs]))*(1-[Detail_Korting]/100);

If I enter this I get an error in VB. I assume I need to set different
paranthis and allocades. Does the me.requery com after the statement or
before?

Sorry, not very experienced in this... thnx


"Darrell Childress" wrote:

If everything is working as you'd like when you hit the "recalculate"
button, but you just don't want to have to hit the button and have it
happen automatically, you could simply enter code that says Me.Requery
in the After Update event of the price, quantity, and discount fields.

ronytimm wrote:
I have a subform where price, quantity and discount are entered and then
total net value is calculated. I have tried everything but the recalculation
does not happen automatically when these values (or one of these values) is
entered or changed. I call a requery to update the data in the underlying
table, and have linked this query to several event property (on change, after
update, etc...) but it simply doesn't work. I have now added a button on the
form to "recalculate" and that works, but I would prefer if the recalculation
would happen immediatly and automatically.

can someone pls advice pls?
thnx




 




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 11:45 PM.


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