Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 10th, 2005, 09:43 AM
Authorized User
 
Join Date: Dec 2003
Location: Brussels, , Belgium.
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multilingual database

Hello all,
It has been a while... So I wish you a happy new year 2005.
So, here is my question:
I am currently developping a database for French/Dutch speaker and I wanted the user to be able to select his preferd language upon startup, so that all label on forms will be translated.
Could you help me on this one?
Thanks,
Sven
Reply With Quote
  #2 (permalink)  
Old January 10th, 2005, 01:53 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Oxford, , United Kingdom.
Posts: 120
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here's what I'm using in a similar situation.

I have tables, structured as follows:

Code:
tblForm
fldFormUID
fldFormName

tblFormControl
fldFormControlUID
fldFormUID
fldControlName

tblLanguage
fldLanguageUID
fldLanguage

tblRegional
fldRegionalUID
fldLanguageUID
fldFormControlUID
fldProperty
fldValue
tblForm is populated with the names of all the forms in the database, tblFormControl with the names of all the controls on those forms. tblRegional contains the different values for the control properties, dependent on the value of fldLanguageUID. fldProperty contains the name of the control property you wish to change (e.g the caption) and fldValue holds the new value.

I also have class module which is fired up when the database opens and keeps running until the user closes the database. This module contains the following sub:

Code:
Public Sub SetRegionalFilter(frmToSet As Form, lngLanguageUID As Long)
' Comments  :
' Parameters: frmToSet -
' Modified  :
'
' --------------------------------------------------
'TVCodeTools ErrorEnablerStart
On Error GoTo PROC_ERR
'TVCodeTools ErrorEnablerEnd
Dim ctlToChange As Control
Dim strSetting As String
Dim rstRegionalControls As ADODB.Recordset

        'I'm running an SP on SQL Server - you'll have to write
        'your own query to retrieve the relevant records
        Set rstRegionalControls = GetRecords("spGetRegional", _
        "@intLanguageUID", adInteger, lngLanguageUID, 4, _
        "@vcharFormName", adVarChar, frmToSet.Name, 50)

        If Not (rstRegionalControls.BOF And rstRegionalControls.EOF) Then
            Do While Not rstRegionalControls.EOF
                If Nz(rstRegionalControls.Fields("fldControlName"), "") <> "" Then
                    Set ctlToChange = frmToSet.Controls(rstRegionalControls.Fields("fldControlName"))
                End If

                strSetting = rstRegionalControls.Fields("fldValue")
                If strSetting = "NULL" Then
                    strSetting = ""
                End If

                Select Case rstRegionalControls.Fields("fldProperty")
                Case "Caption"
                    If Nz(rstRegionalControls.Fields("fldControlName"), "") <> "" Then
                        ctlToChange.Caption = strSetting
                    Else
                        frmToSet.Caption = strSetting
                    End If
                Case "ControlTipText"
                    ctlToChange.ControlTipText = strSetting
                Case "FormProperty"
                    frmToSet.Properties(Left$(strSetting, InStr(1, strSetting, ";") - 1)) = Right$(strSetting, InStr(1, strSetting, ";") + 1)
                Case "StatusBarText"
                    ctlToChange.StatusBarText = strSetting
                Case "HyperLink"
                    ctlToChange.Hyperlink = strSetting
                Case "MenuBar"
                    frmToSet.MenuBar = strSetting
                Case "ToolBar"
                    frmToSet.Toolbar = strSetting
                Case "ShortcutMenuBar"
                    If Nz(rstRegionalControls.Fields("fldControlName"), "") <> "" Then
                        ctlToChange.ShortcutMenuBar = strSetting
                    Else
                        frmToSet.ShortcutMenuBar = strSetting
                    End If
                Case "HelpFile"
                    frmToSet.HelpFile = strSetting
                Case "Value"
                    ctlToChange.Value = strSetting
                End Select

                rstRegionalControls.MoveNext
            Loop
        End If

    'TVCodeTools ErrorHandlerStart
PROC_EXIT:
    On Error Resume Next
    Set rstRegionalControls = Nothing
    rstRegionalControls.Close
    Exit Sub

PROC_ERR:
    If Err.Number = 2465 Then
        Resume Next
    Else
        MsgBox Err.Description & " " & "clsFormSecurity" & ":" & "SetRegionalFilter"
    End If
    Resume PROC_EXIT
    'TVCodeTools ErrorHandlerEnd

End Sub
Whenever I open a form I pass it to the sub and everything gets updated!


Brian Skelton
Braxis Computer Services Ltd.
Reply With Quote
  #3 (permalink)  
Old January 10th, 2005, 03:44 PM
Authorized User
 
Join Date: Dec 2003
Location: Brussels, , Belgium.
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Braxis,
Thanks a lot for your quick answer...
As I can see, you are a talented programmer... but the problem is that I am not that advanced!
I have created the table as you recommended them and typed in the code in VBA.
Despite, I am stuck for when I start the sub, the computer blocks on the GetRecords() as it seems not to recognize it.
Is this another sub/class?
I have tried on a single form based on a table that looks like that:

fldPersonID_PK
fldFirstName
fldLastName
fldDateOfBirth

and I just wish to change the Caption property.
Could you help me out again?
Thanks in advance
Sven
Reply With Quote
  #4 (permalink)  
Old January 10th, 2005, 10:49 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Oxford, , United Kingdom.
Posts: 120
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sven

If you send me an email (brian.skelton at braxis.info) I'll send you an example database that'll let you see how it all works.


Brian Skelton
Braxis Computer Services Ltd.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multilingual Database Objects Muhammad Zeeshan SQL Server 2000 1 August 13th, 2007 02:56 AM
Multilingual Tables Muhammad Zeeshan SQL Language 0 August 13th, 2007 12:04 AM
Problem inserting multilingual text into database salim C# 0 May 5th, 2007 11:11 AM
multilingual support mikedeepak Classic ASP Professional 0 July 11th, 2006 01:42 AM
Multilingual and XML sanilkumar XML 1 June 15th, 2003 10:58 AM



All times are GMT -4. The time now is 03:24 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.