MS Access 仅对表单的多语言支持 [英] MS Access Multiple language support for forms only
问题描述
有什么方法可以将另一种语言应用于 Access 表单.我在创建表单时遇到问题,因为数据库值以英语存储,我必须从不同语言的同一个表中生成两个相同的表单.一切顺利,直到我到达像 Gender 这样的查找字段.我的表可选值是男"和女",适用于英文形式,但如何在不改变表值的情况下以非英文形式更改它
Is there any way to apply another language to Access forms. I have an issue while creating forms, as the DB values are stored in English and I have to generate two identical forms from same Table in different languages. Everything goes well till I reach a look up field like Gender. My table optional values are 'Male' and 'Female' and is good for English form but How can I change that in my non-English form without changing table value
推荐答案
一种方法是将实际值存储在主表中为 M
和 F
,例如
One way to do it would be to store the actual values in the main table as M
and F
, e.g.
ID FirstName Gender
-- --------- ------
1 Gord M
2 Angie F
并创建一个名为 [Genders] 的参考表,如下所示:
and create a reference table named [Genders] like so:
TableValue Language Translation
---------- -------- -----------
M fr_ca masculin
F fr_ca féminin
M en_us Guy
F en_us Girl
M en_ca Male
F en_ca Female
在您的表单上,创建一个名为 txtFormLanguage
的隐藏未绑定文本框,并在 Form_Load 事件处理程序中像这样填充它:
On your form, create a hidden unbound text box named txtFormLanguage
, and in the Form_Load event handler populate it like this:
Private Sub Form_Load()
Me.txtFormLanguage = IIf(IsNull(Me.OpenArgs), "en_ca", Me.OpenArgs)
End Sub
现在您的组合框可以使用以下作为其Row Source
...
Now your combo box can use the following as its Row Source
...
SELECT TableValue, Translation FROM Genders WHERE (((Genders.Language)=[txtFormLanguage]));
...并具有类似于以下的其他属性:
...and have other properties similar to the following:
绑定列:1
列数:2
列宽:0";1"
Bound Column: 1
Column Count: 2
Column Widths: 0";1"
当表单正常打开时(没有OpenArgs
)...
When the form is opened normally (without OpenArgs
)...
Docmd.OpenForm "ClientForm", acNormal, , , acFormEdit, acWindowNormal
...它默认为 en_ca
(英语,加拿大)并显示组合框
...it defaults to en_ca
(English, Canada) and the combo box displays
Male
Female
当为 fr_ca
(法国、加拿大)打开表单时...
When the form is opened for fr_ca
(French, Canada)...
Docmd.OpenForm "ClientForm", acNormal, , , acFormEdit, acWindowNormal, "fr_ca"
...组合框显示
masculin
féminin
这篇关于MS Access 仅对表单的多语言支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!