VBA code calling a VB6 dll method under regular account gets ODBC Driver error but works when run as Administrator

1

I have a Word template (.dot) open in Word 2016 that references a VB6 dll. When I run the VBA code with my regular user account I receive an error message. When I run it under my Admin account, I do not get the error. The error occurs on the referenced objects "Load()" method call:

Dim m_Manager As New PrefixService.Manager
Call m_Manager.Load(subjectID, ClientID)

The exact error is:

Run-time error '-2147467259 (80004005)': [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I have done some research but am in unfamiliar territory. I keep reading things about the registry and ODBC. There is an entry in the registry for PrefixService.Manager and users have read access to it. As for the ODBC Data Source Administrator, I am not sure what to look for but search results mention connection strings and Microsoft Access a lot even though I am not sure what they have to do with me referencing a dll and executing code from it. Microsoft Access 2016 is installed. I have run the Windows Sysinternals ListDlls command on the WINWORD process and saw that the dll was never loaded, however, under my Admin account, I can see the dll gets loaded. While in ODBC Data Source Administrator, I ran a trace, but unfortunately I do not speak ODBC and find it difficult to understand.I believe the following section contains the information about the issue:

o "u"           1260-ca4    ENTER SQLDriverConnectW 
    HDBC                0x0BA01850
    HWND                0x00000000
    WCHAR *             0x5A768B34 [      -3] "******\ 0"
    SWORD                       -3 
    WCHAR *             0x5A768B34 
    SWORD                       -3 
    SWORD *             0x00000000
    UWORD                        0 <SQL_DRIVER_NOPROMPT>

o "u"           1260-ca4    EXIT  SQLDriverConnectW  with return code -1 (SQL_ERROR)
    HDBC                0x0BA01850
    HWND                0x00000000
    WCHAR *             0x5A768B34 [      -3] "******\ 0"
    SWORD                       -3 
    WCHAR *             0x5A768B34 
    SWORD                       -3 
    SWORD *             0x00000000
    UWORD                        0     <SQL_DRIVER_NOPROMPT>

    DIAG [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) 

o "u"           1260-ca4    ENTER SQLGetDiagRecW 
    SQLSMALLINT                  2 <SQL_HANDLE_DBC>
    SQLHANDLE           0x0BA01850
    SQLSMALLINT                  1 
    SQLWCHAR *          0x0036E93C
    SQLINTEGER *        0x0036E514
    SQLWCHAR *          0x0036E53C 
    SQLSMALLINT                512 
    SQLSMALLINT *       0x0036E524



o "u"           1260-ca4    EXIT  SQLGetDiagRecW  with return code 0 (SQL_SUCCESS)
    SQLSMALLINT                  2 <SQL_HANDLE_DBC>
    SQLHANDLE           0x0BA01850
    SQLSMALLINT                  1 
    SQLWCHAR *          0x0036E93C [       5] "IM002"
    SQLINTEGER *        0x0036E514 (0)
    SQLWCHAR *          0x0036E53C [      91] "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
    SQLSMALLINT                512 
    SQLSMALLINT *       0x0036E524 (91)

I am now at a loss other than it appears to be permissions based. Oh and the OS is Windows 7 Enterprise

vba
windows-registry
dll
odbc
vb6
asked on Super User Mar 27, 2019 by Kyle Pierson

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0