Alternative to Changing Table Under POPUP...PROMPT FIELD

Last reviewed: June 27, 1995
Article ID: Q109582
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, and 2.5b
  • Microsoft FoxPro for MS-DOS, versions 2.5, 2.5a or 2.5b
  • Microsoft FoxPro for Macintosh, version 2.5b

SUMMARY

When a popup is defined with the PROMPT FIELD clause, closing the database file on which the popup is based when the popup is still in memory can cause problems.

MORE INFORMATION

In a program, it is possible to close and delete the database on which a POPUP ... PROMPT FIELDS command is based and then substitute another database in place of the original. The new database can have a different structure, a different number of records, and so on. However, FoxPro is not designed to allow for the deletion and substitution of databases underneath active or defined popups. This practice is not supported and should not be used.

The following program demonstrates a method by which the table that underlies a POPUP ... PROMPT FIELD can be closed and re-created while the popup is in memory.

  * When this program is executed, select an option on the
  * popup and press the ENTER key to call "PROCEDURE popper".
  * The F5 key should be used to deactivate the popup.
  * Press the F5 key at any time to deactivate the popup.

  CLOSE ALL
  SET SAFETY OFF

  ON KEY LABEL f5 DEACTIVATE POPUP test

  CREATE TABLE test (city C(10))
  INSERT INTO test (city) VALUES ("Seattle")
  INSERT INTO test (city) VALUES ("Boston")

  DEFINE POPUP test FROM 02,02 PROMPT FIELD city
  ON SELECTION POPUP test DO popper
  ACTIVATE POPUP test
  RELEASE POPUP test

  PROCEDURE popper

    SELECT test

    * At this point, the table is closed. A new table
    * is created. The active popup is based on a
    * different table, and is unaware that these
    * changes are occurring. Although this type of
    * code may appear to function properly, it is
    * unsupported and subject to change in the future.

    USE
    CREATE TABLE test (city C(10))
    INSERT INTO test (city) VALUES ("Chicago")
    INSERT INTO test (city) VALUES ("New York")

  RETURN

If you need to display a new popup to list information from a different table, release the original popup with the RELEASE POPUP command. Then, create a new popup with the DEFINE POPUP command.


Additional reference words: FoxMac FoxDos FoxWin 2.50 2.50a 2.50b
KBCategory: kbenv kbprg kbcode
KBSubcategory: FxenvMemory


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.