[AccessD] Math in VBA

Gustav Brock Gustav at cactus.dk
Thu Jul 19 13:35:02 CDT 2007


Hi Mark

Numbers may be handled as Integer if unknown.

Specify as Long either:

ttt = CDec(36& * 36& * 36&)

or:

Dim tt As Variant
Dim ttt As Variant
Dim d As Long

d = 36
tt = CDec(d ^ 10)
ttt = CDec(d * d * d)

/gustav

>>> markamatte at hotmail.com 19-07-2007 20:13 >>>
Any ideas why ttt gives me an "OVERFLOW" error...but tt works just fine?

Thanks, Mark

Dim tt As Variant
Dim ttt As Variant
tt = CDec(36 ^ 10)
ttt = CDec(36 * 36 * 36)


>From: "Gustav Brock" <Gustav at cactus.dk>
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: <accessd at databaseadvisors.com>
>Subject: Re: [AccessD] Math in VBA
>Date: Thu, 19 Jul 2007 18:56:38 +0200
>
>Hi Mark
>
>That range is beyond the capacity of Currency, so your only chance without 
>losing accuracy is probably to use a Variant with the subtype Decimal which 
>can hold +/-79.228.162.514.264.337.593.543.950.335 with no decimals.
>
>   Dim decNum As Variant
>   decNum = CDec("9999999999999999")
>
>/gustav
>
> >>> markamatte at hotmail.com 19-07-2007 17:10 >>>
>Hello All,
>
>This is just a 'mild' form of encryption...but I need to use math(+-*/) with
>numbers up to 16 digits(9,999,999,999,999,999)...
>
>Is there any way to do this without losing accuracy in VBA?
>
>Thanks,
>
>Mark A. Matte





More information about the AccessD mailing list