|
[Quoted Text] > Me.Caption = GetPhrase(FORM1_CAPTION)
"FORM1_CAPTION" is a value in the PhraseName field in tblPhrases, correct? if the answer is "yes", then your first problem is that you can't pass a string value into a procedure when the argument is a number data type.
for the moment, let's just stick with the PhraseName value, and work with that. you can open a recordset to get the value you need, using the "global language selection" which i'll assume is a public variable, and the PhraseName value provided in the function call. something along the lines of
Public Function GetPhrase(ByVal strPhraseName As String) As String
' for this example, i'll use "intLanguage" as the name of the public variable
Dim rst As DAO.Recordset, strSQL As String
strSQL = "SELECT Phrase " _ & "FROM tblPhrases INNER JOIN tblPhrasesInLanguages " _ & "ON tblPhrases.PhraseID = tblPhrasesInLanguages.PhraseID " _ & "WHERE PhraseName = '" & strPhraseName _ & "' AND LanguageID = " & intLanguage
Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
GetPhrase = Nz(rst("Phrase"), "")
rst.Close Set rst = Nothing
End Function
hth
"Frank Situmorang" <hfsitumo2001[ at ]yahoo.com> wrote in message news:81757020-780C-401E-A84D-0433496F9F15[ at ]microsoft.com... > Hello, > > I started to make tables as follows, but I want to know how can we make > query to pull the selected language: > > tblLanguages > LanguageID > LanguageName > > tblPhrases > PhraseID > PhraseName > > tblPhrasesInLanguages > PhraseID > LanguageID > Phrase > > Then you can write a simple query that can pull the correct phrase > based on the chosen language, and (for example) set the form title in > the form's Load event: > Me.Caption = GetPhrase(FORM1_CAPTION) > > public function GetPhrase(byval intPhraseID as Integer) as String > 'TODO: select the data, based on given PhraseID and global language > selection > GetPhraseID = strPhrase > end function > > > Anyone can help me to make it work? > > > Thanks in advance > -- > H. Frank Situmorang
|