Article ID: 193628
Article Last Modified on 10/15/2002
APPEND FROM <filename>.xls TYPE XLS && Excel 2.1, 3.0 and 4.0 file types APPEND FROM <filename>.wk1 TYPE WK1 && Lotus 1-2-3 version 2.x APPEND FROM <filename>.wk3 TYPE WK3 && Lotus 1-2-3 version 3.x APPEND FROM <filename>.mod TYPE MOD && Microsoft Multiplan 4.01 APPEND FROM <filename>.wks TYPE WKS && Lotus 1-2-3 version 1-AAppending from other file types can also cause the crash although text files and .dbf files do not seem to have any problems.
CLOSE DATABASE ALL
CLEAR ALL
CLEAR
SET SAFETY OFF
CREATE TABLE fruit ;
(fruit c(12), color c(15), treeorvine c(10), number n(8,2))
INSERT INTO fruit VALUES ("Apple", "Red", "Tree", 5)
INSERT INTO fruit VALUES ("Orange", "Orange","Tree", 18)
INSERT INTO fruit VALUES ("Grape", "Purple", "Vine", 42)
INSERT INTO fruit VALUES ("Blueberry", "Blue", "Bush", 78)
INSERT INTO fruit VALUES ("Grapefruit", "Pink", "Tree", 62)
INSERT INTO fruit VALUES ("Banana", "Yellow", "Tree", 37)
SELECT fruit
WAIT WINDOW "Choose an Excel 2.1, 3 or 4 file"
x=GETFILE("xls")
SELECT 0
IMPORT FROM (x) TYPE XLS
SET SAFETY ON
SET DELETED ON
DELETE FOR RECNO()=1 && To eliminate field name headers in Excel sheet.
y=ALIAS()
* Need to change the field names to match the target table.
For i=1 TO FCOUNT()
ALTER TABLE (y) RENAME COLUMN (LOWER(FIELD(i))) TO (FIELD(i,"fruit"))
ENDFOR
SELECT fruit
APPEND FROM (y)
SELECT (y)
USE
ERASE (y)
SELECT fruit
BROWSE NOWAIT
Cell Data to Enter
---------------------------
A1 Fruit
B1 Color
C1 TreeorVine
D1 Number
A2 Apple
B2 Red
C2 Tree
D2 50.25
A3 Banana
B3 Yellow
C3 Tree
D3 17.45
CLOSE DATABASE ALL
CLEAR ALL
CLEAR
SET SAFETY OFF
CREATE TABLE fruit ;
(fruit c(12), color c(15), treeorvine c(10), number n(8,2))
SET SAFETY ON
SELECT fruit
INSERT INTO fruit VALUES ("Apple", "Red", "Tree", 5)
INSERT INTO fruit VALUES ("Orange", "Orange","Tree", 18)
INSERT INTO fruit VALUES ("Grape", "Purple", "Vine", 42)
INSERT INTO fruit VALUES ("Blueberry", "Blue", "Bush", 78)
INSERT INTO fruit VALUES ("Grapefruit", "Pink", "Tree", 62)
INSERT INTO fruit VALUES ("Banana", "Yellow", "Tree", 37)
APPEND FROM fruit4.xls TYPE XLS && This causes the crash.
BROWSE NOWAIT
Keywords: kbbug kbfix kbinterop kbxbase kbvs600sp3fix KB193628