Could not find linked table.. (1 Viewer)

lespritdelescalier

Registered User.
Local time
Today, 03:57
Joined
Mar 16, 2015
Messages
50
I am using Access 2010, and have a linked table using an ODBC Machine Data Source. I can open the linked table in the database view, and view all of the data. I can create a new form, and connect to the table, and read and display the data. However, when I try to connect to the table from an existing form it gives me the following error:

Run-time error '3184':
Could not execute query; could not find linked table.

I am using the same code to connect to the table on both forms. Here is code that I used on the new form which successfully connects to the table. I also copied this code to the old form, and it throws the error on the last included line:

Code:
Dim db As Database
Set db = CurrentDb
    
Dim rs As Recordset
Set rs = db.OpenRecordset("select PART_PARENT from LINKED_TABLE where PART_PARENT = 'A'")

Some other relevant info: This is currently running on a test server with a test db. I have a copy running in production and there are no errors. However, we are migrating the database to a new server which is supposed to mirror the setup of the test one, so I can't just ignore it because it works in prod.

Thanks!
 

lespritdelescalier

Registered User.
Local time
Today, 03:57
Joined
Mar 16, 2015
Messages
50
Some updated info: I receive the error on my new form during runtime. I do not receive the error on any forms if i open the database view, then open the forms in design view and switch to form view.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:57
Joined
May 7, 2009
Messages
19,242
Did you try relinking the table. The path must have changed and the link is pointing somewhere.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:57
Joined
Feb 28, 2001
Messages
27,179
I have seen something like this before. If relinking doesn't help, see if you can build a query for the table that drives the form. Build the query to contain all the fields, and if that means making it a single-table query, so be it. Now rebuild the form using the query as the data source.

Do this ONLY if manually relinking (as suggested by ArnelGP) doesn't work, or works but then fails later. I cannot tell you why, but if you link via queries that link to the BE, for some strange reason it works.
 

lespritdelescalier

Registered User.
Local time
Today, 03:57
Joined
Mar 16, 2015
Messages
50
Hey thanks - I can't really make the form's source this query, as the form's source is already another table (which I can't link to this one).

I did make a query, and called it instead of the table. I still receive the same error message.
 

isladogs

MVP / VIP
Local time
Today, 11:57
Joined
Jan 14, 2017
Messages
18,219
I can't really make the form's source this query, as the form's source is already another table (which I can't link to this one).

I don't understand. Please explain

Try this small tweak

Dim db As Database
Set db = CurrentDb

Dim rs As DAO.Recordset
Set rs = db.OpenRecordset("select PART_PARENT from LINKED_TABLE where PART_PARENT = 'A'", dbOpenDynaset, dbSeeChanges)
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:57
Joined
Feb 28, 2001
Messages
27,179
Code:
Run-time error '3184':
Could not execute query; could not find linked table.

Let's clarify something.

A) Is the table's actual name 'LINKED_TABLE' ?

B) Did the error message say it could not find 'LINKED_TABLE' or 'linked table' (case and punctuation as shown for both options)?

I'm being pedantic because that error doesn't seem to be related to your recordset, but it might be related to the table USED by the recordset. So we need more details about that situation.
 

lespritdelescalier

Registered User.
Local time
Today, 03:57
Joined
Mar 16, 2015
Messages
50
I understand where you're coming from. Have to check everything!
A) Is the table's actual name 'LINKED_TABLE' ?
No, the table is not called 'LINKED_TABLE'. I just called it that for this example to remove any proprietary information from the table name.
B) Did the error message say it could not find 'LINKED_TABLE' or 'linked table' (case and punctuation as shown for both options)?
The error message was exactly as included in the original post. The name of the table is not in the error message.

Thank you!
 
Last edited:

isladogs

MVP / VIP
Local time
Today, 11:57
Joined
Jan 14, 2017
Messages
18,219
Did you try the changes I suggested in post 6?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:57
Joined
Feb 28, 2001
Messages
27,179
OK, when Access says it can't find a linked table as noted in that message, it is not talking about anything but a linked table that you named.

