how to get value passed back from function.. 
Author Message
 how to get value passed back from function..

i have two fields in a query retrieve values passed back from functions.
the function is based on the same recordset.
is there a way to have two fields refer to the same fucntion but retrieve
different value being passed back by the fuction? currently, i have to
create two functions (basically the same, excepts the name of the function
and the value being passed back) and have each field refers to different
fucntion. it would be nice if I can just write one funciton and passed back
differnt value depends on what the filed in the query asks for.
thanks in advance.

steve



Sun, 13 Jan 2002 03:00:00 GMT  
 how to get value passed back from function..

Quote:

> i have two fields in a query retrieve values passed back from functions.
> the function is based on the same recordset.
> is there a way to have two fields refer to the same fucntion but retrieve
> different value being passed back by the fuction? currently, i have to
> create two functions (basically the same, excepts the name of the function
> and the value being passed back) and have each field refers to different
> fucntion. it would be nice if I can just write one funciton and passed back
> differnt value depends on what the filed in the query asks for.

        I think you need to an an extra "flag" param to the function that says,
in effect, "do this" or "do that" :

        Example query :

SELECT tblSuperset.Engineer,
        ConvertCase([Engineer],True) AS up,
        ConvertCase([Engineer],False) AS low
FROM tblSuperset;

        This example function uses a boolean as a "two-way" switch, but you
could make it an integer, and the function could perform many more
permutations :

Public Function ConvertCase(var As Variant, bUpper As Boolean) As String
   If Not IsNull(var) Then
      ConvertCase = IIf(bUpper, UCase$(CStr(var)), LCase$(CStr(var)))
   End If
End Function



Sun, 13 Jan 2002 03:00:00 GMT  
 how to get value passed back from function..
you could add another argument to the function (a constant, in your case say
1 or 2) and return a different value depending on which constant is passed
to the function
Quote:

>i have two fields in a query retrieve values passed back from functions.
>the function is based on the same recordset.
>is there a way to have two fields refer to the same fucntion but retrieve
>different value being passed back by the fuction? currently, i have to
>create two functions (basically the same, excepts the name of the function
>and the value being passed back) and have each field refers to different
>fucntion. it would be nice if I can just write one funciton and passed back
>differnt value depends on what the filed in the query asks for.
>thanks in advance.

>steve



Sun, 13 Jan 2002 03:00:00 GMT  
 how to get value passed back from function..
thanks for both of you.
the two fields in my query pass the same parameter (for example, a sales
person id)
but they want the function pass back different values based on same
recordset(may be one filed asks for total sales, and the other field asks
for # of sales).
the way i currently use is:(just an example here)
in the query
TotSales: GetSales(id)
CountOfSales:GetSalesCount(id)

can I consolidate this two functions into one? (since they are based on same
recordset, just different calculation). but when the function pass the
result back. i only know how to pass one at a time.

steve

Quote:

>i have two fields in a query retrieve values passed back from functions.
>the function is based on the same recordset.
>is there a way to have two fields refer to the same fucntion but retrieve
>different value being passed back by the fuction? currently, i have to
>create two functions (basically the same, excepts the name of the function
>and the value being passed back) and have each field refers to different
>fucntion. it would be nice if I can just write one funciton and passed back
>differnt value depends on what the filed in the query asks for.
>thanks in advance.

>steve



Sun, 13 Jan 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Passing a return value back

2. showModalDialog: Passing multiple values back from child

3. Getting values back from Oracle

4. Passing value back to a calling form.

5. Passing values back to batch file

6. Passing a Value from JavaScript back to ASP

7. Problem passing values from object back to ASP

8. Passing value back to UserControl from a form

9. Crystal Subreport - How to pass a value back from

10. Passing a value back to VB from an SQL server stored procedure

11. Pass variable value back to form from module

12. Getting back an identity field value after an insert SQL statement

 

 
Powered by phpBB® Forum Software