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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|