ACC2: RegisterDatabase Method Does Not Modify ODBC.INI FileLast reviewed: May 20, 1997Article ID: Q132329 |
The information in this article applies to:
SYMPTOMSAdvanced: Requires expert coding, interoperability, and multiuser skills. When you use the RegisterDatabase method in a custom function to supply connection information for an ODBC data source, Microsoft Access does not modify the ODBC.INI file and may display the following error message:
"<Data Source> is not an existing data source name."This article assumes that you are familiar with Access Basic and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Access Basic, please refer to the "Building Applications" manual.
CAUSEThe RegisterDatabase method in Microsoft Access version 2.0 is designed for ODBC version 1.0. If you installed the ODBC Fulfillment Pack version 2.0, you have a newer, incompatible version of the ODBC.DLL file, ODBC.DLL 2.00.1912.
RESOLUTIONTo work around this problem, use one of the following methods to register an ODBC data source if you installed the ODBC Fulfillment Pack version 2.0.
Method 1In Access Basic, you can use the WritePrivateProfileString() API function to add connection information to the ODBC.INI file for an ODBC data source. The custom function adds the data source to the ODBC Data Sources section of the OBDC.INI file, and then creates a new section for the data source as follows:
[ODBC Data Sources] MyServer=SQL SERVER [MyServer] Driver=C:\WINDOWS\SYSTEM\sqlsrvr.dll Description=MyServer Data Source Server=MyServer Network=DBNMP3 Database=pubs Language=us_english OemToAnsi=NoFor details on using the WritePrivateProfileString() API function, please refer to the Microsoft Access Developer's Toolkit "Advanced Topics," version 2.0, Chapter 2, "Creating a Custom Setup Program," pages 32-34.
Method 2In Access Basic, you can use the SQLConfigDatasource API() function to write connection information for a data source to the ODBC.INI file. To create and test this function, follow these steps:
STATUSMicrosoft has confirmed this to be a problem in Microsoft Access version 2.0. This problem no longer occurs in Microsoft Access version 7.0.
MORE INFORMATION
Steps to Reproduce Problem
REFERENCESMicrosoft Access "Building Applications," version 2.0, Chapter 15, "Using Library Databases and Dynamic-Link Libraries," pages 367-371 "Microsoft ODBC Programmer's Reference and SDK Guide", version 2.0, Chapter 24, "Installer DLL Function Reference," pages 528-529 For more information about using the WritePrivateProfileString() API Function, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q90988 TITLE : How to Use Get, WritePrivateProfileStringFor more information about registering a data source from Microsoft Visual Basic, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q126940 TITLE : BUG: RegisterDatabase Fails After ODBC Version 2.x Installed |
Keywords : kberrmsg kbusage OdbcProb
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |