I would like to change the labels on my input controls programmatically which
I realize I can do with Me.Caption = ...
But I need to change all the labels on a form from one language to another.
I can store all the label texts in a table with a column for the target
language. But I'm not seeing how to load those. If I use a DLookUp (for each
Me.Caption), that's a ton of DLookups for one form and a huge performance hit.
How have others done this?

Signature
sam
tina - 31 Jan 2005 23:19 GMT
you could set up a table with three columns, as
tblLabels
LabelName
Language
CaptionText
set LabelName and Language as a combination primary key. you can store
captions for multiple languages here, and the combo primary key will prevent
entering the same language twice for the same caption. so records in the
table would look like
Label1 English Good morning
Label1 Spanish Buenos dias
Label2 English Good night
Label2 Spanish Buenos noches
then you can loop through a recordset in the form's VBA module to set the
captions, as
Dim rst As DAO.Recordset, strSQL As String
strSQL = "SELECT LabelName, CaptionText FROM tblLabels " _
"WHERE Language = 'Spanish'"
Set rst = CurrentDb.OpenRecordset(strSQL)
rst.MoveFirst
Do
Me(rst("LabelName")).Caption = rst("CaptionText")
rst.MoveNext
Loop Until rst.EOF
rst.Close
Set rst = Nothing
the only thing you need to decide is how to change the language name
specified in the SQL statement's WHERE clause.
hth
> I would like to change the labels on my input controls programmatically which
> I realize I can do with Me.Caption = ...
[quoted text clipped - 5 lines]
>
> How have others done this?
Marshall Barton - 31 Jan 2005 23:57 GMT
>I would like to change the labels on my input controls programmatically which
>I realize I can do with Me.Caption = ...
[quoted text clipped - 5 lines]
>
>How have others done this?
Open a recordset for the language stuff, then loop through
its records setting the captions.

Signature
Marsh
MVP [MS Access]