Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return value from function?

Status
Not open for further replies.

geralf

Technical User
Apr 7, 2003
44
MX
Hi,

I have a query as source for a form. In the query there are several expressions that calls different functions in a module. These functions should all return numeric data, but are returned as string/variant types. So when I use these expressions run in the query in a form, and try to format as a number ie. # ##0, it don't work. How do I solve this in the most efficient way?

Thanks in advance

Gerhard
 
Sounds like your functions are returning variant type data (the default).

To get your functions to return data declare them appropriately; for example:

Function Add2Numbers (a, b)
Add2Numbers = a + b
End Function

might be better declared as:

Function Add2Numbers (a, b) AS Double
Add2Numbers = a + b
End Function

The latter, when used in your SQL, should return a numeric value, which should format appropriately.



Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
Hi Steve

Thanks for your fast reply, and your solutionn which worked very nice. Thanks very much for the help

Regards
Gerhard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top