ACC97: ODBC Error Using IDC Files to Query SQL Server Tables (161015)
The information in this article applies to:
This article was previously published under Q161015 Advanced: Requires expert coding, interoperability, and multiuser skills.
SYMPTOMS
When you use IDC files to query a table in a Microsoft Access 2.0, 7.0, or
97 database that is linked to Microsoft SQL Server, you may receive the
following error message if the SQL Server password is not saved with the
linked table when you create it:
ODBC -- connection to '<Server Name>' failed.
This happens even if you specify a username and password in the IDC file.
CAUSE
The IDC file uses a System DSN to communicate with the Microsoft Access
database that contains the linked tables. The username and password in the
IDC file are used to log on to the Microsoft Access database. The Microsoft
Access database cannot use the same username and password to log on to
Microsoft SQL Server.
RESOLUTION
There are two methods to work around this behavior.
Method 1
Create a System DSN to query the Microsoft SQL Server database directly
instead of using the Microsoft Access database with linked tables. Rewrite
your IDC file so it uses the new System DSN. Then the username and
password in your IDC file are used to log on to SQL Server.
Method 2
Save the password with the linked table when you create it in the Microsoft
Access database.
The following example shows you how to save a password with a linked SQL
Server table. This example assumes that you have a valid System DSN on
your computer that points to the sample Pubs database on a Microsoft SQL
Server.
- Start Microsoft Access and open the sample database Northwind.
- On the File menu, point to Get External Data, and then click Link
Tables.
- In the Link dialog box, select ODBC Databases() in the Files Of type
box.
- In the Data Source dialog box that appears, select the System DSN that
points to the Pubs database on your SQL Server, and then click OK.
- In the SQL Server Login dialog box, type a valid Login ID and Password,
and then click OK.
- In the Link Tables dialog box, click dbo.authors, click to select the
Save password check box, and then click OK.
- The linked table appears in the Northwind table list, and the SQL
Server username and password is saved with it.
Now you can query the linked table with an IDC file.
REFERENCES
For more information about linking tables to ODBC data sources, search the
Help Index for "ODBC, importing and linking data," or ask the Microsoft
Access 97 Office Assistant.
Modification Type: | Minor | Last Reviewed: | 1/26/2005 |
---|
Keywords: | kberrmsg kbprb kbusage KB161015 |
---|
|