My thoughts about using a query to identify the linked table would allow you to open your recordset as though you were pointing to the table, but the thing you are actually pointing to would be a query that references the table in its proper place. If none of the other excellent suggestions seem to work, create a single-table query that holds all of the fields of the original table and then use THAT to do your work with the recordset. Sort of as a quick-and-dirty spot fix. If it works, fine. If not, then the problem has to be in the linkage itself. I.e. the connection in the local TableDef object that points to the table in the BE database.

UPDATE: Looks like our posts crossed. Making a DAO reference appears to have helped. I don't recall exactly when it happened, but for a while DAO was the default. But then Microsoft made DAO the default. But recently, the default appears to have changed back. And this was happening in the Ac2003 through Ac2013 time frame, and you are using Ac2010, so DAO could still have been the default for you.

The idea of using an explicit DAO qualifier means that the ADO library is probably named first in the list of default references. Thus, any names that overlap between DAO and ADO libraries are always "won" by the reference that occurs first in that list.
 

isladogs

MVP / VIP
Local time
Today, 11:57
Joined
Jan 14, 2017
Messages
18,219
I thought this worked, but looks like i spoke too soon. I am still receiving the same error message after trying this fix.

Did you apply the entire fix?
dbOpenDynaset is needed if you are going to use the form to update data
dbSeeChanges is always needed for SQL tables

I think you said it works in one form but not another.
Do you by any chance have both forms open at the same time as perhaps that could cause a problem
 
Last edited:

lespritdelescalier

Registered User.
Local time
Today, 03:57
Joined
Mar 16, 2015
Messages
50
OK, when Access says it can't find a linked table as noted in that message, it is not talking about anything but a linked table that you named.

My thoughts about using a query to identify the linked table would allow you to open your recordset as though you were pointing to the table, but the thing you are actually pointing to would be a query that references the table in its proper place. If none of the other excellent suggestions seem to work, create a single-table query that holds all of the fields of the original table and then use THAT to do your work with the recordset. Sort of as a quick-and-dirty spot fix. If it works, fine. If not, then the problem has to be in the linkage itself. I.e. the connection in the local TableDef object that points to the table in the BE database.

UPDATE: Looks like our posts crossed. Making a DAO reference appears to have helped. I don't recall exactly when it happened, but for a while DAO was the default. But then Microsoft made DAO the default. But recently, the default appears to have changed back. And this was happening in the Ac2003 through Ac2013 time frame, and you are using Ac2010, so DAO could still have been the default for you.

The idea of using an explicit DAO qualifier means that the ADO library is probably named first in the list of default references. Thus, any names that overlap between DAO and ADO libraries are always "won" by the reference that occurs first in that list.

I thought it worked, but it didn't. I tried to edit my post quickly, but didn't get to it in time. I also tried using the query to connect to the linked table, but upon opening the query during runtime I receive the same error message.
 

lespritdelescalier

Registered User.
Local time
Today, 03:57
Joined
Mar 16, 2015
Messages
50
dbOpenDynaset is needed if you are going to use the form to update data
dbSeeChanges is always needed for SQL tables

I think you said it works in one form but not another.
Do you by any chance have both forms open at the same time as perhaps that could cause a problem
Missed your edit until now. Thanks for the other suggestions.

I am not using the form to update data on this particular table. I am only reading data in this table.

It only works when opening the form from the database view. During runtime, it doesn't work on either form.
 

isladogs

MVP / VIP
Local time
Today, 11:57
Joined
Jan 14, 2017
Messages
18,219
OK - there must be some other cause that's difficult for any of us to guess without seeing your setup

I suggest you post stripped down versions of the FE & BE removing any confidential data but keeping the relevant parts of each
 

lespritdelescalier

Registered User.
Local time
Today, 03:57
Joined
Mar 16, 2015
Messages
50
Thank you everyone for your time and patience with this issue. I managed to find something that worked this morning.

I set up the application's startup procedure to refresh the link to the problem table by using the following code:

Declarations:
Code:
dim tDef as TableDef
dim strConnect as String

strConnect = [insert ODBC string here]

Refresh code for table:
Code:
tDef.Connect = strConnect
tDef.RefreshLink

I really only tried this because I was running out of options. I understand what this code is doing, but the original connection string for the table is the same as the one I am using to refresh it with, so I am not sure why this resolves the issue. I checked to make sure that the application is not using another ODBC or trying to connect to the production database.
 

Users who are viewing this thread

Top Bottom