Link to home
Start Free TrialLog in
Avatar of TechGuise9
TechGuise9

asked on

Is there a property that could be used as a second tag, or a property that could hold a second caption?

Hi Experts,
I have some forms in a database that occassionally (depending on who walks up to the workstation) needs to display text in SPANISH or ENGLISH.    I have done this in the past by just hard coding the two versions of the text using VBA and changing the CAPTION of the BUTTON or LABEL via that code.  

I'd like to figure out two properties on a CONTROL (button or label), to hold the ENGLISH and SPANISH versions of text, then use the TAG property to decide which CONTROLS get toggled back and forth.

My thinking is that if I can streamline the way I do this, it will be lots easier to add the "BI-lingual" feature to new forms, and easier to enter/edit the SPANISH version without having to dig around in the VBA.  

Any ideas?
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Makes more sense to put this in a table with FormName, ControlName, Language, Caption

Then you can use the Form load event to loop through this table and populate the caption properties based on a database wide variable that identifies the specific language.  This way, you can eventually expand beyond those two languages if you need to.

AFAICT you could use a Public variable for this as well

In a module, do something like this:

Public strpubLanguage as string

Then on your startup form, put an option group that sets this variable.

If me.fraLanguage=1 then
   strpubLanguage ="English"
ElseIF me.fraLanguage=2 then
   strpubLanguage ="Spanish"
End if

Then use this variable to set the language

If strpubLanguage ="English"  then
    'Your code to set the text to English
ElseIF me.fraLanguage=2 then
    'Your code to set the text to Spanish
End if

Also, consider just installing the "Language pack"
http://office.microsoft.com/en-us/suites/language-packs-for-the-2007-microsoft-office-system-product-overview-HA010211368.aspx.

As most of the functionality you may need is simply built in.

An added benefit would be the the Menus/Ribbon/commands, in Access will change as well..
;-)

JeffCoachman
Avatar of TechGuise9
TechGuise9

ASKER

I am assuming that the answer to my original question is "No", there are no other properties or "ways"  to hold an "English" and a "Spanish" version of the caption text.    

The two suggested solutions above I'm sure are much more programatically correct than what I am wanting to do, but neither gives the desired outcome I'm looking for.  

I want future users to be able to open up the properties of a control and see both language versions without diving into the code.   There can be all kinds of complicated code behind the scenes changing the current values, but need it very very clear as to what and where the different versions are kept (while on the same screen as the control)

Thinking the best option will be to add a second Control for each control to hold text.  (clunky I know)

Since both seem to be good solutions, but neither fitting my "odd" desires, I will split points unless someone has an objection.

Thanks
To try to answer your question directly:
No, there is no distinct "Language Property" of any control that you can set to English/Spanish and it will "automaitcally" swithch the language of the text in that control.

But to be clear, you can use the "Tag" Property and set it to a certain value (ex: "ML" for multi-lingual) for all the controls that you want to swap the languages.
Then use code like I posted to do the swap.
(Presumming that somewhere you have the different languages stored)

Something *roughly* like this.
If strpubLanguage ="English"  then
Dim ctl as control
    For each ctl in me.controls
        If ctl.tag="ML" then
            me.ctl='Your function to change the text to English
...etc


But again, investigate the language Packs...
Thanks, the TAG method was what I was hoping to use all along.  My challenge was/is a local place (relative to control) to store the two different versions.

The language packs won't work.   It is for a manufacturing facility that uses special terms that don't always translate correctly.

Wonder if it is possible to seperate the TAG property into sections
          (ie.. ML Hello Hola) and use VB code to look at the correct section?
Maybe a "Right(ctl.tag,string......???
I wouldn't even know where to start with a syntax to try.
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Awesome!  It's going to be a few days before I am able to try it, but that looks like exactly what I need.

Thanks!!!

I totally understand that the TABLE would be the "best practice" method.  Problem is it would require a lot more pre-thought (on my part) figuring out which controls needed the feature, AND I would have to show the person translating what the context was of the word(s) being translated, but if they can see the CONTROL itself then all I have to show them is how to modify a property.
There will only bea few forms here and there that need the feature and I won't know which ones until later.

Goofy, I know..... but thanks again.
As always, there is no right or wrong in most cases...

This is why it is always best to know multiple ways of doing the same thing