Fix it now
Access is relaying a refusal from the ODBC layer, and the number tells you nothing about why. The database and the link definitions are fine; the driver, the data source, the credentials or the route to the server has changed. Test the connection outside Access first, then relink.
- Test the server on its own, before touching Access: Test-NetConnection sql01 -Port 1433 in PowerShell. False means the network or a firewall, and Access is innocent.
- Open the ODBC administrator that matches the Access build, not the one on the Start menu. A 32-bit Access needs the copy of odbcad32.exe in the SysWOW64 folder; a 64-bit Access needs the one in System32.
- Find the data source, choose Configure, and use Test Data Source at the end of the wizard. If it fails there, fix it there and stop reading.
- If the failure started on a rebuilt or freshly patched machine, look at the driver version. Microsoft changed the default: the Encrypt keyword defaults to yes in ODBC Driver 18 for SQL Server and later, and to no in earlier versions.
- In Access, open the Linked Table Manager, tick the affected tables and relink them with the corrected connection details.
Relink every table, not the one you tested. A partial relink leaves half the application pointing at a connection string that has already been proven wrong.
If a linked table opens and shows records, you are done. If it still fails, the next section covers the four things that break a stored connection and how to tell them apart.
Why it happens
A linked table is not a copy of anything. It is a stored connection string plus the name of an object at the far end. Every time a form opens, a query runs or somebody scrolls a datasheet, Access hands that string to the ODBC driver manager and asks it to do the work. If any part of the string no longer describes reality, everything that touches the table fails at once – which is why the symptom is usually total rather than partial, and why one failing table almost never means one failing table.
Bitness is the most misunderstood part of this. A 64-bit ODBC administrator manages 64-bit data sources and a 32-bit one manages 32-bit data sources, and neither can see the other’s. Which one you need is decided by the Access installation, not by Windows, so a data source that tests perfectly can be invisible to the application that needs it. Two separate administrators exist for exactly this reason.
The other frequent cause is a driver default that changed. Microsoft states that the Encrypt connection keyword defaults to yes in ODBC Driver 18 for SQL Server and later, and defaulted to no before that. A server without a certificate the client trusts is therefore refused by a driver that connected happily a version earlier, and the symptom appears the moment a workstation is rebuilt rather than gradually. Worth knowing while you argue about it: Microsoft also states that the login credentials are encrypted regardless of the Encrypt setting.
The data source is the wrong bitness
You have this one if The data source tests successfully in the administrator you opened, and Access still cannot see or use it.
- Read the Access build at File > Account > About Access.
- Open the matching ODBC administrator by path rather than from the Start menu: the SysWOW64 copy for 32-bit, the System32 copy for 64-bit.
- Recreate the data source there with the same name and settings, then relink from Access.
The driver now insists on encryption
You have this one if A newly built or freshly patched machine fails while older machines keep working, and the driver complains about the certificate.
- Identify the driver in the data source configuration or the connection string, and check whether it is version 18 or later.
- Where the server has a proper certificate, make sure the client trusts the issuing authority and connect by the name on the certificate.
- Where it does not, and you accept the risk on a private network, set TrustServerCertificate in the connection – which Microsoft describes as the server certificate not being checked.
- Confirm the server still supports the TLS versions the new driver will negotiate.
TrustServerCertificate=Yes removes the protection against an impersonated server. Treat it as a stopgap while a proper certificate is arranged, not as configuration.
The data source belongs to another profile, or is not there
You have this one if The problem follows one user, or appears on a terminal server or a newly built machine.
- Check whether the data source is a User DSN, which is per profile, rather than a System DSN.
- Recreate it as a System DSN so every profile on the machine sees it.
- Better, move to a DSN-less connection string held in the link itself, so nothing has to be configured on each workstation.
Credentials are not saved, or no longer work
You have this one if A login prompt appears where none used to, or the link worked until a password policy change.
- Prefer Windows authentication where the environment allows it, so no password is stored anywhere.
- Where stored credentials are required by the design, relink with the save-password option and accept that they then live inside the file.
- If the SQL login has expired or been disabled, have it reset on the server before relinking.
- Check the login still has permission on the objects the links point at, which a server-side tidy-up quietly removes.
The server cannot be reached
You have this one if The port test fails, or the server has been renamed, moved, or given a new instance name.
- Confirm the host name resolves and the port is open from the client subnet, not from the server.
- For a named instance, confirm the SQL Browser service is running and reachable, or name the instance port directly.
- Update the server name in the connection string and relink if the server has moved.
Full reference
Relinking many tables at once
Dim td As DAO.TableDef
For Each td In CurrentDb.TableDefs
If Len(td.Connect) > 0 Then
td.Connect = "ODBC;DRIVER={ODBC Driver 18 for SQL Server};" & _
"SERVER=sql01;DATABASE=Sales;Trusted_Connection=Yes;" & _
"Encrypt=Yes;"
td.RefreshLink
End If
Next td
Take a copy of the front-end before you run anything that rewrites every link in it. If the string is wrong you will have replaced a set of links that were merely stale with a set that are uniformly broken, and there is no undo.
Driver defaults that changed underneath you
| Keyword | ODBC Driver 18 and later | Earlier drivers |
|---|---|---|
| Encrypt | Defaults to yes | Defaults to no |
| TrustServerCertificate=Yes | The server certificate is not checked | The server certificate is not checked |
| Login credentials | Always encrypted regardless of Encrypt | Always encrypted regardless of Encrypt |
DSN or DSN-less
- A DSN-less connection string travels inside the database, so a new workstation needs nothing configured on it.
- A named data source is worth keeping where a central team manages it deliberately and wants one place to change the server name.
- A User DSN is the worst of both: invisible to other profiles, invisible on a new machine, and easy to create by accident.
- Whichever you use, record the driver name and version somewhere, because that is the field that changes underneath you.
What the numbers are, and are not
Microsoft publishes no error-number reference for the Access database engine, so 3151, 3146, 3155 and 3059 have no vendor-defined meanings to quote. What is useful about them is where in the sequence they appear: the connection refusal, the failed call underneath it, a rejected write, and a cancelled operation. Read the driver’s own error text, which appears under the Access message and is the part that actually names the problem.
When it breaks for everybody at once
Something shared changed: a server rename, a firewall rule, a certificate expiry, a login disabled, a service moved. When only some users are affected, look at the client side instead – the Access build, the bitness of the data source, the DSN scope and the driver version. That single split saves more time on this error than any other check, because the two halves have no fixes in common.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
3151 |
The ODBC layer refused or could not complete the connection; Access is relaying the driver’s refusal | not published by the vendor |
3146 |
A call handed to the ODBC driver failed, with the driver’s own error text underneath | not published by the vendor |
3155 |
An insert against a linked table was rejected at the server | not published by the vendor |
3059 |
The operation was cancelled, most often by dismissing a login prompt | not published by the vendor |
Confirm the fix worked
- Open one linked table in datasheet view and confirm records appear rather than a connection error.
- Run a query that joins two linked tables, to confirm the whole set relinked rather than the one you tested.
- Insert and delete a test record, to confirm write access as well as read.
- Close and reopen the database and confirm no login prompt appears if you did not intend one.
- Repeat on a second workstation, because bitness and driver version are per machine.
Questions people ask about this
Do I need to buy anything to fix this?
No. This costs nothing. The SQL Server ODBC drivers are free downloads from Microsoft, the administrator tools ship with Windows, and relinking is built into Access. A licence question only arises if you are adding SQL Server capacity, which is a separate conversation from this error.
Why did it break for everyone at once?
Because the shared part changed – a server rename, a firewall rule, a certificate expiry or a login change hits every client simultaneously. If only some users are affected, look at the client instead: Access bitness, DSN scope, and driver version.
Should we use a DSN or a DSN-less connection?
DSN-less is easier to support, because everything the link needs travels inside the database instead of having to exist on every workstation. Named data sources earn their place where a central team manages them deliberately.
Can I stop Access prompting for a password?
Yes, either by saving the password in the link or by switching to Windows authentication. Windows authentication is the better answer, because a saved password lives inside the file and travels with every copy of it.
It started right after the machine was rebuilt. What changed?
Most likely the ODBC driver version. From ODBC Driver 18 for SQL Server onwards the Encrypt keyword defaults to yes, where earlier drivers defaulted to no, so a server whose certificate the client does not trust is now refused where it used to connect.
