Linking tables (1 Viewer)

Cliff67

Registered User.
Local time
Today, 02:07
Joined
Oct 16, 2018
Messages
175
Hi All
I'm trying to get access to link to the Back End tables, no problems there..usually
StrTable is a passed table name ("Tbl_Version")
I've set a variable VarRet as Variant and I'm using

VarRet = CurrentDb.TableDefs(StrTable).Fields(0).Name

If Err <> 0 Then
CheckLinks = False
Else
CheckLinks = True
GoTo VerifyLinksDone
End If

(checkLink is a Boolean flag) this checks for a failure. If it can't determine the name of the first field in the table then it must be a bad link

however, when stepping through the code I get a error 3265 - Item not found in this collection.

Does any one know what I'm missing? been going through this most of the day :banghead::confused:

many thanks in advance

Cliff
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:07
Joined
Oct 29, 2018
Messages
21,467
Hi. Which line is giving you the error?
 

Cliff67

Registered User.
Local time
Today, 02:07
Joined
Oct 16, 2018
Messages
175
Sorry the line that starts VarRet =CurrentDb
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:07
Joined
Oct 29, 2018
Messages
21,467
Okay, my guess is the table you're trying to access does not exist. Can you verify the table is there? What is the value in StrTable?
 

Cliff67

Registered User.
Local time
Today, 02:07
Joined
Oct 16, 2018
Messages
175
StrTable value is Tbl_Version

what I'm trying to do is check if the Linked table exists i.e. has the back end moved then depending on the result re-link it of just go on and do what it needs to do.

At the point of failure the BE has been moved so I'm testing the link procedure

many thanks

Cliff
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:07
Joined
Oct 29, 2018
Messages
21,467
Hi Cliff. I think I understand now. You're getting the failure because you're trying to read the name of the first field in a table that's not accessible because the BE was moved. The way I do it is use the Connect property to locate the filepath of the BE and then use Dir() to check if the BE still exist at the expected location.
 

Cronk

Registered User.
Local time
Today, 19:07
Joined
Jul 4, 2013
Messages
2,772
I wonder if the statement
Code:
On error resume next
has been omitted.
 

Cliff67

Registered User.
Local time
Today, 02:07
Joined
Oct 16, 2018
Messages
175
Hi Cronk

That has not been included. I call the procedure from a splash form that comes up and connects the BE to the FE.
 

Cliff67

Registered User.
Local time
Today, 02:07
Joined
Oct 16, 2018
Messages
175
Hi TheDBGuy

Ok thanks I've give that a try and keep you posted.

many thanks

Cliff
 

Users who are viewing this thread

Top Bottom