ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ADO/VBA (https://www.excelbanter.com/excel-programming/386261-re-ado-vba.html)

Brent

ADO/VBA
 
Sorry, I figured it out. Didn't have everything in the declarations, as I
should have. Thank you.

Brent


"Vergel Adriano" wrote:

Brent,

You don't need the line with Set because your declaration line for cn
already creates it as a New ADODB.Connection object.

You need to use a properly constructed connection string for the Open
method. Since you mentioned you're trying to connect to Oracle, you'll need
something like this:

cn.Open "Provider=msdaora;Data Source=MyOracleDB;User
Id=myUsername;Password=myPassword;"


Follow this link for list of other connection strings you can use to connect
to Oracle:

http://www.connectionstrings.com/?carrier=oracle


Also, make sure you have reference to the Microsoft ActiveX Data Objects 2.x
Library, depending which version you have installed in your computer.


--
Hope that helps.

Vergel Adriano


"Brent" wrote:

I am trying to interface to export Excel data into Oracle direclty. In
attempting this I keep gettig errors. The lines below with an asterix are
the problem lines.

Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection
* Set cn = ADODB.OpenConnection
* cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;"

At Set I get "Invalid Outside Procedure". If I remove the line containing
Set, I get the same error at cn.Open. Any suggestions? Could it be my
references? Any help would be greatly appreciated!!

Brent



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com