具有全局范围的功能 [英] Functions with Global scope

查看:53
本文介绍了具有全局范围的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

在VBA Access中,有没有办法让Access数据库中的每个表单都可以访问该函数?

In VBA Access, is there any way to make a function accessible on every form in an Access Database?

我已经编写了许多函数来检查和收集我需要的表格中的信息,理想情况下我想在其他表格中使用这些函数而无需复制+粘贴他们到他们身上。文件大小不是问题,但我想让所有
看起来整洁,并且包括保留(如果可能的话)表单代码中的所有函数。

I've written a number of functions to check and gather information I need from my tables, and ideally I'd like to use those functions on other forms without having to copy + paste them onto them. File size isn't a concern, but I want to make everything look neat and tidy, and that includes keeping (if possible) all the functions out of the form code.

但我不知道怎么做,我的老师也没有(像往常一样)。你能给我的任何建议都是盛大的。

But I haven't a clue how to do it, neither does my teacher (as usual). Any advice you could give me would be grand.

谢谢你,b $ b詹姆斯

Thanks,
James

推荐答案

多个表单使用的任何代码都应该在Module中。然后可以从任何形式轻松调用潜艇。

Any code that is to be used by more than one form should be in a Module. The subs can then easily be called from any form.

您可能需要使用:

Public Sub

Public Sub

公共职能

以确保它们是全球性的。

to make sure they are global.


这篇关于具有全局范围的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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