ACC2000: "Wrong Number of Arguments" Error When You Use CDec Function in a Query
ID: Q225931
|
The information in this article applies to:
Moderate: Requires basic macro, coding, and interoperability skills.
This article applies only to a Microsoft Access database (.mdb).
SYMPTOMS
When you use the CDec() function in a Microsoft Access query, you may receive the following error message:
The expression you entered has a function containing the wrong number of arguments.
CAUSE
The CDec() function is supported in Visual Basic for Applications code, but not in Access queries.
RESOLUTION
Create a custom function that uses the CDec() function. Call this custom function from your Access query. For example:
- Create a new module and type the following code:
Function NewCDec(MyVal)
NewCDec = CDec(MyVal)
End Function
- Save and close the module.
- Type MyID: NewCDec([CategoryID]) in the Field row of a query. Note that when you run this function, it returns a valid value for the MyID field.
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed
at the beginning of this article.
MORE INFORMATION
Steps to Reproduce Behavior
- Open the sample database Northwind.mdb.
- In the Database window, click Queries under Objects, and then click New.
- In the New Query box, click Design View, and then click OK.
- In the Show Table box, click the Categories table. Click Add, and then click Close.
- Drag the CategoryName field from the Field List box to the Field row of the first column of the query design grid.
- Type MyID: CDec(CategoryID) in the Field row of the second column.
- Try to move to the next column in the query design grid. Note that you receive the error message mentioned in the "Symptoms" section.
Additional query words:
pra recognized
Keywords : kbdta QryProb
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: July 19, 1999