464,360 Members | 1,382 Online
Need help? Post your question and get tips & solutions from a community of 464,360 IT Pros & Developers. It's quick & easy.

# percent calculation

 100+ P: 556 hi there i cant figure out how to get a percentage from a form i have created maybe one of you people can help me. the form i have has all of this on it: date,new orders,new, used,replacement orders,new contract,short in bundles, total,total new, used total,total percent. i have copied and pasted a (totalpercent) textbox on the form footer to calculate the total sum of the (total percent) now i need to divide what ever is in the (sum of totalpercent) by how many days are in the date column...for instance if there are only three dates then i would divide whatever is the total of the (sum of totalpercent) by 3 to get a percentage of that week or if there was 4 dates i would divide the (sum of totalpercent) by 4 to get a percent of that week. i have had buttons on this form to calculate this but i don't want buttons i want the percent to show up as soon as i start putting numbers in the form so i can print a report and have it ready to print. i hope this is understandable to who ever reads this. if you can imagine how this form looks you would see a column of date. a column of new orders, a column of used. and sofourth. if you can help that would be great if not direct me to someone or a page that will thanks, lee123 May 25 '07 #1
5 Replies

 Expert Mod 10K+ P: 14,534 You need a textbox set to something like this .... Expand|Select|Wrap|Line Numbers =Sum([total percent]) / Count([date])   May 26 '07 #2

 100+ P: 556 ok..heres what i did after reading you code i tried what you put down and in front of (=sum) i put the text box name and put your code in ...but i put it in the (after update) event and ran the code but nothing happened then...i tried the forms (on current) event and nothing......am i suppose to use the name of the textboxes or the control names i get confused with this because in this form i have been using the name of the text boxes and not the control names so is that why there is nothing happening... to make this short i have been using these names: totalpercent: (which is the one in the detail section) this is the one i have copied and pasted in the form footer to get the total percent..(which i had to put this code in the control: =sum(totalpercent) to get the sum of the totalpercent from the one in the detailed section. then I copied that textbox ... to put one for the whole percentage of the week is this understandable.....to wrap this up i now have two text boxes in the form footer one is to add up all the (totalpercent) and the other is for the whole percentage( which i named totalpercentbox with no control.) May 26 '07 #3

 Expert Mod 10K+ P: 14,534 ok..heres what i did after reading you code i tried what you put down and in front of (=sum) i put the text box name and put your code in ...but i put it in the (after update) event and ran the code but nothing happened then...i tried the forms (on current) event and nothing......am i suppose to use the name of the textboxes or the control names i get confused with this because in this form i have been using the name of the text boxes and not the control names so is that why there is nothing happening... to make this short i have been using these names: totalpercent: (which is the one in the detail section) this is the one i have copied and pasted in the form footer to get the total percent..(which i had to put this code in the control: =sum(totalpercent) to get the sum of the totalpercent from the one in the detailed section. then I copied that textbox ... to put one for the whole percentage of the week is this understandable.....to wrap this up i now have two text boxes in the form footer one is to add up all the (totalpercent) and the other is for the whole percentage( which i named totalpercentbox with no control.) Simply put the code I gave you in the control source of the second textbox May 26 '07 #4

 100+ P: 556 thank you for your help i dont know why i didnt think about that because i was about to put it into the default value but wasn't sure it would work. didn't think of the control source.... thanks for your help, lee123 May 26 '07 #5

 Expert Mod 10K+ P: 14,534 thank you for your help i dont know why i didnt think about that because i was about to put it into the default value but wasn't sure it would work. didn't think of the control source.... thanks for your help, lee123 You're welcome. May 26 '07 #6