Test for validity of a linked table. (1 Viewer)

Atomic Shrimp

Humanoid lifeform
Local time
Today, 05:21
Joined
Jun 16, 2000
Messages
1,954
I'm working on an application designed to be a companion to a third-party, standalone Access application that is not split.

So my app will have a lot of its own tables, and these will be in a back end on a server, and will be linked in all instances of the front end.

But it will also have links to tables in the third party application - these will only work on one machine only (the one on which the application is installed).

I don't want to develop and maintain two different versions of the front end - I want to enable the functions that touch the third party linked tables only on the machine where they will work.

What's the best/most reliable way to detect whether a linked table is in working condition?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 05:21
Joined
Sep 12, 2006
Messages
15,710
any linked table (in fact any table) will have a connect string

currentdb.tabledefs("anytable).connect

for a local table, this is blank

for jet it looks like ;database=[fullpath] (with the leading semi-colon)

for other sources SQL, FoxPro, Dbase etc - it will look different

the basic test is to see if the connect string is what you expect it to be.

in A97, you couldn't see these strings without code. in later versions if you hover over a table in DBS window, it will show you the connection string.

you can modfiy, and process these table connections in code
 

Atomic Shrimp

Humanoid lifeform
Local time
Today, 05:21
Joined
Jun 16, 2000
Messages
1,954
Thanks for this info...

Because the table links were created first on a machine that did have the third party db, the connect string contains the name of the database, even when it's not there.

I guess I can strip out the path and filename of the db from the connect string, then use DIR to check if the database is there.
 
Last edited:

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 05:21
Joined
Sep 12, 2006
Messages
15,710
I think this is a standard thing to do

Its quite easy in Jet to test the links and rebuild them if the connection is incorrect.

I do this

I have a table that includes, for each linked table, the path, database, backend table name, and local table name.

i test one that i know to be populated, to make sure i can read something

if i can i exit

if i cant , i rebuild all the links based on the links table

if that fails i inform the user.

----------
in most cases, all the links are to the same backend - so i have a variant of this that allows the users to select a different backend (or a relocated back end)

its a bit trickier if you have multiple backends.

-------------
Jet is quite easy - other back ends may be trickier, perhaps because of unfamiliarity with the connect string formats, but also because there may be permissions and things to set up also. (eg ODBC links)
 

Users who are viewing this thread

Top Bottom