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
289 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 48

Expert Comment

by:Dale Fye
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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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
 

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

624 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