BUG: BROWSE FORMAT with Character RANGE Causes Syntax Error

Last reviewed: June 27, 1995
Article ID: Q122864
The information in this article applies to:
  • Microsoft Foxpro for Windows, version 2.5, 2.5a, 2.5b, 2.6, 2.6a

SYMPTOMS

Issuing a BROWSE FORMAT command that includes a character RANGE in the format file causes a "Syntax Error."

CAUSE

When the RANGE clause is used in a FORMAT file, you can usually include character, date, and numeric data ranges of acceptable values that are used with an @ get editing region. However, if FoxPro encounters the RANGE clause while reading the format file specified in the SET FORMAT command, a "Syntax Error" is generated.

RESOLUTION

Use a VALID clause on the field instead of a range as in this example:

   * Format file :CUSTENT.FMT
   @ 1,0  SAY "CNO"
   @ 1,10 GET cno PICTURE "XXXXX" VALID testcno()
   @ 2,0  SAY "Company"
   @ 2,10 GET Company PICTURE "XXXXXXXXXXXXXXXXXXXX"

   PROCEDURE testcno
      IF cno < "22222" OR cno > "55555"
         WAIT WINDOW "Invalid CNO entered - Must be 22222 to 55555"
         RETURN 0
      ENDIF
   * End of Format File

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a Format file called CUSTENT.FMT by using these commands:

    * Format file :CUSTENT.FMT @ 1,0 SAY "CNO" @ 1,10 GET cno PICTURE "XXXXX" RANGE "22222","55555" ;

          ERROR "Invalid cno entered - must be 22222 to 55555"
    
    @ 2,0 SAY "Company" @ 2,10 GET company PICTURE "XXXXXXXXXXXXXXXXXXXX" * End of Format File

  2. Create a program in the Command window by issuing these commands:

    MODIFY COMM MyTest

    * Program MyTest.prg

    USE Customer SET FORMAT TO custent.fmt BROWSE FORMAT

    * End of Program MyTest.prg

  3. Save the program by holding down the CTRL key and pressing the W key.

  4. Issue the following command in the Command window:

    DO MyTest

The "Syntax error" message is displayed immediately.


Additional reference words: FoxWin 2.50 2.50a 2.50b 2.60 2.60a buglist2.50
buglist2.50a buglist2.50b buglist2.60 buglist2.60a
KBCategory: kbprg kberrmsg kbbuglist
KBSubcategory: FxprgBrowse


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.