BUG: BROWSE FORMAT with Character RANGE Causes Syntax Error

ID: Q122864

The information in this article applies to:

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

Last Reviewed: June 27, 1995