[AccessD] Find First in an Array?

Max Wanadoo max.wanadoo at gmail.com
Wed Feb 18 18:04:10 CST 2009


Hey Rocky - something lateral again.
If you group select the labels for the controls and copy-paste them then
drag them down clear of the originals for the moment.
Then group select the original labels and set the Tag to "English" - one
entry sets all.
Then group select the copied labels and set the Tag to "German" - again one
entry sets all
Then for each of the German Labels, write the words you want to display in
German.
Then drag the German Group up over the English Group so that they site
exactly on top.
Then group select the data control (ie, the text box) and in the Tag put
"English-German" - this will match any of the languages.
Then in the form.onLoad event put this code

Option Compare Database
Option Explicit
'Const conLanguage = "German"
Const conLanguage = "English" ' these could be a system parameter instead of
a constant = this is only for illustrating.

Private Sub Form_Load()
  Dim ctl As Control
  For Each ctl In Me.Controls
    Debug.Print ctl.Name, ctl.Tag, InStr(ctl.Tag, conLanguage) > 0 - for
testing
    ctl.Visible = InStr(ctl.Tag, conLanguage) > 0
  Next ctl
End Sub

Swapping the conlanguage constant around will display only the labels that
match the language but the data control matches both.

On they form I just knocked up it was instantaneous.

Repeat for Spanish, Canadian, etc.  Lots of Labels (but only 1 set of data
controls) - it is only the lables you need to change, right?

Something different anyway!

Max
Ps. I have never done this before so I do not know if it is robust in a
working environment, but should be.


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at
Beach Access Software
Sent: 18 February 2009 22:57
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Find First in an Array?


Dear List:
 
I have an app set up for multiple languages.  The translations are pulled
from a table at the time the form or report is opened by cycling through the
controls (labels and button captions) and getting the appropriate
translation.  To make the thing run faster (there's a noticeable translation
delay), I'm thinking of loading these translations into an array in memory
and fetching the translation from the array.  However, AFAIK, there's no
equivalent to a FindFirst in an array like there is in a recordset.  So, is
there a better way to find the right translation in the array short of going
through the array in sequence for each item to be translated?
	
	
MTIA for any ideas,
 

Rocky Smolin

Beach Access Software

858-259-4334

www.e-z-mrp.com <http://www.e-z-mrp.com/> 

www.bchacc.com <http://www.bchacc.com/> 

 

 


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list