Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Sum of a returned value from a Function Procedure


Message #1 by pmcmillin@m... on Mon, 21 May 2001 10:49:56 -0500
--=====================_6116364==_.ALT

Content-Type: text/plain; charset="us-ascii"; format=flowed



How do you get the sum of a value returned from a Function procedure after 

it has been passed and returned?  I have a function written to create 

information in my detailed section of my report and now I am needing to get 

a sum at the end of the report.   Someone else wrote this function for me 

so I don't know where to go in and put this Sum feature.



I have the Format property of the detailed section call the Function and 

return the proper value.  Now at the Reporter Footer I need that to do a 

Sum of the returned values.   Can someone help with this matter?



Thanks in advance.







Pam McMillin

Systems Technician



Schlumberger - IPM Asset Management

500 W. Texas, Suite 500

P.O. Box 2726

Midland, TX 79702-2726

Office 915/571-4600

Cell 915/556-0749

Fax 915/571-4788

pmcmillin@m...






Message #2 by "Pardee, Roy E" <roy.e.pardee@l...> on Mon, 21 May 2001 09:36:31 -0700
You may actually be better off summing the values of the control that shows

the returned values.  Let's say that control is a text box called

txtFuncResult.  You could draw a new box called txtSumOfFuncs and set its

control source to



=Sum(txtFuncResult)



I believe that will get you what you want...



HTH,



-Roy





-----Original Message-----

From: pmcmillin@m... [mailto:pmcmillin@m...]

Sent: Monday, May 21, 2001 8:50 AM

To: Access

Subject: [access] Sum of a returned value from a Function Procedure





How do you get the sum of a value returned from a Function procedure after

it has been passed and returned?  I have a function written to create

information in my detailed section of my report and now I am needing to get

a sum at the end of the report.   Someone else wrote this function for me so

I don't know where to go in and put this Sum feature.



I have the Format property of the detailed section call the Function and

return the proper value.  Now at the Reporter Footer I need that to do a Sum

of the returned values.   Can someone help with this matter?



Thanks in advance.







Pam McMillin

Systems Technician



Schlumberger - IPM Asset Management

500 W. Texas, Suite 500

P.O. Box 2726

Midland, TX 79702-2726

Office 915/571-4600

Cell 915/556-0749

Fax 915/571-4788

pmcmillin@m... 




Message #3 by pmcmillin@m... on Mon, 21 May 2001 13:54:21 -0500
I tried that and it didn't work.  It prompted me "Enter Parameter Value" 

and then never showed anything.  Any other suggestions?



At 11:36 AM 5/21/2001, you wrote:

>You may actually be better off summing the values of the control that shows

>the returned values.  Let's say that control is a text box called

>txtFuncResult.  You could draw a new box called txtSumOfFuncs and set its

>control source to

>

>=Sum(txtFuncResult)

>

>I believe that will get you what you want...

>

>HTH,

>

>-Roy

>

>

>-----Original Message-----

>From: pmcmillin@m... [mailto:pmcmillin@m...]

>Sent: Monday, May 21, 2001 8:50 AM

>To: Access

>Subject: [access] Sum of a returned value from a Function Procedure

>

>

>How do you get the sum of a value returned from a Function procedure after

>it has been passed and returned?  I have a function written to create

>information in my detailed section of my report and now I am needing to get

>a sum at the end of the report.   Someone else wrote this function for me so

>I don't know where to go in and put this Sum feature.

>

>I have the Format property of the detailed section call the Function and

>return the proper value.  Now at the Reporter Footer I need that to do a Sum

>of the returned values.   Can someone help with this matter?

>

>Thanks in advance.

>

>

>

>Pam McMillin

>Systems Technician

>

>Schlumberger - IPM Asset Management

>500 W. Texas, Suite 500

>P.O. Box 2726

>Midland, TX 79702-2726

>Office 915/571-4600

>Cell 915/556-0749

>Fax 915/571-4788

>pmcmillin@m...

>
Message #4 by "Pardee, Roy E" <roy.e.pardee@l...> on Mon, 21 May 2001 13:57:48 -0700
Ach, I see now that I have given you bad advice--it looks like Access wants

you to use the Sum() function with a field from the form's recordsource

only--not the name of a control on the form.  Sorry about that.  I also

tried just referring to the base control itself and setting the Running Sum

property to various things--no dice there either.



If your function is one that gets calculated once for each row in the

report's underlying query, I would move it to the query that's feeding the

report, and then sum it as if it were any old numeric field.  That is, give

your function call an alias like "FuncResult", and take the code out of your

detail's format event.  Bind the function control to the FuncResult 'field'.

Now set the control source of your sum control to "=[FuncResult]" (don't

forget the equal sign) and set the Running Sum property to Over All.



