Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Adrian,
I would suggest using ADO instead of DAO to access your external data. Set a reference to "Microsoft ActiveX Data Objects 2.x Library", where x is the highest number available to you. Then search groups.google.com and MSDN for examples on how to connect to a database and retrieve data via ADO using a DSN. If you need more assistance, let us know and we'll try to help. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Adrian T wrote: Hello: This is something I have never done before. I am trying to have an open connection with a SQL database registered in my machine's ODBC driver. Here's my code Private Sub Connect() Dim wrkODBC As Workspace Dim conData As Connection Set wrkODBC = CreateWorkspace("NewODBCWorkspace", "admin", "", dbUseODBC) Set conData = wrkODBC.OpenConnection("Connection1", , , "ODBC;DATABASE=Sale;UID=sa;PWD=sa;DSN=SQL_SERV ER") End Sub When I run the code, an error msg says "Run-time Error:13 (Type Mismatch)". I am almost convinced that it has something to do with referencing to the right library. Does anyone know how to fix this? Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ODBC connection failed. | Excel Discussion (Misc queries) | |||
ODBC connection failed. | Excel Discussion (Misc queries) | |||
ODBC connection failed. | Excel Discussion (Misc queries) | |||
Broken ODBC Connection | Links and Linking in Excel | |||
ODBC connection by udl | Excel Programming |