LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default Make Table Query into Text File

I am using Office 2003 on Windows XP.

I am trying to query an Oracle Database from Excel and run a "make table"
query into a csv text file. But, when I run the following code I get a
run-time error ("Query input must contain at least one table or query"). Can
someone please correct my SQL or ADO so I can get this running?

Dim sSQL As String
sSQL = "SELECT "
sSQL = sSQL & "A.ACCTNO, "
sSQL = sSQL & "A.ACCOUNT_DESC "
sSQL = sSQL & "INTO "
sSQL = sSQL & "[Text;Database=C:\Temp\;].TestFile#txt "
sSQL = sSQL & "FROM "
sSQL = sSQL & "[ODBC;" & sOracleConnection & ";].[APPS.GLBALVW] A "
sSQL = sSQL & "WHERE "
sSQL = sSQL & "A.PERIOD_NAME IN ('Sep-03', 'Sep-04') AND "
sSQL = sSQL & "A.FUND BETWEEN '800' AND '999' AND "
sSQL = sSQL & "A.ACCOUNT BETWEEN '0000' AND '8999';"

With CreateObject("adodb.connection")
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Extended Properties=""Text;HDR=Yes;"";" & _
"Data Source=C:\Temp\;"
.CursorLocation = 3 'adUseClient
.Open
.Execute sSQL
.Close
End With

Thanks much in advance.

 
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
Make table query will work in datasheet view but will not make tab WildlyHarry Excel Discussion (Misc queries) 0 August 28th 07 03:06 PM
How do I make a web query file to download stock data? Samie New Users to Excel 1 July 22nd 07 01:10 PM
Use Excel to make an update query to another database table? Reigning in Seattle Excel Discussion (Misc queries) 2 April 14th 05 06:25 PM
Importing Text File Based on Query ExcelMonkey[_145_] Excel Programming 2 June 11th 04 01:20 PM
Copy recordset from an Access "make table" query Laurie[_4_] Excel Programming 1 February 5th 04 09:45 AM


All times are GMT +1. The time now is 03:00 AM.

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

About Us

"It's about Microsoft Excel"