Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Runtime error 91 when connecting to SQL Server 2000

Hi

I have an Excel sheet that connects to a SQL Server and fetches data via
ADODB. It works fine on all machines but one, where I get the runtime error
91 at the last code line when creating the connection object.

Dim ADOCmd As New ADODB.Command
Dim ADOPrm As New ADODB.Parameter
Dim ADOCon As ADODB.Connection
Dim ADORs As ADODB.Recordset
Dim sParmName As String
Dim strConnect As String
Dim rStr As String

On Error GoTo ErrHandler

strConnect = CONNSTR

Set ADOCon = New ADODB.Connection

We have reinstalled MDAC 2.8 RTM, which is the same version used on the
machines where the code works. We have also tried to create a manual
database query from Excel (Data menu, Import External Data ...) which works
fine.

Any tips?

Brgds

Jonas


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Runtime error 91 when connecting to SQL Server 2000

#1 suspect would be the ADO refernce not the same version

1 - option Explicit then debug

and / or

compare results on a "working" pc to the "non-working" pc
VBE ToolsRefernces

Checked Available refernces:

Microsoft ActiveX Data Objects 2.8 Library


"Jonas" wrote:

Hi

I have an Excel sheet that connects to a SQL Server and fetches data via
ADODB. It works fine on all machines but one, where I get the runtime error
91 at the last code line when creating the connection object.

Dim ADOCmd As New ADODB.Command
Dim ADOPrm As New ADODB.Parameter
Dim ADOCon As ADODB.Connection
Dim ADORs As ADODB.Recordset
Dim sParmName As String
Dim strConnect As String
Dim rStr As String

On Error GoTo ErrHandler

strConnect = CONNSTR

Set ADOCon = New ADODB.Connection

We have reinstalled MDAC 2.8 RTM, which is the same version used on the
machines where the code works. We have also tried to create a manual
database query from Excel (Data menu, Import External Data ...) which works
fine.

Any tips?

Brgds

Jonas



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
Runtime error prevents Excel 2000 to save file gc Excel Worksheet Functions 2 January 25th 07 03:22 PM
connecting to back end server BW Excel Discussion (Misc queries) 1 November 1st 06 04:41 PM
Excel 2003 Error Cannot Locate the Internet Server or Proxy Server Seabee Excel Discussion (Misc queries) 0 November 20th 05 12:03 AM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
Excel Connecting to SQL Server Database - Need your Help Rajesh G Excel Programming 2 February 27th 04 08:01 PM


All times are GMT +1. The time now is 04:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"