Hi,
I am adding the functionality of changing interface languages to my application, however, I realized that now it takes 3-4 seconds until the form loads, which is a bit frustrating. This time lag appears already with small forms with few labels and buttons. So obviously I would like to reduce this lag to a minimum.
Do you know a more efficient way to achieve a multilingual solution/another code method? I am using a MySQL database/ODBC connection.
Thanks a lot for advice! FRANK
This is the code in my onLoad-event:
This is the function:
I am adding the functionality of changing interface languages to my application, however, I realized that now it takes 3-4 seconds until the form loads, which is a bit frustrating. This time lag appears already with small forms with few labels and buttons. So obviously I would like to reduce this lag to a minimum.
Do you know a more efficient way to achieve a multilingual solution/another code method? I am using a MySQL database/ODBC connection.
Thanks a lot for advice! FRANK
This is the code in my onLoad-event:
Code:
For Each ctl In Me.Controls
If TypeOf ctl Is Label Then
If ctl.Name <> "" And Not IsNull(ctl.Name) Then
ctl.Caption = LoadString(ctl.Name, Language)
End If
ElseIf TypeOf ctl Is CommandButton Then
If ctl.Name <> "" And Not IsNull(ctl.Name) Then
ctl.Caption = LoadString(ctl.Name, Language)
End If
End If
Next ctl
Code:
Function LoadString(lngNumber, Language) As String
On Error GoTo Ende
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
If Language = "English" Then
ID = 2
ElseIf Language = "German" Then
ID = 9
End If
Set db = CurrentDb
strSQL = "SELECT " & lngNumber & " FROM translations_TM WHERE translations_TM.ID = " & ID & ""
Set rst = db.OpenRecordset(strSQL)
LoadString = rst.Fields(lngNumber)
Ende:
End Function