LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.scripting.vbscript,microsoft.public.dotnet.languages.vb
external usenet poster
 
Posts: 5
Default Search Sample for Oracle-to-Excel extraction with CopyFromRecordset

I would like to extract all records from an Oracle database to an Excelsheet.
How do I do this in detail?

After googling around I found so far the following code snippet (see bottom).
However the "core" statement is still not clear to me.
How do I assign the current recordset to the next free line ?
How do I write the line indicated below with "***" ?

Shouldn't be there a loop to iterate through all records?


Function TotalAmount()
Dim objConn As ADODB.Connection
Dim objRec As ADODB.Recordset
strQuery = "SELECT * FROM mytab WHERE field1=123;"
If ThisMap.MySQL_connection(objConn, "localhost", "3306", "root", "admin") Then
Set objRec = New ADODB.Recordset
objRec.Open strQuery, objConn, adOpenForwardOnly, adLockReadOnly
"nextfreeline" = CopyFromRecordset objRec (***)
Else
MsgBox "Error Connection-String"
End If
objRec.Close
Set objRec = Nothing
End Function

Keith

 
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
CopyFromRecordset Problem sunzj Excel Discussion (Misc queries) 0 August 2nd 07 06:32 PM
Format data in Excel after using copyfromrecordset jj Excel Discussion (Misc queries) 2 June 13th 07 06:48 AM
Excel VBA against Oracle Johnson Shine Excel Discussion (Misc queries) 3 January 14th 07 02:05 PM
Problem with Excel and oracle Jon Prisbe Excel Discussion (Misc queries) 2 August 21st 06 03:00 PM
Excel Access and Oracle Chris K Excel Discussion (Misc queries) 1 February 17th 06 06:16 PM


All times are GMT +1. The time now is 01:31 PM.

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"