I have 2 mdb linked. Original.mdb (not to be touched) and a copy.mdb
I've been using this for checking if tables exists:
我有2个mdb链接。 Original.mdb(不被触及)和copy.mdb我一直用它来检查表是否存在:
function CheckIfTableExists(myTable : AnsiString): boolean;
var
x := Integer;
bTrue : boolean;
begin
f1.ADOConnection1.GetTableNames(f1.ListBox1.Items,False);
bTrue := false;
for x := 0 to f1.ListBox1.Items.Count -1 do
begin
if (f1.ListBox1.Items.Strings[x] = myTable) then
begin
bTrue := true;
end;
end;
if (bTrue = true) then
begin
Result := True;
end
else
Result := false;
end;
end;
I'm sure there is a better way to do this, but so far it worked nice for me.
Now I need to check if a LINK to another mdb table exist. Does anyone know how to do that?
我确信有更好的方法可以做到这一点,但到目前为止它对我来说很好。现在我需要检查是否存在与另一个mdb表的LINK。有谁知道这是怎么做到的吗?
I.Bagon
I.Bagon
1 个解决方案
#1
1
Every Access MDB file has a hidden table named MSysObjects
which is basically a list of all objects in the MDB.
You can query this table to find out if an object with a given name exists in the MDB.
每个Access MDB文件都有一个名为MSysObjects的隐藏表,它基本上是MDB中所有对象的列表。您可以查询此表以查明MDB中是否存在具有给定名称的对象。
MSysObjects
contains ALL objects in the MDB. Not only tables, but forms and records as well.
You can filter on the Type
column to get only the tables:
MSysObjects包含MDB中的所有对象。不仅是表格,还有表格和记录。您可以在“类型”列上过滤以仅获取表:
Type = 1
--> local tableType = 6
--> linked table
Type = 1 - > local table Type = 6 - >链接表
#1
1
Every Access MDB file has a hidden table named MSysObjects
which is basically a list of all objects in the MDB.
You can query this table to find out if an object with a given name exists in the MDB.
每个Access MDB文件都有一个名为MSysObjects的隐藏表,它基本上是MDB中所有对象的列表。您可以查询此表以查明MDB中是否存在具有给定名称的对象。
MSysObjects
contains ALL objects in the MDB. Not only tables, but forms and records as well.
You can filter on the Type
column to get only the tables:
MSysObjects包含MDB中的所有对象。不仅是表格,还有表格和记录。您可以在“类型”列上过滤以仅获取表:
Type = 1
--> local tableType = 6
--> linked table
Type = 1 - > local table Type = 6 - >链接表