Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello All,
I have a question, I have a function which can let me use SQL in VBA Excel to to query with Access. Set wrkODBC = CreateWorkspace("ODBCWorkspace", "research", "",_ dbUseODBC) Set cn = wrkODBC.OpenConnection("", dbDriverNoPro,_ False, "ODBC;DSN=<ABCDE;UID=hello;PWD=hello") this works. but i want to use ADO method, so I change it into Dim getAccess As ADODB.Connection sConnect = "Provider=SQLOLEDB;" & "Initial Catalog=Goldfinger;" _ & "User ID = research;" & "Password = research;" getAccess.ConnectionString = sConnect getAccess.Open i dont know why, i always got a error message telling me: 91 Object variable or With block variable not set -2147221504 or if I want to run: Set rsData = New ADODB.Recordset rsData.Open sSQL, sConnect, adOpenKeyset, adLockReadOnly, adCmdText then it will tell me: -2147467259 [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. -2147221504 Can any one help me? Thanks a lot. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() try set getAccess = new ADODB.Connection before you use it or Dim it with New cheers Simon -- Simon Murphy ------------------------------------------------------------------------ Simon Murphy's Profile: http://www.excelforum.com/member.php...o&userid=26538 View this thread: http://www.excelforum.com/showthread...hreadid=466846 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I change this code? | Excel Discussion (Misc queries) | |||
VBA Code to Change the Tab Name | Excel Discussion (Misc queries) | |||
VBA Code to Change the Tab Name | Excel Discussion (Misc queries) | |||
VB CODE RUN ON DDE VALUE CHANGE | Excel Programming | |||
Change to Code | Excel Programming |