Hope that helps,



-Roy



P.S. If you need to put this sum in the page footer, see

http://www.mvps.org/access/reports/rpt0004.htm







-----Original Message-----

From: pmcmillin@m...

[mailto:pmcmillin@m...]

Sent: Monday, May 21, 2001 11:54 AM

To: Access

Subject: [access] RE: Sum of a returned value from a Function Procedure





I tried that and it didn't work.  It prompted me "Enter Parameter Value" 

and then never showed anything.  Any other suggestions?



At 11:36 AM 5/21/2001, you wrote:

>You may actually be better off summing the values of the control that shows

>the returned values.  Let's say that control is a text box called

>txtFuncResult.  You could draw a new box called txtSumOfFuncs and set its

>control source to

>

>=Sum(txtFuncResult)

>

>I believe that will get you what you want...

>

>HTH,

>

>-Roy

>

>

>-----Original Message-----

>From: pmcmillin@m... [mailto:pmcmillin@m...]

>Sent: Monday, May 21, 2001 8:50 AM

>To: Access

>Subject: [access] Sum of a returned value from a Function Procedure

>

>

>How do you get the sum of a value returned from a Function procedure after

>it has been passed and returned?  I have a function written to create

>information in my detailed section of my report and now I am needing to get

>a sum at the end of the report.   Someone else wrote this function for me

so

>I don't know where to go in and put this Sum feature.

>

>I have the Format property of the detailed section call the Function and

>return the proper value.  Now at the Reporter Footer I need that to do a

Sum

>of the returned values.   Can someone help with this matter?

>

>Thanks in advance.

>

>

>

>Pam McMillin

>Systems Technician

>

>Schlumberger - IPM Asset Management

>500 W. Texas, Suite 500

>P.O. Box 2726

>Midland, TX 79702-2726

>Office 915/571-4600

>Cell 915/556-0749

>Fax 915/571-4788

>pmcmillin@m...

>




Message #5 by "David Moore" <david.moore@c...> on Tue, 22 May 2001 17:29:14
As far as I know you can't sum on a function like this.  There are a 

couple of ways to do what you want to do:



1. Put you function in a field as an expression in the underlying query 

for the report and then use a bound textbox to that field.  Then you can 

use the =sum(fieldname) syntax in a textbox in the footer of your report.



2. Write another custom function that will return the sum of the values 

generated by the first function.  Use this function in your report footer.



Hope that helps



dave



> --=====================_6116364==_.ALT

> Content-Type: text/plain; charset="us-ascii"; format=flowed

> 

> How do you get the sum of a value returned from a Function procedure 

after 

> it has been passed and returned?  I have a function written to create 

> information in my detailed section of my report and now I am needing to 

get 

> a sum at the end of the report.   Someone else wrote this function for 

me 

> so I don't know where to go in and put this Sum feature.

> 

> I have the Format property of the detailed section call the Function and 

> return the proper value.  Now at the Reporter Footer I need that to do a 

> Sum of the returned values.   Can someone help with this matter?

> 

> Thanks in advance.

> 

> 

> 

> Pam McMillin

> Systems Technician

> 

> Schlumberger - IPM Asset Management

> 500 W. Texas, Suite 500

> P.O. Box 2726

> Midland, TX 79702-2726

> Office 915/571-4600

> Cell 915/556-0749

> Fax 915/571-4788

> pmcmillin@m...

> 

> --=====================_6116364==_.ALT

> Content-Type: text/html; charset="us-ascii"

> 

> <html>

> How do you get the sum of a value returned from a Function procedure

> after it has been passed and returned?  I have a function written to

> create information in my detailed section of my report and now I am

> needing to get a sum at the end of the report.   Someone else

> wrote this function for me so I don't know where to go in and put this

> Sum feature.<br>

> <br>

> I have the Format property of the detailed section call the Function and

> return the proper value.  Now at the Reporter Footer I need that to

> do a Sum of the returned values.   Can someone help with this

> matter?<br>

> <br>

> Thanks in advance.<br>

> <br>

> <br>

> <x-sigsep><p></x-sigsep>

> <font size=4><b>Pam McMillin<br>

> </b></font><font face="MS Sans Serif, Geneva">Systems Technician<br>

> <br>

> </font><font face="MS Sans Serif, Geneva" size=4 

color="#0000FF"><b>Schlumberger

> - IPM</b> Asset Management<br>

> </font><font face="MS Sans Serif, Geneva" size=2 color="#808080">500 W.

> Texas, Suite 500<br>

> P.O. Box 2726<br>

> Midland, TX 79702-2726<br>

> Office 915/571-4600<br>

> Cell 915/556-0749<br>

> Fax 915/571-4788<br>


  Return to Index