David McAfee
davidmcafee at gmail.com
Tue Nov 10 15:04:17 CST 2009
What is weird, when I try to create a Cdec() in the QBE I am getting an error: "the expression you entered has a function containing the wrong number of arguments" it wont accept SELECT CDec("123.45") AS Expr1, tblMyTable.CPName, CDec([CPName]) AS Expr2 FROM tblMyTable; but will accept: SELECT CLng("123.45",0) AS Expr1, tblMyTable.CPName, CDec([CPName],0) AS Expr2 FROM tblMyTable; which returns Expr1 CPName Expr2 0 David McAfee 0 Bill Gates 0 Larry Ellison 0 Megan Fox 0 123.45 0 0 678.90 0 >From help: Note that at this time the Decimal data type can only be used within a Variant. You cannot declare a variable to be of type Decimal. You can, however, create a Variant whose subtype is Decimal using the CDec function. On Tue, Nov 10, 2009 at 12:48 PM, jwcolby <jwcolby at colbyconsulting.com> wrote: > Sorry, > > I miswrote the email. the failing function is cDec - convert to decimal. cDec("123.45") in the > debug window returns 123.45 as a NUMBER. > > m: cDec("123.45") - an aliased field - in the query window immediately causes an error. > > Sorry for the confusion. > > John W. Colby > www.ColbyConsulting.com > > > Steve Schapel wrote: >> -------------------------------------------------- >> From: "Heenan, Lambert" <Lambert.Heenan at chartisinsurance.com> >> Sent: Wednesday, November 11, 2009 7:09 AM >> >>> The following SQL runs just fine for me, I Access 2003. >>> >>> SELECT CDbl("123.45") AS SomeDouble, BankNames_tbl.BankID >>> FROM BankNames_tbl; >> >> Same for me in Access 2007. No problem. >> >> I have used CDbl in queries plenty of times, with no problem. And I have >> never heard mention of the type of behaviour you are experiencing, John. So >> it's an oddity. >> > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >