在Access中设置链接表以查找尚不存在的路径? [英] Setup a linked table in Access for a path which doesn't exist yet?

查看:239
本文介绍了在Access中设置链接表以查找尚不存在的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何在尚不存在路径的情况下设置链接表?

How can we setup a linked table where the path doesn't exist yet?

我们需要在Access中设置一个链接表,以便最终在未安装MS Access的客户环境中使用(Access数据库只是通过Jet用作后端).

We need to setup a linked table in Access for eventual use in a customer environment which doesn't have MS Access installed (the Access database is simply utilised as a backend via Jet).

我们可以使用Jet&客户站点上的DDL可以在他们的.mdb中创建/编辑/删除表,但据我所知您不能使用DDL创建链接表.

We can use Jet & DDL on the customer's site to create/edit/drop tables in their .mdb but as far as I can tell you can't create linked tables using DDL.

理论上,我们可以在此处创建链接表(在这里我们具有Access),并使用VBA这样指定无效"路径(假设乞力马扎罗是我们网络上不存在的客户服务器):

In theory we can create the linked table here (where we have Access) and specify the "invalid" path using VBA like so (assume Kilimanjaro is the customer's server which doesn't exist on our network):

Function SetLinkedTablePath(tableName As String)
    Dim cdb As DAO.Database
    Set cdb = CurrentDb
    cdb.TableDefs(tableName).Connect = ";DATABASE=\\Kilimanjaro\Foo-Data.mdb"
    cdb.TableDefs(tableName).RefreshLink
    Set cdb = Nothing
End Function

但是.RefreshLink行尝试验证路径,因此在我们的网络上失败.

However the .RefreshLink line attempts to validate the path so fails on our network.

如果我们注释掉.RefreshLink行并运行它,则可以正常执行,但是未选中Access中的链接表管理器新路径.

If we comment out the .RefreshLink line and run it it executes fine, but checking Linked Table Manager in Access the new path hasn't taken.

有什么解决办法吗?我们不希望使用映射驱动器.

Any solution to this? We'd prefer not to use a mapped drive.

推荐答案

最后,我们在网络上获取了一个备用虚拟机,并临时重命名了虚拟机以匹配客户端的服务器(例如,将其命名为\\Kilimanjaro).然后,我们可以创建链接表,而没有任何问题.

In the end we took a spare virtual machine on our network and temporarily renamed it to match our client's server (call it \\Kilimanjaro for example). Then we could create the linked table without any problem at all.

这是不令人满意且不雅的.但是我将接受这个答案,因为这是我们的解决方案,但是如果有人想出了更巧妙的方法,我很想听听.

It's unsatisfactory and inelegant. But I'm going to accept this answer as it was our solution but if anyone ever comes up with a neater trick, I'd love to hear it.

这篇关于在Access中设置链接表以查找尚不存在的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