[AccessD] add numbers

Stuart McLachlan stuart at lexacorp.com.pg
Mon Apr 11 17:22:47 CDT 2005


On 11 Apr 2005 at 22:59, Pedro Janssen wrote:

> 
>what i would like is the total of numbers of field [Para],
>as result in a new field [Para_total].
> 4                  2(2ma)    = 2+2
> 3                  3(0v)        = 3+0
> 6                  2(2v+2a) = 2+2+2
> 

Create a function:
Function Addnumbers (InputString as String) as Long
   Dim lngStore as Long
   Dim lngLoopcount as Long
   Dim strTemp as String
   For LngLoopcount = 1 to len(InputString)
         lngStore = Val(Mid$(InputString,lngLoopcount,1))
   Next
   Addnumbers = lngStore
End Function

In your Query  put a calculated field:
Para_Total:AddNumbers([Para])-- 
Stuart





More information about the AccessD mailing list