Nas minhas bases de dados em que dou suporte a mais que uma lingua, costumo correr uma "Função" que nada retorna neste caso mas que te pode ajudar. o que faço é carregar de uma tabela Access onde incluo o NOME DO FORM, O NOME DO CONTROLO e a LINGUA e comparo o Nome do controlo fazendo no form passado na função igual ao valor da tabela, aqui fica a ideia.
Option Compare Database
Public Function yTranslaction(ByVal strFORM As String, _
ByVal frmFORM As Form)
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strSQL As String
Dim ctlCONTROL As Control
On Error GoTo erro
strLanguage = “pt-PT”
strSQL = “SELECT * FROM y_TRANSLACTIONS ” & _
“WHERE LANGUAGE =’” & strLanguage & “‘” & ” AND FORM=’” & strFORM & “‘”
cnn.ConnectionString = CurrentProject.Connection
cnn.Open
rs.Open strSQL, cnn, adOpenKeyset, adLockOptimistic
Set frmFORM = Forms(strFORM)
With rs
Debug.Print .RecordCount
Do Until rs.EOF = True
For Each ctlCONTROL In frmFORM.Controls
If TypeOf ctlCONTROL Is Label Then
If ctlCONTROL.Name = rs.Fields(”CONTROL”).Value Then
ctlCONTROL.Caption = rs.Fields(”CAPTION”).Value
End If
End If
If TypeOf ctlCONTROL Is CommandButton Then
If ctlCONTROL.Name = rs.Fields(”CONTROL”).Value Then
ctlCONTROL.Caption = rs.Fields(”CAPTION”).Value
End If
End If
Next
.MoveNext
Loop
End With
cnn.Close
Set rs = Nothing
Exit Function
erro:
MsgBox Err.Number & ” - ” & Err.Description, vbOKOnly + vbExclamation, “Erro na Rotina”
End Function
Sem comentários:
Enviar um comentário