Microsoft KB Archive/128815

{| = PRB: Error Message: "No bars have been defined for this popup" =
 * width="100%"|

ID: Q128815

The information in this article applies to:


 * Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a
 * Microsoft FoxPro for MS-DOS, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a

SYMPTOMS
If the PROMPT FIELD clause of a DEFINE POPUP command contains empty records, the following error message occurs:

No bars have been defined for this popup

CAUSE
This error can be caused by any one of the following:

 The field used in the PROMPT FIELD expression is from an empty permanent or temporary table. -or- A SET FILTER command was issued, and no records satisfied the filter condition. -or- An SQL SELECT command resulted in an empty cursor or table.

RESOLUTION
Check for the following:

1. Existing records in permanent or temporary tables.

2. Misspellings in the filtering or query command lines.

3. Field values containing upper- or lower-case characters.

STATUS
This behavior is by design.

MORE INFORMATION
In some cases it may be necessary to check for empty records before defining and activating the popup. The code provided below uses the _TALLY system memory variable to determine if the result of an SQL SELECT command is greater than one before it populates the popup. Add the following code after the SQL SELECT command:

IF _TALLY < 1 WAIT WINDOW "No Records Available" ELSE *(insert DEFINE POPUP command line) *(insert ACTIVATE POPUP command line) ENDIF

Steps to Reproduce Behavior
Create and run the following program:

*** Begin Program ***

CLOSE DATABASES USE C:\FPW26\TUTORIAL\CUSTOMER SET FILTER TO state = "nc"   && 'nc' must be in lowercase

DEFINE POPUP cities FROM 5,5 TO 15,25 PROMPT FIELD city SCROLL ACTIVATE POPUP cities

DEACTIVATE POPUP cities SET FILTER TO  CLOSE DATABASES

*** End Program *** In this program, the State field in the Customer table contains all uppercase characters, so no records match the filter condition. This results in an empty work area. There are no values to populate the popup, so the error message ("No bars have been defined for this popup") occurs when the popup is defined and activated. You can modify the program to produce the same error using the SQL SELECT statement. For example, change the SET FILTER TO command line into a comment. Then below that command line, add this code:

SELECT * FROM customer WHERE state = "nc" INTO CURSOR temp NOTE: When the current work area points to the temporary table (Temp) rather than the permanent table (Customer), the PROMPT FIELD clause will read the values of temp.city to populate the popup. This behavior is different from the SET FILTER command, which reads its values from customer.city. The error also occurs if no records have been added to the permanent table or if the records in the permanent table have been removed using the ZAP, PACK, or DELETE (if SET DELETED is ON) commands.

Additional reference words: FoxWin FoxDos 2.50 2.50a 2.50b 2.60 2.60a KBCategory: kbprg kbprb KBSubcategory: FxprgSet
 * }