schema.ini file to export from Access

浪子不回头ぞ 提交于 2019-12-24 15:12:01

问题


I'm exporting from an Access DB via VBscript and want to try using a Schema.ini file. I have a batch program that fires off a vbscript file that opens the Access DB and does the export. My vbscript filename is export.vbs.

If I have:

DoCmd.TransferText acExportDelim, "", "table", "C:\output\table.csv"

I notice while the export is happening a file gets automatically created "export.ini".

If I have

DoCmd.TransferText acExportDelim, "Schema.ini", "table", "C:\output\table.csv"

I get an error talking about "The text file spec 'Schema.ini" does not exist." even though in the same directory this is all happening in I have a Schema.ini file there. What am I missing?

Thanks!


回答1:


You need to go about it a different way ( Create comma separated file (csv) from access - scheduled daily from windows )

Set cn = CreateObject("ADODB.Connection")

cn.Open "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=z:\Docs\test.accdb"

sSQL = "select * into " 
sSQL= sSQL & "[text;database=z:\docs\;FMT=Delimited;HDR=Yes].[csvfile.csv]"
sSQL= sSQL & " from table1"

cn.Execute sSQL


来源:https://stackoverflow.com/questions/14611460/schema-ini-file-to-export-from-access

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!