Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

Thanks so much for having a place for us propeller heads to hang out and chat.

Geography

Where in the world do Tek-Tips members come from?

Method 'Connection' of object '_CurrrentProject' failed.

Gammachaser (Programmer)
17 Jul 12 11:28
I have a Function that I have been using to determine what other workstations are logged into a database using the CurrentProject.Connection. It worked well until Access 2010 got pushed to my pc and now I get the subject line error message. I also had Access97 and Access2003 on my pc so the IT folks here told me to get rid of the other versions because they were causing conflicts. I can understand that and since I had other problems that looked like corruption, I got rid of both older versions and some of the problems persisted. So, I had Access2010 reinstalled and all of the other problems went away, but I still get this message. The real kicker is it still works on two other machines I have tested it on that also got upgraded.

Here is the code (much of which I got somewhere on this site.)

CODE

Function LoggedInPCs() As String
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset

Set cn = CurrentProject.Connection
Set rs = cn.OpenSchema(adSchemaProviderSpecific, _
, "{947bb102-5d43-11d1-bdbf-00c04fb92675}")

While Not rs.EOF
    Select Case rs!Connected
        Case True
            LoggedInPCs = LoggedInPCs & Trim(rs!Computer_Name)
            While Right(LoggedInPCs, 1) = Chr(0)
                LoggedInPCs = Left(LoggedInPCs, Len(LoggedInPCs) - 1)
            Wend
            Select Case Left(rs!Computer_Name, Len(fOSMachineName)) = fOSMachineName
                Case True
                    LoggedInPCs = LoggedInPCs & " (This Computer)"
            End Select
            LoggedInPCs = LoggedInPCs & vbCrLf
    End Select
    rs.MoveNext
Wend
rs.Close
Set rs = Nothing
Set cn = Nothing
End Function 

The databse is split, copies run independenly on each machine. Indications are that something is wrong on my pc, but since I had Access2010 reloaded and all other problems went away, I am stumped. The failure is on the line 'Set cn = CurrentProject.Connection' Any ideas? I am not very strong on ADO...
vbajock (Programmer)
18 Jul 12 12:39
I'd start by inserting a Stop before the Set cn command and then display this to the Immediate Window:
? currentproject.Connection.ConnectionString

What do you get? If it is valid, see if a work around can come out of using the cn.open method and the connection string.
vbajock (Programmer)
18 Jul 12 12:39
I'd start by inserting a Stop before the Set cn command and then display this to the Immediate Window:
? currentproject.Connection.ConnectionString

What do you get? If it is valid, see if a work around can come out of using the cn.open method and the connection string.
vbajock (Programmer)
18 Jul 12 12:39
I'd start by inserting a Stop before the Set cn command and then display this to the Immediate Window:
? currentproject.Connection.ConnectionString

What do you get? If it is valid, see if a work around can come out of using the cn.open method and the connection string.
Gammachaser (Programmer)
19 Jul 12 14:26
There appears to be an echo in here...

I have done that... I get an error whenever I refer to the connection property of the current project. In break mode the message is Error in DLL, but this is not the first time I have gotten conflicting messages and neither one is really correct. To make sure the DLL was OK I had Access reloaded... but to no avail. Maybe there is a corrupt DLL that did not get reinstalled, but I can't see why it would not.

Anyone know which DLL would be responsible?
vbajock (Programmer)
19 Jul 12 15:44
Sorry about the repeats, one of the servers I work just does that for some reason, and this is the only site that doesn't surpress the repeated postings.

Have you tried going to Tools/References and making sure you are using the most current ADO version? You should be using 2.6 and above on 2010, I believe on Windows 7/Office 2010 machines it is 2.8 as the default.

You can find a diagnostic here:

http://www.microsoft.com/en-us/download/details.as...

You can find other tools here:

http://social.msdn.microsoft.com/Search/en-US?quer...

If you are using an older operating system with a 2010 installation that could be your problem.

IIRC, if you do a Windows Update on your machine manually, you get an "optional" upgrade of database components if those on your machine are obsolete.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close