[AccessD] Wrong number of arguments

Mark A Matte markamatte at hotmail.com
Wed Apr 9 15:03:21 CDT 2008


Oops...I knew that...forgot about it.

I got around it by creating a function that did the comparison and the math...and passed the variables needed through the query.  

See AIR Code below for concept...

Good Luck,

Mark A. Matte

*********Start in Query***********
Select  MyDEC_Function([SumOf3mo_rbi],[Allocations]![Factor_1],[3mo_rbi]) as MyField from tblMytable;

*********ENDin Query***********


*********START in Module*****************
Function MyDEC_Function ( SumOf3mo,Factor1,3mo )

  if SumOf3mo = 0 then
       MyDec_Function = CDEC(Factor1)
else
      MyDec_Function = CDEC(3mo/SumOf3mo)
end if
 
Exit Function

*********END in Module*****************
> Date: Wed, 9 Apr 2008 13:32:56 -0500
> From: Chester_Kaup at kindermorgan.com
> To: accessd at databaseadvisors.com
> Subject: Re: [AccessD] Wrong number of arguments
>
> Here is the reason it does not work. From Microsoft:
>
> The CDec() function is supported in Visual Basic for Applications code,
> but not in Access queries.
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo
> Sent: Wednesday, April 09, 2008 12:09 PM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] Wrong number of arguments
>
>
> Usually means that you have mis-spelled the name of one of the arguments
> and
> it cannot find it.
> Max
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester
> Sent: Wednesday, April 09, 2008 5:35 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Wrong number of arguments
>
> Checked the data and there are no nulls.
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte
> Foust
> Sent: Wednesday, April 09, 2008 11:20 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Wrong number of arguments
>
> What happens if SumOf3mo_rbi is Null?
>
> Charlotte Foust
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester
> Sent: Wednesday, April 09, 2008 9:02 AM
> To: Access Developers discussion and problem solving
> Subject: [AccessD] Wrong number of arguments
>
> I am confused as to why the following field in a query returns the error
> message of wrong number of arguments. The expression works fine without
> the
> CDec. What am I doing wrong?
>
>
>
> Factor_1:
> CDec(IIf([SumOf3mo_rbi]=0,[Allocations]![Factor_1],[3mo_rbi]/[SumOf3mo_r
> bi]))
>
>
>
> Chester Kaup
>
> Engineering Technician
>
> Kinder Morgan CO2 Company, LLP
>
> Office (432) 688-3797
>
> FAX (432) 688-3799
>
>
>
>
>
> No trees were killed in the sending of this message. However a large
> number
> of electrons were terribly inconvenienced.
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com

_________________________________________________________________
Get in touch in an instant. Get Windows Live Messenger now.
http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_Refresh_getintouch_042008



More information about the AccessD mailing list