I have a CSV file that I want to export into Access. I Know that I can use an
object command in a Word macro to use Access' import wizard, but I prefer
using a SQL statement to do it, mainly because I don't want to put my user
through the steps of the wizard. Is there any way that I can use a SQL
statement to import the whole CSV file?
Hi =?Utf-8?B?bXV5Qk4=?=,
> I have a CSV file that I want to export into Access. I Know that I can use an
> object command in a Word macro to use Access' import wizard, but I prefer
> using a SQL statement to do it, mainly because I don't want to put my user
> through the steps of the wizard. Is there any way that I can use a SQL
> statement to import the whole CSV file?
Nothing native to Word. You can link in the Jet Engine's DAO object library or
use ADO/OLE DB to write the information directly into the Access database, just
as you'd do in Access or using Excel, or any other programming language.
Probably best to pursue the details in a newsgroup that handles the connection
method you choose (Access for DAO, data.ado newsgroup for ADO). To link in one
of those libraries into a Word macro, go over Tools/References and select the
one you want from the list.
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)
Bryan - 10 Jun 2007 05:10 GMT
After much digging, as you suggested, I came up with this workable model:
strSQL = "INSERT INTO [" & strTable & "] " & _
"SELECT * " & _
"FROM [Text;HDR=YES;DATABASE=" & strPath & ";].[" & strFile & "]"
Thanks for your assistance.

Signature
Bryan
> Hi =?Utf-8?B?bXV5Qk4=?=,
>
[quoted text clipped - 20 lines]
> This reply is posted in the Newsgroup; please post any follow question or reply
> in the newsgroup and not by e-mail :-)