Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / January 2005

Tip: Looking for answers? Try searching our database.

label strategy question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
smk23 - 31 Jan 2005 20:21 GMT
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]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.