Dear Experts,
I need help. How can i get the sum of all Textbox in a form. Below is what i have done.
I want to display the total of :
45140
33090
18400
20600
4980
1680
Dear Experts,
I need help. How can i get the sum of all Textbox in a form. Below is what i have done.
I want to display the total of :
45140
33090
18400
20600
4980
1680
try =CLng(Me.text29) + CLng(Me.text31)+ CLng(Me.text33)...
Hi davegri,
Thank you for your response. I tried your formula but unfortunately it gives me an error.
Try just one textbox and see if that works. If so, then include another and another until error occurs. Maybe one (or all) the textbox names are not what you anticipate.
Another approach if you're willing to use VBA:
Make all 9 textboxes on the form Unbound
In the Form_Current event
Dim 8 variables as long, such as v1, v2, v3, etc
Do the DSums into each of the 8 variables
Then
me.text29=v1
me.txt31=v2
...
Then
Me.Total = v1+v2+v3...
Last edited by davegri; 05-17-2020 at 02:07 PM. Reason: clarif
Try to skip the Me. as Me is only available in VBA.
Cheers,
I tried multiple combinations, but still giving me an error and i am not much familiar with VBA codes.
Instead of all of those dSums why don't you build a totals query to sum them all up and then you can add up the fields in that query to give you the grand total.
Cheers,
Maybe if you attach an example file you will understand what you have done and therefore help you
Hi Carletto,
Please find below link for sample file
https://we.tl/t-9HYj3VhWvo
I think it may be better to attach your db to a post here, rather than at a third party site.
If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
Bob Fitzpatrick
Problem is null fields. Your posted example shows no nulls, but the download does.
Do it this way to account for nulls:
=Nz([text33])+Nz([Text35])+Nz([Text37])+Nz([Text39])+Nz([Text41])+Nz([Text43])
Hi Davegri,
Thank you soo much! This work perfectly.
Thanks a million
Glad to help. Good luck with the project!