BUG: CHANGE WHEN and VALID Clauses Don't Work with Arrow Keys

ID: Q126232

The information in this article applies to:

SYMPTOMS

If you use the CHANGE command to view or change records in a table, the CHANGE WHEN clause doesn't work correctly when you press any of the ARROW keys to move between records.

Once a field is changed, if you continue to press any of the ARROW keys or the ENTER key to move between records, the CHANGE VALID will behave like a FORCED VALID until you press the PAGE UP or PAGE DOWN key.

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

The program below demonstrate the problem with the WHEN and the VALID clauses of the CHANGE command. Depending on which key combination is used, you may run into one or more of the following problems:

Steps to Reproduce Problem

1. Create and then run a program containing the following code. When

   running the program, use only the PAGE UP and PAGE DOWN keys to move
   between records.

   SET DEFAULT TO SYS(2004)+"tutorial"
   USE customer
   testfile=SYS(3)
   COPY TO &testfile
   USE &testfile

   CHANGE FIELDS cno, company, address WHEN chgwhen() VALID chgvalid()

   CLOSE ALL
   WAIT WINDOW "CLOSING ALL FILES" NOWAIT
   DELETE FILE &testfile..dbf

   FUNCTION chgwhen
   * MOD returns 0 for all even records, and 1 for all odd records.
   IF MOD(RECNO(),2)=0
       WAIT WINDOW 'W: Recno is ' + ALLTRIM(STR(RECNO())) + ;
       '. Even records are Editable' NOWAIT
       RETURN .T.
       && Returning True allow the current record to be edited
   ELSE
       WAIT WINDOW 'W: Recno is ' + ALLTRIM(STR(RECNO())) + ;
       '. Odd records are READ-ONLY' NOWAIT
       RETURN .F.
       && Returning False makes the current record read only
   ENDIF

   FUNCTION chgvalid
   IF MOD(RECNO(),2)=0
       WAIT WINDOW 'V: Recno is ' + ALLTRIM(STR(RECNO())) + ;
       '. Even record changes validated OK'
       RETURN .T.
   ELSE
       WAIT WINDOW 'V1: Recno is ' + ALLTRIM(STR(RECNO())) + ;
         '. Odd records should be READ-ONLY'
       WAIT WINDOW 'V2: Current record was changed. RECORD WHEN '+ ;
         'protection failed, or'
       WAIT WINDOW 'V3: RECORD VALID is behaving like a FORCED VALID '+ ;
         'because Previous record was changed.'
       RETURN .T.
   ENDIF

2. Change or delete some of the fields in one or more of the even records,
   and try to change some of the fields in the odd records.

3. Repeat steps 1 and 2 using the ARROW keys as well as the PAGE UP and
   PAGE DOWN keys.

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

Last Reviewed: June 27, 1995