首页 > 解决方案 > Relative name to get information from Form in MS Access

问题描述

I would like to know if it is possible in a Saved Query on MS Access to use WHERE clause getting value from a Form independent of MS Access installed language?

In a MS SQL QUERY WHERE clause that should be equal to a text in a form, I wrote it like this

= Form!Form_name!text_name

This work fine if all user have MS English version installed, however, this is not true in my case, as some users have a Portuguese version. In their version, the right way to call the same syntax should be:

= Formulários!Form_name!text_name

So, the problem is that Access does not recognize this considering language version. Due to this, if a user with Portuguese version try to run the query, it will pop up an insert box.

I've look throughout many sources but none could help me to solve this.

Thank you all in advance!

标签: ms-accessms-access-forms

解决方案


我无法对此进行测试,因为我没有葡萄牙语版本的 Access,但我避免调用表单参数,因为它们很脆弱。例如,表单必须打开,或者查询以奇怪的方式失败。如果我必须使用表单的参数,我将参数包装在一个公共函数中(通常在该表单代码后面)。 即使在设计器中,公共函数通常也会被智能感知拾取,但公共变量不会。
我的风格是将属性与私有全局范围变量和公共 get 和 set 函数合成。然后在设计器中您可以调用:get-myforms-property 而不是 Form!Form_name!text_name。当表单打开和关闭时,我通常调用 set-myforms-property 并将其设置为等于实际的表单属性。通过这种方式,您还可以获得包装的优势。例如,您可以选择在表单关闭时返回什么值,而不仅仅是让查询失败。


推荐阅读