Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Import Access data to text file rather than Excel

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Import Access data to text file rather than Excel

Please refer this link

http://www.freevbcode.com/ShowCode.asp?ID=548

If this post helps click Yes
---------------
Jacob Skaria


"Daniel Bonallack" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Import Access data to text file rather than Excel

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

"Jacob Skaria" wrote:

Please refer this link

http://www.freevbcode.com/ShowCode.asp?ID=548

If this post helps click Yes
---------------
Jacob Skaria


"Daniel Bonallack" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Import Access data to text file rather than Excel

Check this out:
http://www.accessmvp.com/KDSnell/EXCEL_ImpExp.htm

HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Daniel Bonallack" wrote:

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

"Jacob Skaria" wrote:

Please refer this link

http://www.freevbcode.com/ShowCode.asp?ID=548

If this post helps click Yes
---------------
Jacob Skaria


"Daniel Bonallack" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I import data from a text file into Excel 2003 madlin Excel Discussion (Misc queries) 2 January 12th 10 09:38 PM
How do a import data from a text file to an excel worksheet madlin Excel Discussion (Misc queries) 4 January 12th 10 04:04 PM
Import text file to access database via Excel VBA Dan Excel Programming 1 April 21st 09 03:50 PM
import excel file to access but only new data Daniel M Excel Programming 1 December 6th 07 11:44 AM
Excel file will not import to Access, what may be the cause Lowner Excel Discussion (Misc queries) 1 June 15th 07 09:19 PM


All times are GMT +1. The time now is 12:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"