ACC95: RegisterDatabase Example in Help Causes ErrorLast reviewed: August 29, 1997Article ID: Q156225 |
The information in this article applies to:
SYMPTOMSModerate: Requires basic macro, coding, and interoperability skills. When you use the Example code for the RegisterDatabase method in Microsoft Access for Windows 95 version 7.0 Help, you may receive the following error message:
Run-time error '3146': ODBC--call failed. CAUSEIn the Example code, the following string expression assigned to the strAttribs variable is incomplete:
strAttribs = "Description=SQL Server on server PtLudlow" & _ Chr$(13) & "OemToAnsi=No" & Chr$(13) & "Network=DBNMP3" & _ Chr$(13) & "Address=\\PTLUDLOW\PIPE\SQL\QUERY" & Chr$(13) & _ "Database=MySQLDb"Also, the string expression for the SQL Server driver argument of the RegisterDatabase method is incorrect:
DBEngine.RegisterDatabase "PtLudlow", "SQL Server 32", True, strAttribs RESOLUTIONTo correct the RegisterDatabase Example code, add a Server attribute to the strAttribs expression as follows:
strAttribs = "Description=SQL Server on server PtLudlow" & _ Chr$(13) & "OemToAnsi=No" & Chr$(13) & "Network=DBNMP3" & _ Chr$(13) & "Address=\\PTLUDLOW\PIPE\SQL\QUERY" & Chr$(13) & _ "Database=MySQLDb" & Chr$(13) & "Server=PtLudlow"Then change "SQL Server 32" to "SQL Server" in the driver argument of the RegisterDatabase method as follows:
DBEngine.RegisterDatabase "PtLudlow", "SQL Server", True, strAttribs MORE INFORMATIONThe keyword "Server" is a required attribute for setting up the SQL Server ODBC driver, which is what this example uses. "Server" may not be a required attribute for other ODBC drivers. The driver argument of the RegisterDatabase method is a string expression that is the name of the ODBC driver. For the SQL Server ODBC driver, that name should be "SQL Server" instead of "SQL Server 32." To find the name of any ODBC driver available on your computer, click the ODBC icon in Control Panel, and then click the Add button. The names of all installed ODBC drivers appear in the Installed ODBC Drivers box.
REFERENCESFor more information about the RegisterDatabase method, search for "RegisterDatabase," using the Microsoft Access for Windows 95 Help Index.
Keywords : DcmHlp kberrmsg kbprg PgmOthr OdbcOthr Version : 7.0 Platform : WINDOWS Hardware : x86 Issue type : kbdocerr |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |