如何将附件添加到Access 2007? [英] How do you add add-ins to Access 2007?

查看:67
本文介绍了如何将附件添加到Access 2007?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我拥有Access 2007,并且下载并安装了Developer工具.同时,我还安装了Access Runtime.开发人员工具很好并且可以工作一段时间.

I have Access 2007 and I downloaded the Developer tools and installed them. At the same time I also installed Access Runtime. The Developer tools were fine and working for a while.

有一天,我创建了一个ACCDE文件,我想将其打包为一个应用程序.制作完文件后,我打开了开发人员工具,但菜单中没有该图标.我以为出现了问题,因此我卸载了工具并重新安装了几次,但图标没有再出现.我进行了一些研究以找出问题所在,结果发现版本之间的切换已将其关闭.因此,我卸载了运行时,打开了Access的完整版本,并且厌倦了重新打开该添加功能,但是Access不会保存我单击该框后的内容.

One day, I had created an ACCDE file for which I wanted to package up as an application. Once I had made the file I went to open the Developer tools but the icon wasn't in the menu. I thought something had gone wrong so I uninstalled the tools and reinstalled them a few times but the icon didn't come back. I did some research to find out the problem and it turned out that switching between versions had turned them off. So I uninstalled runtime, opened up full version of access and tired to turn the add in back on but Access won't save that I had clicked the box.

我从访问权限中删除了该加载项,并厌倦了重新添加以查看是否可行.但是,我不实际如何从访问选项菜单中添加加载项.

I removed the add in from access and tired to re-add to see if that worked. However I don't how to actually add the add-ins from the access options menu.

我希望我已经清楚地解释了这个问题.

I hope I have explained the problem clearly.

推荐答案

已经五年了,但是当我用Google搜索"Access 2007自定义加载项"时,这是所有Stack Exchange上唯一的事情.进行搜索的其他人想知道我的发现.

It's five years later, but this is the only thing that came up on all of Stack Exchange when I Googled "Access 2007 custom add-in", so maybe someone else searching for that would like to know what I found out.

我不知道这是否适合原始提问者的需求,但是我想要的是拥有一个VBA模块,该模块具有用于从多个其他Access文件中的查询或模块中调用函数的代码.

I don't know if this would suit the needs of the original questioner, but what I wanted was to have a VBA module with code for functions to be called from queries or modules in multiple other Access files.

我发现了两个有用的资源:

I found two useful resources:

  • A StackOverflow post from eight years ago!
  • An Experts Exchange post from five years ago.

SO帖子提供了一个简单的解决方案,但是随后警告了潜在的问题,并提供了两个相当技术和复杂资源的链接. EE帖子提出了没有警告的相同简单解决方案.

The SO post offers a simple solution, but then there are warnings of potential problems, with links to two fairly technical and complicated resources. The EE post suggests the same simple solution without the warnings.

简单的解决方案是:

