在Access 2013中修改链接的SQL表名称 [英] Modify linked SQL table name in Access 2013
本文介绍了在Access 2013中修改链接的SQL表名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Access中链接了一个SQL表.我想知道如何更改链接表对象,以引用具有相同设计但另一个名称的另一个表.例如,我链接Table1并使用它创建表单,现在需要将其更改为Table2.
I have a SQL table linked in Access. I'd like to know how to change the linked table object to reference a different table with the same design but another name. For example, I link Table1 and create forms with it, and now need to change it to Table2.
似乎没有一种简便的方法.
There doesn't seem to be an easy way to do this.
- 设计视图中的表说明包含所有链接的数据库和表信息,但是不可编辑.
- 使用链接表管理器,我可以更改表的来源数据库,但是两个数据库中的表必须具有相同的名称.
- 我可以使用
Select * From Table1
创建查询并将其更改为Select * From Table2
来切换表,但是如果不需要的话,我不想使用变通方法.
- The table Description in Design View contains all the linked database and table information but it's not editable.
- Using the Linked Table Manager, I can change the database the table comes from, but the tables in both databases need to have the same name.
- I can create a query with
Select * From Table1
and change it toSelect * From Table2
to switch tables, but I don't want to use a workaround if I don't have to.
推荐答案
Remove the linked table, and use DoCmd.TransferDatabase to recreate the link with different names:
DoCmd.TransferDatabase acLink, "ODBC", your_ODBC_String, acTable, _
"schema.source_table", "target_table"
您可以从现有的链接表中查找your_ODBC_String
.
You can look up your_ODBC_String
from existing linked tables.
根据需要添加StoreLogin:=True
参数.
这篇关于在Access 2013中修改链接的SQL表名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文