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

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

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:

  • The WHEN clause for current record is not executed.
  • The previous WHEN result is still active.
  • The VALID clause for current record is executed even when no data was changed.

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


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.