Microsoft KB Archive/114672

= PRB: Using SELECT SQL INTO CURSOR with Same Filename =

Article ID: 114672

Article Last Modified on 12/1/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft FoxPro 2.0
 * Microsoft FoxPro 2.5b for MS-DOS
 * Microsoft FoxPro 2.5a
 * Microsoft FoxPro 2.5b for MS-DOS
 * Microsoft FoxPro 2.6 for MS-DOS
 * Microsoft FoxPro 2.5b
 * Microsoft FoxPro 2.5a
 * Microsoft FoxPro 2.5b
 * Microsoft FoxPro 2.6 Standard Edition

-



This article was previously published under Q114672



SYMPTOMS
The error message "Alias Name Already in Use" or "Alias Name Is Already in Use"appears when a SELECT ...INTO CURSOR command is executed.



CAUSE
According to page L3-866 in the FoxPro version 2.5 "Language Reference" and page C3-704 in the FoxPro version 2.0 for MS-DOS "Commands & Functions" manual, if you issue an SQL SELECT INTO CURSOR command, where the cursor name is the same as the name of the table that records are being selected from, FoxPro will close the source file and create a cursor with the same name. This information is incorrect.

In actuality, when a cursor is created with an SQL SELECT statement, the original table is not closed when the same name is used for the cursor. FoxPro attempts to create the cursor with the same name although the table/.DBF is still open, which causes the above error message. For example, the following SELECT statement recreates the error: SELECT *; FROM Customer; INTO CURSOR Customer



RESOLUTION
Using a different name for the cursor resolves the problem. By using a different cursor name in the INTO clause of the SELECT command, the cursor is created without error, as the following code example illustrates: SELECT *; FROM Customer; INTO CURSOR ABC

Additional query words: VFoxWin FoxDos FoxWin Alias use error errmsg err msg docerr

Keywords: kberrmsg KB114672

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.