Runtime error 91 when connecting to SQL Server 2000

J

Jonas

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
 
V

Vacation's Over

#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 > Tools>Refernces

Checked Available refernces:

Microsoft ActiveX Data Objects 2.8 Library
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top