Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Method '~' of Object '~' failed on adodb.connection.open

Status
Not open for further replies.

123help1234

Programmer
Jun 1, 2005
10
US
Here is the code I'm using to connect to an Access 2000 database:

dim cn as adodb.connection
set cn = new adodb.connection

cn.open "Provider=Mircrosoft.Jet.OLEDB.4.0; Data Source=" & sDbPath & ";"

I've used it on all sorts of other projects with no problem. I shipped a VB6 program to a customer and when it gets to the cn.open line, they get an error:
Method '~' of Object '~' failed

I'm assuming this has something to do with MDAC/JET being installed incorrectly, but I can't figure out what to do. I'm using the same installer that has been used on hundreds of other computers without a problem. I tried having them download the MDAC2.6 Sp2 refresh and JET 4.0 SP8 files from the MS website and install them manually and it didn't help. I tried to have them download MDAC 2.8 as a last resort, but it wouldn't install on an XP machine. I also had them use regsvr32 on msado15.dll, dao350.dll, and dao360.dll after reading a newsgroup post that suggested that may help.

They've tried it on 4 different machines at their office. Two work, two don't. They all have different operating systems and various versions of Office installed.

Can anyone thing of something I can try?

Thanks
 
Check out this thread: Thread222-741237



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
 
Hi 123help1234,

> cn.open "Provider=Mircrosoft.Jet.OLEDB.4.0; Data Source=" & sDbPath & ";"

Spelling Error: You wrote Mi*r*crosoft

Regards
Joachim Bassendowski
 
Hi,

Between using Excel Macro record and such links as and
Code:
Sub GetADO_ConnectString()
      Dim conn As ADODB.Connection, dl As MSDASC.datalinks
      Dim strConn As String

      ' Assign the connection string to a variable.

      strConn = "DRIVER={SQL Server};SERVER=;UID=;PWD=;DATABASE="

      ' Create the Connection object.
      Set conn = New ADODB.Connection

      Set dl = New MSDASC.datalinks

      conn = dl.PromptNew
       'Assign the connection string and provider, then open the connection.
      With conn
        ActiveWorkbook.Sheets("sysParms").[Other] = .ConnectionString
'        .ConnectionString = strConn
'        .Provider = "MSDASQL"
'      ' Valid Enums for the ADO Prompt property are:
'      ' adPromptAlways = 1
'      ' adPromptComplete = 2
'      ' adPromptCompleteRequired = 3
'      ' adPromptNever =4
'        .Properties("Prompt") = adPromptAlways
        .Open
'        [ADO_ConnectString] = strConn
        .Close
      End With
      
      Set conn = Nothing
End Sub
, I don't think that I EVER typed my own connection strings.

Skip,
[sub]
[glasses] [red]Be advised:[/red]When Viscounts were guillotined just as they were disclosing where their jewels were hidden, it shows to go that you should...
Never hatchet your Counts before they chicken! [tongue][/sub]
 
Another trick is to use a dataenvironment, set it all up, and write the resulting connectionstring to the debug window.

Bob
 
I am getting the following error message when I run an
mde on only one workstation. I'm running this same
program on several other workstations with no problem.

Error Number 2147024769 Method 'Open' of object
'_Connection' failed

On the workstation that has the problem, I've running the
program with Access 97 Runtime - Access 2000 is installed
on the workstation. However, I'm not having any problem
with the Access tables - the program is failing when
I try to open a proprietary database.

Based on the research I've done, I'm thinking about
downloading MDAC 2.8. The workstation has MDAC 2.7
installed. Does anyone know of any issues with
downloading MDAC 2.8 ?
 
There are always issues. However, the main issue is with distribution. You might find that you can't distribute a different version of MDAC than is on your target machine.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top