Changing the Orientation (1 Viewer)

karramli

New member
Local time
Today, 23:30
Joined
Nov 29, 2007
Messages
5
Hi All,

I am using the following code to change the property of the form and its controls from left to right and vice versa, the problem is with the following

1. the comboboxe do not change its scrollbar from left to right.
2. the form caption still remains to left or the right of the form.
3. the optiongroup do not seem to be affected in any way.
4. finally the code is affecting the menu I am using.

The whole idea is to come up with a bilingual interface as the user may need.

I am looking for productive suggestions to workaround this problem with afinal solution.


This is the code I am using.

'******************************************************************************************
'changes display UI for all controls on a form
'******************************************************************************************
Public Sub LocForm(oFrm As Form)
On Error GoTo PROC_ERR

' oFrm.Orientation = 0
oFrm.Caption = oFrm.Tag

For Each Ctl In oFrm.Controls
' Swithch View
If TypeOf Ctl Is Label _
Or TypeOf Ctl Is TextBox _
Or TypeOf Ctl Is SubForm _
Or TypeOf Ctl Is ComboBox _
Or TypeOf Ctl Is ListBox _
Or TypeOf Ctl Is CommandButton _
Or TypeOf Ctl Is CheckBox _
Or TypeOf Ctl Is Calendar _
Or TypeOf Ctl Is Control _
Or TypeOf Ctl Is Controls _
Or TypeOf Ctl Is OptionButton _
Or TypeOf Ctl Is OptionGroup Then
Ctl.Left = oFrm.Width - (Ctl.Left + Ctl.Width)
End If

' Switch Captions
If TypeOf Ctl Is Label Or TypeOf Ctl Is Page _
Or TypeOf Ctl Is CommandBars Then
Ctl.Caption = Ctl.Tag
End If

' Switch Reading Orders
If TypeOf Ctl Is Label _
Or TypeOf Ctl Is TextBox _
Or TypeOf Ctl Is ComboBox Then
If Ctl.TextAlign = 3 Then Ctl.TextAlign = 1
End If

' Switch Scroll Bar Allign
If TypeOf Ctl Is ComboBox Or TypeOf Ctl Is ListBox Then
Ctl.ScrollBarAlign = 2
End If
Next

Set cbm = CommandBars("mnuForm")
Set cbc = CommandBars("mnuForm").Controls
For Each ctl In cbc
ctl.Caption = ctl.Tag
Next

PROC_EXIT:
Exit Sub

PROC_ERR:
MsgBox Err.Description
Resume PROC_EXIT

End Sub


Thank you & regards,

Khalid Arramli
 

missinglinq

AWF VIP
Local time
Today, 16:30
Joined
Jun 20, 2003
Messages
6,423
Changes to orientation can only be made when the form is opened in Design View, which is where your problem is, I expect. Also, I believe if the Orientation of the form itself is changed, all of these other things are automatically changed by default. Here's a function that could be used to change the orientation of the form(s). The example only shows one form, but you could repeat the code for as many form/reports as need be.

Changes to orientation can only be made when the form is opened in Design View, which is where your problem is, I expect. Also, I believe all of this is a bit of overkill; if the Orientation of the form itself is changed, all of these other things are automatically changed by default.

Here is a function that will do the job, I think. It needs to go in a standard module, though I suppose it could go in the module behind a form being used as a switchboard (haven't tested that.) If placed in a standard module do not name the module ChangeOrientation!!! This will confuse Access!

Code:
Function ChangeOrientation(Orient As String) As Variant

Select Case Orient

  Case "RTL"
   DoCmd.OpenForm "Form1", acDesign
   Forms.Form3.Orientation = 1
   DoCmd.Close acForm, "Form3", acSaveYes
    'Repeat for each form
  Case "LTR"
   DoCmd.OpenForm "Form1", acDesign
   Forms.Form3.Orientation = 0
   DoCmd.Close acForm, "Form1", acSaveYes
    'Repeat for each form
End Select
End Function
To call, you could add this code to buttons:

Code:
Private Sub OrientRTLCommand0_Click()
  ChangeOrientation ("RTL")
End Sub

Private Sub OrientLTR_Click()
  ChangeOrientation ("LTR")
End Sub

Linq
 
Last edited:

karramli

New member
Local time
Today, 23:30
Joined
Nov 29, 2007
Messages
5
Thank you for your reply missinglinq, however, the problem still exists as mde file will not accept the function acDesign in runtime mode.


Thank you & regards,

Khalid Arramli
 

boblarson

Smeghead
Local time
Today, 13:30
Joined
Jan 12, 2001
Messages
32,059
If you are using it with an MDE file, you need to make two copies of the form and have the code choose the correct one. Design changes cannot be done to forms or reports in an MDE file.
 

missinglinq

AWF VIP
Local time
Today, 16:30
Joined
Jun 20, 2003
Messages
6,423
Bob's correct, of course, and it would be a good idea, when posting a question, to let people know if an MDE file is involved!
 

karramli

New member
Local time
Today, 23:30
Joined
Nov 29, 2007
Messages
5
Thank you again missingliq & Bob for your comments, the idea was to setup billingual shelf product applications that uses access mde files as front end for the local market.

After reading a number of articles along with your comments I understand now that the best way to change the orientation of the forms & menus is by switching access itself from the (microsoft office tools/language settings) should office be installed on the machine !!.

I still believe it is possible to manipulate the other controls on the form (combobox, optiongroup and listbox) which I am working on right now.

As soon as I come up with the best solution I'll share it with you all.


Thank you & regards,

Khalid Arramli
 

Users who are viewing this thread

Top Bottom