Microsoft KB Archive/319277

= FIX: IMPORT from Excel File Causes Error =

Article ID: 319277

Article Last Modified on 5/3/2002

-

APPLIES TO


 * Microsoft Visual FoxPro 7.0 Professional Edition

-



This article was previously published under Q319277



SYMPTOMS
When you use the IMPORT command with a Microsoft Excel spreadsheet in Visual FoxPro 7.0, the Browse window that displays the imported data may be blank, or you may receive one of the following error messages:

Data type mismatch

or

Fatal Error: Exception code: C0000005



CAUSE
The errors occur because the IMPORT process has filled the Visual FoxPro 7.0 internal name table.



RESOLUTION
To resolve this problem, obtain the latest service pack for Visual FoxPro for Windows 7.0. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

316964 How to Obtain the Latest Visual FoxPro for Windows 7.0 Service Pack



STATUS
Microsoft has confirmed that this is a problem in Microsoft Visual FoxPro for Windows, version 7.0.

This problem was first corrected in Visual FoxPro for Windows 7.0 Service Pack 1.



Steps to Reproduce the Behavior
NOTE: The following code assumes that you have installed the sample data that ships with Visual FoxPro, and that the Visual FoxPro environmental variable _SAMPLES points to the sample data correctly.

 Create a Config.fpw file in a text editor such as Notepad. Add the line MVCOUNT=50500 to the file, and then save the file in your Visual FoxPro home directory. If you already use a Config.fpw file, add this line to the current file.  Paste the following code in a program (.prg) file named Test.prg, and then run the program from the Command window: LOCAL liCnt AS INTEGER, ; lcMemVar AS STRING, ; lcXLFile AS STRING, ; laDBFArray[1]

CD JUSTPATH(SYS(16)) CLOSE ALL CLEAR ALL ERASE Q319277*.*

FOR liCnt = 1 TO 50000 lcMemVar = &quot;MVar&quot; + TRANSFORM(liCnt) PUBLIC (lcMemVar) NEXT

USE (_SAMPLES) + &quot;\DATA\CUSTOMER&quot; AFIELDS(laDBFArray) USE IN SELECT(&quot;CUSTOMER&quot;) CREATE CURSOR &quot;XLS_SOURCE&quot; FROM ARRAY laDBFArray SELECT &quot;XLS_SOURCE&quot; WAIT WINDOW &quot;Building XLS file...&quot; NOWAIT NOCLEAR FOR liCnt = 1 TO 500 APPEND FROM (_SAMPLES) + &quot;\DATA\CUSTOMER&quot; ENDFOR COPY TO Q319277_XLS.XLS TYPE XLS USE IN SELECT(&quot;XLS_SOURCE&quot;) WAIT WINDOW &quot;Complete!&quot; TIMEOUT 1 CREATE DATABASE Q319277 SET DATABASE TO Q319277 IMPORT FROM Q319277_XLS.XLS TYPE XLS DATABASE &quot;Q319277&quot; NAME ; &quot;Some_Long_Table_Name&quot; USE &quot;Some_Long_Table_Name&quot; BROWSE LIST ALL CLOSE ALL SET SAFETY OFF DELETE DATABASE Q319277 DELETETABLES

 Save this file, and then run the program.

Keywords: kbbug kbfix kbvfp700sp1fix kbcodesnippet KB319277

-

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

© Microsoft Corporation. All rights reserved.