I got a multilingual database.
The translations are in a tbl TblTranslations
I use a global variable to set the language (gblanguage) on login
I have various reports which include subreports. The labels of the reports require to be displayed in the appropriate language.
I use a query to filter the appropriate language column.
the on format event should display the appropriate labels.
SELECT TblTranslations.UK AS labelname, TblTranslations.LblId, TblTranslations.objectName
FROM TblTranslations
WHERE (((TblTranslations.objectName)=getreportname()))
ORDER BY TblTranslations.LblId;
The problem I have is the code not returning the various label names to loop through and enter the translations in the label captions. I think th eproblem is in the createlabelname but cannot figure out why....
this is the code I've got: can anyone see the problem??
Option Compare Database
Global gblReportname As String
Function getReportname() As String
getReportname = gblReportname
End Function
Sub getLang(strReportname As String)
Dim rs As Recordset, db As DAO.Database, strSQL As String, intLabel As Integer
gblReportname = strReportname
Set db = CurrentDb()
Select Case gbLanguage
Case "english"
strSQL = "qryuk"
Case "sp"
strSQL = "qrysp"
Case "it"
Case Else
MsgBox "unknown"
End Select
Set rs = db.OpenRecordset(strSQL)
With rs
If .EOF = False Then
.MoveFirst
Do Until .EOF
CreateLabelName !labelname = !labelname
'Reports![RptContacts1]![1001].Caption = !labelname
.MoveNext
Loop
End If
End With
End Sub
Function CreateLabelName(intH As String) As Control
Dim strControl As String
strControl = "Reports![" & gblReportname & "]![" & intH & "].Caption"
CreateLabelName = strControl
End Function
The translations are in a tbl TblTranslations
I use a global variable to set the language (gblanguage) on login
I have various reports which include subreports. The labels of the reports require to be displayed in the appropriate language.
I use a query to filter the appropriate language column.
the on format event should display the appropriate labels.
SELECT TblTranslations.UK AS labelname, TblTranslations.LblId, TblTranslations.objectName
FROM TblTranslations
WHERE (((TblTranslations.objectName)=getreportname()))
ORDER BY TblTranslations.LblId;
The problem I have is the code not returning the various label names to loop through and enter the translations in the label captions. I think th eproblem is in the createlabelname but cannot figure out why....
this is the code I've got: can anyone see the problem??
Option Compare Database
Global gblReportname As String
Function getReportname() As String
getReportname = gblReportname
End Function
Sub getLang(strReportname As String)
Dim rs As Recordset, db As DAO.Database, strSQL As String, intLabel As Integer
gblReportname = strReportname
Set db = CurrentDb()
Select Case gbLanguage
Case "english"
strSQL = "qryuk"
Case "sp"
strSQL = "qrysp"
Case "it"
Case Else
MsgBox "unknown"
End Select
Set rs = db.OpenRecordset(strSQL)
With rs
If .EOF = False Then
.MoveFirst
Do Until .EOF
CreateLabelName !labelname = !labelname
'Reports![RptContacts1]![1001].Caption = !labelname
.MoveNext
Loop
End If
End With
End Sub
Function CreateLabelName(intH As String) As Control
Dim strControl As String
strControl = "Reports![" & gblReportname & "]![" & intH & "].Caption"
CreateLabelName = strControl
End Function