Microsoft KB Archive/221650

= FIX: You receive the "Function argument value, type, or count is invalid" error message when you have program code that uses the SELECT-SQL statement in Visual FoxPro for Windows 5.0 and in Visual FoxPro for Windows 6.0 =

Article ID: 221650

Article Last Modified on 3/10/2005

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q221650



SYMPTOMS
You have program code that uses the SELECT-SQL statement. The SELECT-SQL uses the LIKE syntax to evaluate the result of a function. If the LIKE value is compared to an indexed field, you receive the following error message when the SELECT-SQL command is run:

Function argument value, type, or count is invalid.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Visual Studio 6.0 Service Pack 3.

For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed



Steps to Reproduce Behavior
  Run the following code from a program (.PRG) file: CLOSE DATA ALL CREATE TABLE mbtest (prodcd c(4), PibCD c(4)) INDEX ON PibCD TAG PibCD INSERT INTO mbtest (prodcd, PibCD) VALUES ('0011', 'B133')

LCCATEGORY = 'APPAREL' SELECT * ; FROM mbtest ; WHERE mbtest.PibCD LIKE LEFT(LCCATEGORY,1) ; INTO CURSOR cTemp
 * The following SELECT fails with "Function argument value, type, or count
 * is invalid." error.

SELECT * ; FROM mbtest ; WHERE mbtest.PibCD LIKE LEFT(LCCATEGORY,1) +"%"; INTO CURSOR cTemp
 * The following SELECT succeeds without error after adding % character.

USE IN mbtest  The first SELECT-SQL command fails with the error:

Function argument value, type, or count is invalid.

 If you ignore the error, the second SELECT-SQL command will succeed with the percent character (%) concatenated with the value compared with LIKE. The first SELECT-SQL command will succeed if there is no index on the PibCD field. Other functions, such as SUBSTR, will cause the error to occur as well.

(c) Microsoft Corporation 1999, All Rights Reserved. Contributions by Jim Saunders, Microsoft Corporation.

Keywords: kbbug kbfix kbsqlprog kbvs600sp3fix KB221650

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.