简体   繁体   English

在多个Access 2013项目之间共享VB代码

[英]Sharing VB code between several Access 2013 Projects

I am working on several different access projects that share a lot of code. 我正在几个共享大量代码的不同访问项目中工作。 Right now what I do is importing modules, which is fine as long as I'm the only one working on it, but for the future I need a better solution (also better than password protection). 现在我要做的是导入模块,只要我是唯一的模块就可以了,但是对于将来,我需要一个更好的解决方案(也比密码保护更好)。

What would be the best way to share code? 共享代码的最佳方法是什么? I have Visual Studio 2013 for that purpose. 为此,我有Visual Studio 2013。 I have tried creating a dll and com objects, but I couldn't add the files as a reference to Access, I think maybe it's because it was .NET, I'm not really sure. 我曾尝试创建一个dll和com对象,但是我无法添加文件作为对Access的引用,我想可能是因为它是.NET,我不确定。

As you can see I am not familiar with this subject, and so any hints/links/buzz words would bee highly appreciated. 如您所见,我对这个主题不熟悉,因此任何提示/链接/流行语都将受到高度赞赏。

Thanks, Yotam 谢谢,Yotam

One way to share code among VBA projects is to store the common code in a separate .accdb file (say, "CommonCode.accdb") and then add a Reference to that file in the various VBA projects that will use those common procedures and functions. 在VBA项目之间共享代码的一种方法是将通用代码存储在单独的.accdb文件中(例如,“ CommonCode.accdb”),然后在将使用这些通用过程和功能的各个VBA项目中添加对该文件的引用。 。

To add such a reference you need to click the "Browse..." button in the References dialog and then choose "Microsoft Access Databases (*.accdb)" from the "Files of Type" drop-down: 要添加这样的引用,您需要在“引用”对话框中单击“浏览...”按钮,然后从“文件类型”下拉列表中选择“ Microsoft Access数据库(* .accdb)”:

BrowseReference.png

I believe that the best way to share a VBA code is not to let it readable, but compiled. 我相信共享VBA代码的最好方法不是让它可读,而是使其编译。

You can do this by creating an Access Runtime , .accdr. 您可以通过创建Access Runtime .accdr来实现。

version control with ms-access: check here and there 使用ms-access的版本控制: 在此处那里检查

well ... these are the links to my own answers to this question, but I do not mind if you check and prefer other's answers 好吧...这些是我自己对这个问题的答案的链接,但是我不介意您是否选择并喜欢别人的答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM