Refering to Linked Databases

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I refer to linked tables with vba code? What is the syntax?

currentDB.linkedtabledefs.count? etc.
Where does a linked database fit into the code?
I've seen quite a few DBs with a forms database and another database to hold
tables and function as a data warehouse. But if I want to add my own generic
forms, I have to add them to the warehouse to bring them up.

I can't put them in the forms DB and display queries and tables unless I know
the syntax to refer to tables from linked DBs.

(e-mail address removed)
 
Dear Spam:

You have me rather confused about your meaning.

There's a huge difference between a linked table (a MDB function that
is normally makes reference to tables quite transparently identical to
local tables) and a linked database (a feature of MSDE / SQL Server
databases). Data warehousing is yet another separate technology, and
techniques for working with them are generally quite unrelated to how
they are referenced from VBA. How you would put forms in a data
warehouse is not something I understand. Do you simply mean a split
database backend?

So then is your "forms DB" just a split front end? If you create an
MDB and link to those tables, all the syntax of referencing them is
handled transparently.

I need you to help me try to help you on this one.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
Loop through the TableDefs collection (if you're using DAO) and test for NOT
NULL in the "Connect" property of each TableDef. If the connect field has a
value in it then the table is a linked table.

Jamie

Server side anti spam rules are enforced and ALL unsolicited email is
deleted.
 
A slight correction, if I may, Jamie.

The Connect property is a string, and will therefore never be Null. If the
table is not a linked table, then the Connect property will return an empty
string ...

? isnull(currentdb.TableDefs("Orders").Connect)
False
? currentdb.TableDefs("Orders").Connect = vbnullstring
True

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Whoops! Yep, oversight on my part, thanks for the correction.

Jamie

Server side anti spam rules are enforced and ALL unsolicited email is
deleted.
 
They used Linked Table Manager to use one DB as a front end with forms, with
links to tables in another DB which serves as the warehouse.
(e-mail address removed)
 
Actually the problem was the table wasnt even listing because I was looking for
an attribute of 0. When I cahnged it to this

If tb(i).Attributes = 0 Or tb(i).Attributes = "1073741824" Then

Then it showed linked tables.
(e-mail address removed)
 
Back
Top