ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ODBC Conenction Programmatically (https://www.excelbanter.com/excel-programming/319829-odbc-conenction-programmatically.html)

Todd huttenstine

ODBC Conenction Programmatically
 
Hey guys

Using ODBC, it is possible to set up a connection to a
database. Instead of having to do this manually for
multiple computers, I would like to be able to run a code
that will do it automatically. For instance if I wanted
to setup a database connection to file C:\test.mdb, I
would open up the ODBC managaer and then type in a
description, navigate to the source, etc.. How do I write
code that will set up a system database connection to a
file called test.mdb located on C:\?


Thanks
Todd Huttenstine

Tom Ogilvy

ODBC Conenction Programmatically
 
Turn on the macro recorder and do it manually. Then turn it off and look at
the code.

--
Regards,
Tom Ogilvy

"Todd Huttenstine" wrote in message
...
Hey guys

Using ODBC, it is possible to set up a connection to a
database. Instead of having to do this manually for
multiple computers, I would like to be able to run a code
that will do it automatically. For instance if I wanted
to setup a database connection to file C:\test.mdb, I
would open up the ODBC managaer and then type in a
description, navigate to the source, etc.. How do I write
code that will set up a system database connection to a
file called test.mdb located on C:\?


Thanks
Todd Huttenstine




Todd huttenstine

ODBC Conenction Programmatically
 
How can you access the ODBC manager from within Excel? I
dont think you can...


-----Original Message-----
Turn on the macro recorder and do it manually. Then turn

it off and look at
the code.

--
Regards,
Tom Ogilvy

"Todd Huttenstine"

wrote in message
...
Hey guys

Using ODBC, it is possible to set up a connection to a
database. Instead of having to do this manually for
multiple computers, I would like to be able to run a

code
that will do it automatically. For instance if I wanted
to setup a database connection to file C:\test.mdb, I
would open up the ODBC managaer and then type in a
description, navigate to the source, etc.. How do I

write
code that will set up a system database connection to a
file called test.mdb located on C:\?


Thanks
Todd Huttenstine



.


Tom Ogilvy

ODBC Conenction Programmatically
 
Data=Get External Data

or

Data = Import External Data

Depending on version of Excel.

--
Regards,
Tom Ogilvy



"Todd Huttenstine" wrote in message
...
How can you access the ODBC manager from within Excel? I
dont think you can...


-----Original Message-----
Turn on the macro recorder and do it manually. Then turn

it off and look at
the code.

--
Regards,
Tom Ogilvy

"Todd Huttenstine"

wrote in message
...
Hey guys

Using ODBC, it is possible to set up a connection to a
database. Instead of having to do this manually for
multiple computers, I would like to be able to run a

code
that will do it automatically. For instance if I wanted
to setup a database connection to file C:\test.mdb, I
would open up the ODBC managaer and then type in a
description, navigate to the source, etc.. How do I

write
code that will set up a system database connection to a
file called test.mdb located on C:\?


Thanks
Todd Huttenstine



.




Rob van Gelder[_4_]

ODBC Conenction Programmatically
 
Todd,

You can use the prompt against the ODBC provider for OLEDB.

Set con = New ADODB.Connection
con.ConnectionString = ConnectionString
con.Provider = "MSDASQL"
con.Properties("Prompt") = adPromptAlways
con.Open
str = con.Properties("Extended Properties")



This is the code I use in the Query Editor on my website.


--
Rob van Gelder - http://www.vangelder.co.nz/excel


-----Original Message-----
From: Todd Huttenstine ]
Posted At: Friday, 31 December 2004 5:33 a.m.
Posted To: microsoft.public.excel.programming
Conversation: ODBC Conenction Programmatically
Subject: ODBC Conenction Programmatically

Hey guys

Using ODBC, it is possible to set up a connection to a
database. Instead of having to do this manually for
multiple computers, I would like to be able to run a code
that will do it automatically. For instance if I wanted
to setup a database connection to file C:\test.mdb, I
would open up the ODBC managaer and then type in a
description, navigate to the source, etc.. How do I write
code that will set up a system database connection to a
file called test.mdb located on C:\?


Thanks
Todd Huttenstine



All times are GMT +1. The time now is 09:42 AM.

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