PRB: Running Genxtab with an Empty Table Causes Error (126969)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
- Microsoft FoxPro for Windows 2.5
- Microsoft FoxPro for Windows 2.5a
- Microsoft FoxPro for Windows 2.5b
- Microsoft FoxPro for Windows 2.6
- Microsoft FoxPro for Windows 2.6a
- Microsoft FoxPro for MS-DOS 2.5
- Microsoft FoxPro for MS-DOS 2.5a
- Microsoft FoxPro for MS-DOS 2.5b
- Microsoft FoxPro for MS-DOS 2.6
- Microsoft FoxPro for MS-DOS 2.6a
This article was previously published under Q126969 SYMPTOMS
When GENXTAB.PRG is run from an application, and the current table or
cursor does not contain any records, GENXTAB.PRG issues one of the
following error messages:
- Cannot prepare crosstab on empty database.
-or-
- Variable '_WIN' not found.
In either case, the error message will appear, and your program will exit.
CAUSE
Cross tabulation requires that a table or cursor (usually the result of a
query) with only three fields be open in the selected work area.
RESOLUTION
Please see the workaround listed in the "More Information" section of this
article.
STATUS
This behavior is by design.
WORKAROUND- Replace the program listed above with the following:
IF !USED("customer")
USE customer
ENDIF
STORE "C:\<FoxPro Directory>\GENXTAB.PRG" TO _GENXTAB
SELECT Customer.cno, Customer.state, Customer.ytdpurch;
FROM Customer;
GROUP BY Customer.cno, Customer.state;
ORDER BY Customer.cno, Customer.state;
WHERE alltrim(upper(state))="JP" INTO CURSOR SYS(2015)
IF _TALLY !=0 &&if results are equal to 0 GENXTAB.PRG WILL NOT EXECUTE
DO (_GENXTAB) WITH 'Query'
BROWSE NOMODIFY
ENDIF
WAIT WINDOW "HELLO WORLD" - Create a new project, and add the program to the project.
- Build an .EXE or .APP from the project.
- Run the .EXE or .APP and notice that the WAIT WINDOW command is now
executed.
Modification Type: | Major | Last Reviewed: | 12/1/2003 |
---|
Keywords: | KB126969 kbAudDeveloper |
---|
|