[AccessD] add numbers

Bobby Heid bheid at appdevgrp.com
Tue Apr 12 06:43:05 CDT 2005


But if any of the numbers is greater than 9, this will not work properly.
It does look like it works ok for numbers less than 10.

Bobby

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Monday, April 11, 2005 6:23 PM
To: Access Developers discussion and problemsolving
Subject: Re: [AccessD] add numbers


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


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list