从另一个 MDB 调用一个 MDB 中的函数 [英] Calling function in one MDB from another MDB

查看:42
本文介绍了从另一个 MDB 调用一个 MDB 中的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们开发了一个合并函数,供其他进程使用,并希望将该函数定位在自己的 MDB 中(称为远程"),以便在需要时可以从caller.mdb"中引用和调用.该函数旨在返回一个数组,并且在直接从远程"内部调用时执行时效果很好.但是,通过在调用者"VBA 项目中正确引用远程",当调用者"进行调用时,函数会返回错误.我们收到各种错误,例如

We have developed a consolidation function that will be used by other processes and want to position the function in its own MDB (call it "remote") so that it can be referenced and called from "caller.mdb" when its needed. The function is designed to return an array and works great when executed called directly from within "remote." However, with "remote" properly referenced in the "caller" VBA project, when "caller" makes the call the function returns errors. We get a variety of errors such as

3078: Jet cannot find the input table or query

问题.在远程"中,如何正确设置对数据库及其本地对象的引用(例如,一个表和多个查询,包括 INSERT 和 UPDATE 查询)?CurrentDB 显然不是答案;我们还试验了 AccessObject 和 CodeData 对象.Remote"和caller"目前驻留在同一个驱动器上,所以这似乎不是问题.

QUESTION. Within "remote", how does one properly set references to the db and its local objects (e.g. one table and several queries including INSERT and UPDATE queries)? CurrentDB is apparently not the answer; we have also experimented with the AccessObject and CodeData objects. "Remote" and "caller" currently reside on the same drive, so that wouldn't seem to be the problem.

推荐答案

你可以使用 CodeDb 代替 CurrentDb,指向当前执行代码的 mdb.

Instead of CurrentDb you could use with CodeDb wich points to the mdb currently executing the code.

<代码>设置 db = CodeDb

这篇关于从另一个 MDB 调用一个 MDB 中的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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