创建一个仅包含所需模块的Access文件,然后在旨在使用其代码的任何其他Access文件中创建对该文件的引用(通过VBA:工具>引用>浏览").

Create an Access file that contains only the desired module(s) and then create a reference to it in any other Access file intended to use its code (via VBA: "Tools > References > Browse").

就是这样!阿尔伯特·卡尔(Albert Kallal)在下面的评论中指出,从技术上讲,这是一个代码库,而不是一个外接程序,但是据我所知,它可以完成相同的工作.

That's it! Albert Kallal points out in his comments below that technically this is a code library, not an add-in, but as far as I can see, it accomplishes the same thing.

文件扩展名. SO帖子讨论了如何使用扩展名mdb,mde,accdb或accde命名新文件.另一方面,EE帖子说它可以具有扩展名mdb,mda,accdb或accda.我对"... e"文件不熟悉,也没有参与进来. EE帖子中说"... b"和"... a"扩展名是可互换的,并建议使用后者来假装代码库是一个加载项(因为它的行为类似于一个),这就是我的意思.已经完成了.

File extension. The SO post talks about naming the new file with the extension mdb, mde, accdb, or accde. The EE post, on the other hand, says it can have the extension mdb, mda, accdb, or accda. I'm not familiar with "...e" files and didn't get into that. The EE post says the "...b" and "...a" extensions are interchangeable and recommends using the latter to pretend that the code library is an add-in (because it acts like one), and that's what I've done.

它适用于accdb,而不适用于mdb文件.由于这两篇文章都谈到了mdb和accdb文件,因此我认为可以从两种类型的文件中调用该函数,但是我发现并不是案子.我发现,如果尝试从mdb文件中设置引用,Access表示无法完成.我尝试将库创建为带有扩展名mdb或mda的Access 2002-2003文件,并将其创建为带有扩展名accda的Access 2007文件.无法从mdb文件中引用它们.但是,通过accdb文件,该技术对我来说效果很好,现在我可以从多个accdb文件中调用该accda文件中定义的函数.

It works from accdb, not mdb files. Since both posts talked about mdb and accdb files, I figured the functions could be called from both types of files, but I found that wasn't the case. I found that if I attempted to set a reference from an mdb file, Access said it couldn't do it. I tried this with the library created as an Access 2002-2003 file with extension mdb or mda and with an it created as an Access 2007 file with extension accda. None of them were able to be referenced from an mdb file. However, from an accdb file, the technique has worked fine for me, and I'm now able to call functions defined in that accda file from multiple accdb files.

它可以在任何文件夹中. SO文章中链接的引用之一表示,如果包含代码的Access文件和引用该代码的Access文件位于不同的文件夹中,则该技术存在问题.它并没有说这些问题是什么,我在不同文件夹中的文件也没有遇到任何问题.

It can be in any folder. One of the references linked in the SO post says the technique has problems if the Access file containing the code and the one referencing it are in different folders. It doesn't say what those problems are and I haven't experienced any with my files in different folders.

用于Access和Excel的相同模块.顺便说一句,我在通过上述技术创建的Access库和Excel加载项中都使用了一个模块.因此,我使用该模块来定义可以从其他Access或Excel模块或从Access查询或Excel单元格调用的函数. (Access库和Excel加载项都有一个第二个模块,其代码无法在两个应用程序之间移植.)但是我必须小心维护通用模块,以便将Access或Excel中的更改复制到该模块中.其他,因为我还没有准备好使用单个文件作为添加项来解决 -用于多个应用程序.

Same module for Access and Excel. And by the way, I'm using one module in both my Access library created by the above technique and in an Excel add-in. So I use that module to define functions that can be called from either other Access or Excel modules or from Access queries or Excel cells. (The Access library and the Excel add-in both have a second module with code that is not portable between the two applications.) But I have to be careful to maintain the versatile module so that changes in either Access or Excel are copied to the other, since I'm not yet ready to tackle using a single file as an add-in for multiple applications.

保存警告.一种警告:请谨慎保存对模块所做的任何更改. SO帖子警告说,无法保存从引用它的Access文件的VBA窗口中对库模块所做的更改,因此必须在库本身的VBA窗口中进行更改.另一方面,根据我自己的痛苦经历,我发现从Excel窗口保存包含任何Excel模块的更改时,不会保存对任何Excel模块所做的更改.该模块必须从VBA窗口中保存,否则关闭文件时所有更改都将丢失而不会发出警告!

Save warning. One caution: Be careful about saving any changes to your modules. The SO post warns that changes made to a library module from the VBA window of an Access file referencing it cannot be saved, so changes must be made in the VBA window of the library itself. On the other hand, I have discovered by my own painful experience that changes made to any Excel module are not saved when the Excel file containing it is saved from the Excel window. The module must be saved from the VBA window or any changes will be lost without warning when the file is closed!

外接程序管理器怎么样?完成上述操作后,我很好奇如果尝试使用Access的外接程序管理器安装代码库会发生什么情况(可通过任一Database Tools > Developer Tools > Add-ins > Add-In Manager).我单击添加新",浏览到我的文件,然后单击打开".我收到消息,将外接程序复制到Microsoft Office Access目录时出错.外接程序未添加到Microsoft Office Access目录中."因此,我很幸运地找到了上述代码库技术,以替代使用实际的加载项.

What about the Add-in Manager? After doing the above, I was curious about what would happen if I tried to install the code library using Access's Add-in Manager (available via either Office button > Access Options > Add-Ins > Manage > Access Add-Ins > Go or Database Tools > Developer Tools > Add-ins > Add-In Manager). I clicked "Add New", browsed to my file, and clicked "Open". I got the message, "There was an error copying the add-in to the Microsoft Office Access directory. The add-in was not added to the Microsoft Office Access directory." So I'm lucky to have found the above code library technique as an alternative to using an actual add-in.

这篇关于如何将附件添加到Access 2007?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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