+ Reply to Thread
Results 1 to 11 of 11

Problem Connecting to Database

  1. #1
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Problem Connecting to Database

    Hi,

    I'm connecting to a MS SQL Database through ADODB. I have a reference to Microsoft ActiveX Data Objects 2.8 Library in my Excel file, and it works great on my computer. I've now tried it on a couple other people's computers, and it throws an error.

    The error is '430' Class does not support automation or does not support expected interface. It throw it on the second line below:

    Please Login or Register  to view this content.
    I'm planning on rolling out this excel file to a lot of people, so I any information on what could cause this would be greatly appreciated.
    Last edited by yawnzzzz; 04-15-2011 at 10:15 AM.

  2. #2
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Re: Problem Connecting to Database

    Some more detail, this reference points to:
    C:\Program Files\Common Files\System\ado\msado15.dll

    On both my computer and the one with the problem, that file is Version 2.81.3012.0

  3. #3
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Re: Problem Connecting to Database

    Some more details.

    If I type cnPubs. on my machine, I get the list of properties I would expect.

    If I type cnPubs. on the problem machine, it displays:
    DSO
    Session
    WrapDSOandSession

  4. #4
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Re: Problem Connecting to Database

    I'm still struggling on this. So, does anyone know another way to connect to a SQL database that might be less error prone when using on different machines?

  5. #5
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Re: Problem Connecting to Database

    Well, I switched to Microsoft ActiveX Data Objects 2.5 Library, and it works on all machines. If anyone know why that could be though or what to check for, please let me know. I'm still confused because as far as I can tell we all had the exact same dll. We were all on Windows XP SP3 with the same updates, so I'm not sure why 2 out of 4 computers didn't work, which concerns me with rolling out this tool to hundreds.

  6. #6
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Re: Problem Connecting to Database

    Apparently I spoke too soon. It does not work on 'all' machines.

    It appears that MDAC isn't recommended to install on users machines, so I'm feeling stuck again. If anyone has any suggestions for getting consistency with connecting to a SQL database across machines, please fill me in.

  7. #7
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Re: Problem Connecting to Database

    Some more notes to my search:
    1. Registering the appropriate dll did not solve the problem (ex. for 2.8 Version below):
    Please Login or Register  to view this content.
    2. Removing the reference and adding the reference did work though. So, I might start looking at how I could do that through my vba code.

  8. #8
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Re: Problem Connecting to Database

    So far, my only solution is to remove and then add the reference on the computer.

    There's two major problems with this:
    1. I have to set Macro Security to trust the VBA Project Object Model
    2. This essentially changes my code, which means that a digital certificate is no longer valid after this is done. Meaning, I'd have to either set macros to always be enabled or force users to enable macros every time they open a file, which users hate to do.

    Here's the code to remove and then add the ActiveX Data Objects 2.5 Reference.
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Re: Problem Connecting to Database

    Another note in my search. I went to spit-out every single property I could in relation to the Reference, and unfortunately they all matched:
    BuiltIn = FALSE
    Description = Microsoft ActiveX Data Objects 2.5 Library
    FullPath = C:\Program Files\Common Files\System\ado\msado25.tlb
    GUID = {00000205-0000-0010-8000-00AA006D2EA4}
    IsBroken = FALSE
    Major = 2
    Minor = 5
    Name = ADODB
    Type = 0

  10. #10
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Re: Problem Connecting to Database

    My latest thought is to take the file and save in 2007 format, so I can extract it and see what exactly changes after I remove and add the reference.

    I found a good reference here: http://www.codeproject.com/KB/cs/office2007bin.aspx

    So far I've:
    1. Saved as .xlsm
    2. Unzipped .xlsm (using 7-zip)
    3. Unzipped vbaProject.bin
    4. Found another program to help look at the files: MFC Docfile Viewer from MS
    5. Opened vbaProject.bin in MFC Docfile Viewer
    6. Under VBA, looked at dir
    7. Spotted text that says ActiveX, but it looks like gibberish to me right now.
    Last edited by yawnzzzz; 04-13-2011 at 06:12 PM.

  11. #11
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Re: Problem Connecting to Database

    I was hoping to avoid Late Binding due to the performance loss, but it appears to be my best option.

    With Late Binding, you remove the reference, and then use generic objects.

    Example below:
    Please Login or Register  to view this content.
    You lose some performance and intellisense (which means you have to replace things like adCmdStoredProc with their equivalent or 4 in this case), but it allows me to distribute the file with less worries about compatibility issues.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1