有些人可以为我提供一个VBA宏来将数据从CSV文件导入ms访问表吗?
答案 0 :(得分:2)
INSERT INTO tblSomeTable ( [TRADE DATE], REP, REPID, [ACCOUNT/POLICY],
CUSTOMER, [REP# COMPANY], [PRODUCT NAME], QUANTITY, [FACE AMOUNT],
[GROSS COMMISSION], [CUSTOMER SSN] )
SELECT [TRADE DATE], REP, REPID, [ACCOUNT/POLICY],
CUSTOMER, [REP# COMPANY], [PRODUCT NAME], QUANTITY, [FACE AMOUNT],
[GROSS COMMISSION], [CUSTOMER SSN]
FROM [Text;
FMT=Delimited;
HDR=YES;
CharacterSet=437;
DATABASE=C:\Documents And Settings\spauldb\Desktop].Transactions_Jan1_to_Jan30.csv
WHERE [TRADE DATE] Is Not Null;
答案 1 :(得分:1)
我会将TransferText用于CSV:
DoCmd.TransferText acImportDelim, , "NewTable2", "c:\docs\ltd.csv", True
在处理文本文件时,使用导入规范或导入现有表通常是一个好主意,但并非总是必要的。
答案 2 :(得分:0)
查看Docmd.TransferSpreadSheet是否有帮助。