Import Access data to text file rather than Excel

  • Thread starter Daniel Bonallack
  • Start date

Daniel Bonallack

I have the below code (copied from this forum) to extract data from Access
and copy it to the active Excel worksheet.

What I want is for that last line to copy the data to a txt file, and save
that file with name "myText.txt" to L:\Storage\

Thanks in advance!
Daniel Bonallack

' Open the connection
Set Connection = New ADODB.Connection
Cnct = "Provider=Microsoft.Jet.OLEDB.4.0; "
Cnct = Cnct & "Data Source=" & DBFullName & ";"
Connection.Open ConnectionString:=Cnct

' Create RecordSet
Set Recordset = New ADODB.Recordset

Recordset.Open Source:=SQLString, ActiveConnection:=Connection
Range("A1").CopyFromRecordset Recordset

Daniel Bonallack

It may just be too complex for me to work through, but I'll give it a go -
I thought there would be a simpler solution, given that my import to Excel
is simple.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question