PRB: Cannot Access Selected Table

Last reviewed: September 18, 1997
Article ID: Q114194
2.60 3.00 | 2.60
WINDOWS   | MS-DOS
kbprg kberrmsg kbprb

The information in this article applies to:

  • Microsoft Visual FoxPro for Windows, version 3.0
  • Microsoft FoxPro for MS-DOS, version 2.6
  • Microsoft FoxPro for Windows, version 2.6

SYMPTOMS

FoxPro produces a "Cannot access selected table" error message when a table is closed and that table is participating in a POPUP ... PROMPT FIELDS command that is active when the table is closed.

CAUSE

When the PROMPT FIELDS clause of a POPUP command is used to define a popup, FoxPro establishes a link between the POPUP command and the table from which the POPUP command derives its data. If the table on which the popup is based is closed while the POPUP command is active, the link between the POPUP command and the data is severed. FoxPro, therefore, cannot continue to display the popup.

In dBASE IV, a popup created with the PROMPT FIELDS clause is loaded into memory. Since dBASE does not maintain a link between the POPUP command and the table from which the POPUP command derives data, it is possible to close a table on which a popup is based while that POPUP command is active. Therefore, the sample code in the "More Information" section below will not generate an error if it is executed in dBASE IV.

RESOLUTION

If a popup is created with the PROMPT FIELDS clause, do not close the table from which that popup derives its data while that POPUP command exists. Use the RELEASE POPUP command to release the POPUP command before closing any tables from which that popup obtains its data. Once the POPUP command has been released, close the desired tables.

STATUS

This behavior is by design. FoxPro cannot accommodate the behavior found in dBASE in this instance due to differences in the way this type of popup is internally managed.

MORE INFORMATION

Steps to Reproduce Problem

Place the following code in a .PRG file and execute the code. When the popup appears, press the ENTER key to cause the "getname" procedure to be executed.

  USE c:\<FoxPro_directory>\sample\catalog\CUSTOMER
        * In Visual FoxPro use c:\vfp\samples\data\customer

  DEFINE POPUP testpop FROM 2,20 TO 21,25 PROMPT FIELD state
       * In Visual FoxPro use the 'country' field instead of  'state'

  ON SELECTION POPUP testpop DO getname
  ACTIVATE POPUP testpop

  RELEASE POPUP testpop

  RETURN

  PROCEDURE getname
    USE

    * The 'Cannot access selected table' error message
    * will occur here because the table on which this
    * popup was based has already been closed.

    DEACTIVATE POPUP

  RETURN


Additional reference words: VFoxWin 3.00 FoxDos FoxWin 2.60 differences
errmsg err msg error 1152
KBCategory: kbprg kberrmsg kbprb
KBSubcategory: FxinteropDbase
Keywords : FxinteropDbase kberrmsg kbprb kbprg
Version : 2.60 3.00 | 2.60
Platform : MS-DOS WINDOWS


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: September 18, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.