Solved

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

Posted on 2011-09-06
8
243 Views
Last Modified: 2012-06-27
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?
0
Comment
Question by:TechGuise9
  • 4
  • 3
8 Comments
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 36489269
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.

0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36489407
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
0
 

Author Comment

by:TechGuise9
ID: 36523578
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
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36524325
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...
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:TechGuise9
ID: 36525010
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.
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 36525496
This is why things like this are so tricky.

The issue with your approach is that the English/Spanish must be hard coded into each control...
This means that you will have to edit each control individually.

If it were me, I would store each control's English and Spanish value in a table.
Then based on the English/Spanish variable, ...set the appropriate text.
The advantage here would be that you could edit the text in one central location (the table), instead of each control individually.
The only drawback would be creating and maintaining the table...

But perhaps this is a: "Six of one, half dozen of another" scenario...

In any event...
To do it your way you would insert a comma between the two words without a space
"Hello,Hola"

Then this would get you the English:
=Left([Text0],InStr([Text0],",")-1)

...and this would give you the Spanish:
=Right([Text0],Len([Text0])-InStr([Text0],","))
0
 

Author Closing Comment

by:TechGuise9
ID: 36525687
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.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36525849
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
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now