Article ID: 132329 - Last Review: November 6, 2000 - Revision: 1.0 ACC2: RegisterDatabase Method Does Not Modify ODBC.INI FileThis article was previously published under Q132329 On This PageSYMPTOMS
Advanced: 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. CAUSE
The 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.
RESOLUTION
To 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 ODBC.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=No For 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:
STATUS
Microsoft 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 INFORMATIONSteps to Reproduce Problem
REFERENCES
Microsoft 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: 90988 (http://support.microsoft.com/kb/90988/EN-US/ ) How to Use Get, WritePrivateProfileString For more information about registering a data source from Microsoft Visual Basic, please see the following article in the Microsoft Knowledge Base: 126940 (http://support.microsoft.com/kb/126940/EN-US/ ) BUG: RegisterDatabase Fails After ODBC Version 2.x Installed | Article Translations
|

Back to the top
