Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 260
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 260
Default 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



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default 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

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 to programmatically fix row and column Asha Excel Programming 2 October 28th 04 12:50 PM
Changing DSN programmatically? Michael Bourgon Excel Programming 1 October 21st 04 10:44 AM
delete row programmatically Pat Excel Programming 2 September 2nd 04 09:11 PM
Programmatically Add Reference` keepitcool Excel Programming 1 September 16th 03 05:30 PM
Can i set a reference programmatically? Tom Ogilvy Excel Programming 1 August 19th 03 04:24 PM


All times are GMT +1. The time now is 05:54 PM.

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"