I have developed a database with a variety of forms and reports in English (useful as that is the only language I am fluent in). I now need to adapt the system to display the forms and reports in Spanish. (someone else will be doing the translating).
What would people suggest as the best method to do this?
I’ve considered the on open event with lines to change the caption for each item on the form – or a database with an id for each piece of text and the english / spanish entries as alternate fields.
Any guidance appreciated
John
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Dual languages (2000)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Dual languages (2000)
- This topic has 20 replies, 3 voices, and was last updated 20 years, 8 months ago.
AuthorTopicWSjaf90
AskWoody LoungerAugust 23, 2004 at 9:35 am #408936Viewing 1 reply threadAuthorReplies-
WSHansV
AskWoody LoungerAugust 23, 2004 at 9:57 am #867678A simplistic solution would be to create a copy of the database and change all the captions. But of course, that is not very flexible – if you changed something later on, you’d have to do it in two places, with the chance of discrepancies.
A table with all captions in two (or more) languages is a very good idea.
You can set the captions in the On Open event of each form/report. If you choose this method, don’t enumerate the labels explicitly, but loop through them:
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acLabel Then
ctlCaption = …
End If
Next ctlAnother possibility: change all labels to text boxes that have Locked = Yes and Enabled = No, and that are formatted to look like labels. Set the Control Source of these text boxes to an expression that uses DLookup to retrieve the correct caption.
Both options might cause a noticeable delay when opening forms and reports.
Yet another option is to write a procedure that loops through all forms in the database, opens them in design view, sets the captions of the labels, and closes/saves them. Then the same for reports. This requires the person that runs this procedure to open the database exclusively, and to have permission to modify the design of forms and reports.
-
WSFrancois
AskWoody LoungerAugust 23, 2004 at 10:32 am #867680[indent]
If you choose this method, don’t enumerate the labels explicitly, but loop through them
[/indent]With this method you’ll still have to determine what control will have what text.
I suggest a simple select case in the on open event of the form. Something like :Select Case Language Case "English" Me.Label1.Caption = ... Me.Label2.Caption = ... Case "Spannish" Me.Label1.Caption = ... Me.Label2.Caption = ... End Case
Second thought:
If you want to use Hans’s code you could put the two captions in the Tag property of the control separated by a / and use:
Me.ctl.caption = IIF(Language = “English”,left(me.ctl.tag,instr(Me.ctl.tag,”/”)-1),mid$(me.ctl.tag,instr(me.ctl.tag,”/”)+1) -
WSFrancois
AskWoody LoungerAugust 23, 2004 at 10:32 am #867681[indent]
If you choose this method, don’t enumerate the labels explicitly, but loop through them
[/indent]With this method you’ll still have to determine what control will have what text.
I suggest a simple select case in the on open event of the form. Something like :Select Case Language Case "English" Me.Label1.Caption = ... Me.Label2.Caption = ... Case "Spannish" Me.Label1.Caption = ... Me.Label2.Caption = ... End Case
Second thought:
If you want to use Hans’s code you could put the two captions in the Tag property of the control separated by a / and use:
Me.ctl.caption = IIF(Language = “English”,left(me.ctl.tag,instr(Me.ctl.tag,”/”)-1),mid$(me.ctl.tag,instr(me.ctl.tag,”/”)+1) -
WSHansV
AskWoody Lounger -
WSFrancois
AskWoody Lounger -
WSHansV
AskWoody LoungerAugust 23, 2004 at 11:33 am #867700 -
WSFrancois
AskWoody Lounger -
WSFrancois
AskWoody Lounger -
WSHansV
AskWoody LoungerAugust 23, 2004 at 11:33 am #867701
-
-
-
WSFrancois
AskWoody Lounger -
WSjaf90
AskWoody LoungerAugust 23, 2004 at 12:08 pm #867714Thanks very much for that Hans. I hadn’t appreciated what the TAG field does – nice that it can be used as anything. I had presumed that your update was using the .caption directly – using the tag field gives it a method of linking information to the label which is much more straight forward.
I’ll have a play with the form you have sent – using the tag for the form/report to be modified is a great way to work it too.
If I wanted to make this routine a sub that could be accessed by any of the forms would I set it up as a public function and call it – I presume from looking at it that this procedure would work for both forms and reports without modification – just simply having the correct tag settings
John -
WSHansV
AskWoody LoungerAugust 23, 2004 at 12:41 pm #867724The procedure is quite general, but if you want to make it into a public function, you must replace the references to Me with CodeContextObject.
Public Function SetCaptions()
Dim lngLanguageId As Long
Dim ctl As Control
lngLanguageId = DLookup(“Value”, “tblSettings”, “Setting = ‘LanguageID'”)
CodeContextObject.Caption = DLookup(“Caption”, “tblCaptions”, _
“ObjectID = ‘” & CodeContextObject.Tag & _
“‘ AND TagID = ‘0’ AND LanguageID = ” & lngLanguageId)
For Each ctl In CodeContextObject.Controls
If ctl.ControlType = acLabel Then
ctl.Caption = DLookup(“Caption”, “tblCaptions”, _
“ObjectID = ‘” & CodeContextObject.Tag & “‘ AND TagID = ‘” & _
ctl.Tag & “‘ AND LanguageID = ” & lngLanguageId)
End If
Next ctl
Set ctl = Nothing
End Function -
WSHansV
AskWoody LoungerAugust 23, 2004 at 12:41 pm #867725The procedure is quite general, but if you want to make it into a public function, you must replace the references to Me with CodeContextObject.
Public Function SetCaptions()
Dim lngLanguageId As Long
Dim ctl As Control
lngLanguageId = DLookup(“Value”, “tblSettings”, “Setting = ‘LanguageID'”)
CodeContextObject.Caption = DLookup(“Caption”, “tblCaptions”, _
“ObjectID = ‘” & CodeContextObject.Tag & _
“‘ AND TagID = ‘0’ AND LanguageID = ” & lngLanguageId)
For Each ctl In CodeContextObject.Controls
If ctl.ControlType = acLabel Then
ctl.Caption = DLookup(“Caption”, “tblCaptions”, _
“ObjectID = ‘” & CodeContextObject.Tag & “‘ AND TagID = ‘” & _
ctl.Tag & “‘ AND LanguageID = ” & lngLanguageId)
End If
Next ctl
Set ctl = Nothing
End Function
-
-
-
WSjaf90
AskWoody LoungerAugust 23, 2004 at 12:08 pm #867715Thanks very much for that Hans. I hadn’t appreciated what the TAG field does – nice that it can be used as anything. I had presumed that your update was using the .caption directly – using the tag field gives it a method of linking information to the label which is much more straight forward.
I’ll have a play with the form you have sent – using the tag for the form/report to be modified is a great way to work it too.
If I wanted to make this routine a sub that could be accessed by any of the forms would I set it up as a public function and call it – I presume from looking at it that this procedure would work for both forms and reports without modification – just simply having the correct tag settings
John
-
WSHansV
AskWoody LoungerWSjaf90
AskWoody LoungerAugust 23, 2004 at 12:12 pm #867716A very neat idea Francois. I’ll test all the suggestions and see what works best. The simplicity of your second suggestion is great – but I can’t help but admire Hans’ database approach to it. I guess it just depends how quickly each works in the real life situation.
Thanks to both of youWSjaf90
AskWoody LoungerAugust 23, 2004 at 12:12 pm #867717A very neat idea Francois. I’ll test all the suggestions and see what works best. The simplicity of your second suggestion is great – but I can’t help but admire Hans’ database approach to it. I guess it just depends how quickly each works in the real life situation.
Thanks to both of youWSjaf90
AskWoody LoungerAugust 23, 2004 at 10:47 am #867686I think that although the idea of a database listing the alternate spellings would be nice, I’m probably better to stick to a more simplistic approach.
I like the simplicity of the case statements suggested. I wasn’t sure how I would be able to use the loop to update a variety of differing labels.
I’ll have a play around and see what I get.One pointer I do need….
If I have a table Language with a single field LangID which stores either GB or ES, how do I read this in as part of the on open for the first form – what commands would I use to open the database and store the value to a variable? I’ve never used a database for a table of opening constants, but can see that it would be a good idea.John
WSjaf90
AskWoody LoungerAugust 23, 2004 at 10:47 am #867687I think that although the idea of a database listing the alternate spellings would be nice, I’m probably better to stick to a more simplistic approach.
I like the simplicity of the case statements suggested. I wasn’t sure how I would be able to use the loop to update a variety of differing labels.
I’ll have a play around and see what I get.One pointer I do need….
If I have a table Language with a single field LangID which stores either GB or ES, how do I read this in as part of the on open for the first form – what commands would I use to open the database and store the value to a variable? I’ve never used a database for a table of opening constants, but can see that it would be a good idea.John
WSHansV
AskWoody LoungerAugust 23, 2004 at 9:57 am #867679A simplistic solution would be to create a copy of the database and change all the captions. But of course, that is not very flexible – if you changed something later on, you’d have to do it in two places, with the chance of discrepancies.
A table with all captions in two (or more) languages is a very good idea.
You can set the captions in the On Open event of each form/report. If you choose this method, don’t enumerate the labels explicitly, but loop through them:
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acLabel Then
ctlCaption = …
End If
Next ctlAnother possibility: change all labels to text boxes that have Locked = Yes and Enabled = No, and that are formatted to look like labels. Set the Control Source of these text boxes to an expression that uses DLookup to retrieve the correct caption.
Both options might cause a noticeable delay when opening forms and reports.
Yet another option is to write a procedure that loops through all forms in the database, opens them in design view, sets the captions of the labels, and closes/saves them. Then the same for reports. This requires the person that runs this procedure to open the database exclusively, and to have permission to modify the design of forms and reports.
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
*Some settings are managed by your organization
by
rlowe44
4 hours, 53 minutes ago -
Formatting of “Forward”ed e-mails
by
Scott Mills
7 hours, 7 minutes ago -
SmartSwitch PC Updates will only be supported through the MS Store Going Forward
by
PL1
7 hours, 32 minutes ago -
CISA warns of hackers targeting critical oil infrastructure
by
Nibbled To Death By Ducks
16 hours, 32 minutes ago -
AI slop
by
Susan Bradley
15 hours, 43 minutes ago -
Chrome : Using AI with Enhanced Protection mode
by
Alex5723
17 hours, 49 minutes ago -
Two blank icons
by
CR2
3 hours, 22 minutes ago -
Documents, Pictures, Desktop on OneDrive in Windows 11
by
ThePhoenix
1 day, 2 hours ago -
End of 10
by
Alex5723
1 day, 5 hours ago -
Single account cannot access printer’s automatic duplex functionality
by
Bruce
3 hours, 18 minutes ago -
test post
by
gtd12345
1 day, 11 hours ago -
Privacy and the Real ID
by
Susan Bradley
1 day, 1 hour ago -
MS-DEFCON 2: Deferring that upgrade
by
Susan Bradley
17 hours, 38 minutes ago -
Cant log on to oldergeeks.Com
by
WSJonharnew
1 day, 15 hours ago -
Upgrading from Win 10
by
WSjcgc50
3 hours, 28 minutes ago -
USB webcam / microphone missing after KB5050009 update
by
WSlloydkuhnle
7 hours, 1 minute ago -
TeleMessage, a modified Signal clone used by US government has been hacked
by
Alex5723
2 days, 7 hours ago -
The story of Windows Longhorn
by
Cybertooth
1 day, 19 hours ago -
Red x next to folder on OneDrive iPadOS
by
dmt_3904
2 days, 9 hours ago -
Are manuals extinct?
by
Susan Bradley
3 hours, 4 minutes ago -
Canonical ditching Sudo for Rust Sudo -rs starting with Ubuntu
by
Alex5723
2 days, 18 hours ago -
Network Issue
by
Casey H
2 days, 5 hours ago -
Fedora Linux is now an official WSL distro
by
Alex5723
3 days, 6 hours ago -
May 2025 Office non-Security updates
by
PKCano
3 days, 6 hours ago -
Windows 10 filehistory including onedrive folder
by
Steve Bondy
3 days, 8 hours ago -
pages print on restart (Win 11 23H2)
by
cyraxote
2 days, 9 hours ago -
Windows 11 Insider Preview build 26200.5581 released to DEV
by
joep517
3 days, 11 hours ago -
Windows 11 Insider Preview build 26120.3950 (24H2) released to BETA
by
joep517
3 days, 11 hours ago -
Proton to drop prices after ruling against “Apple tax”
by
Cybertooth
3 days, 18 hours ago -
24H2 Installer – don’t see Option for non destructive install
by
JP
3 hours, 33 minutes ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.