在Access SQL语句中使用表单中的函数?

时间:2021-03-06 22:52:10

I know if I make a code module in Access and place a function in it, I can run a query that has embedded calls to that function. However, I want to know if I can get a function that belongs to the code part of a form to be recognized by Access in a query. So far I cannot find a way, but it seems to me that this should be possible.

我知道如果我在Access中创建一个代码模块并在其中放置一个函数,我可以运行一个嵌入了对该函数的调用的查询。但是,我想知道是否可以获得属于表单的代码部分的函数,以便在查询中由Access识别。到目前为止我找不到办法,但在我看来这应该是可能的。

Thanks, Cameron

1 个解决方案

#1


You can - the function has to be made PUBLIC and the form must be OPEN when you run the query.

您可以 - 必须将该函数设置为PUBLIC,并且在运行查询时表单必须为OPEN。

Most of the time I put all common functions in a separate code module.

大多数时候,我将所有常用功能放在一个单独的代码模块中。

#1


You can - the function has to be made PUBLIC and the form must be OPEN when you run the query.

您可以 - 必须将该函数设置为PUBLIC,并且在运行查询时表单必须为OPEN。

Most of the time I put all common functions in a separate code module.

大多数时候,我将所有常用功能放在一个单独的代码模块中。