VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.UserControl Comp_DB 
   ClientHeight    =   10395
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   15090
   ScaleHeight     =   10395
   ScaleWidth      =   15090
   Begin VB.Frame fra_Disclaimer 
      Height          =   1935
      Left            =   2640
      TabIndex        =   564
      Tag             =   "CD_Disclaimer"
      Top             =   7560
      Visible         =   0   'False
      Width           =   2175
      Begin VB.CommandButton cmd_DisclaimerNo 
         Caption         =   "#No"
         Height          =   615
         Left            =   6600
         TabIndex        =   567
         Tag             =   "cmd_DislcaimerNo"
         Top             =   6960
         Width           =   1695
      End
      Begin VB.CommandButton cmd_DisclaimerYes 
         Caption         =   "#Yes"
         Height          =   615
         Left            =   3960
         TabIndex        =   566
         Tag             =   "cmd_DislcaimerYes"
         Top             =   6960
         Width           =   1815
      End
      Begin VB.TextBox txt_Disclaimer 
         BackColor       =   &H80000018&
         Height          =   6375
         Left            =   120
         Locked          =   -1  'True
         MultiLine       =   -1  'True
         ScrollBars      =   3  'Both
         TabIndex        =   565
         Tag             =   "lbl_Disclaimer"
         Text            =   "Comp_DB.ctx":0000
         Top             =   360
         Width           =   12015
      End
   End
   Begin VB.Frame fra_list 
      Caption         =   "List"
      Height          =   7410
      Left            =   360
      TabIndex        =   119
      Top             =   8160
      Visible         =   0   'False
      Width           =   8385
      Begin Project1.ToolbarControl tlb_list 
         Height          =   690
         Left            =   135
         TabIndex        =   122
         Top             =   270
         Width           =   10665
         _ExtentX        =   18812
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_list 
         Height          =   8625
         Left            =   270
         TabIndex        =   125
         Tag             =   "grd_list"
         Top             =   990
         Width           =   10080
         _ExtentX        =   17780
         _ExtentY        =   15214
      End
   End
   Begin VB.Frame fra_filter 
      Caption         =   "Filter"
      Height          =   10335
      Left            =   0
      TabIndex        =   115
      Tag             =   "CD_FILTER"
      Top             =   0
      Visible         =   0   'False
      Width           =   3975
      Begin VB.CommandButton cmd_TVReLoad 
         Height          =   735
         Left            =   120
         Style           =   1  'Graphical
         TabIndex        =   145
         Tag             =   "cmd_TVReLoad"
         Top             =   3720
         Width           =   735
      End
      Begin VB.Frame fra_CompetitorType 
         Caption         =   "#Type"
         Height          =   735
         Left            =   120
         TabIndex        =   141
         Tag             =   "fraType"
         Top             =   240
         Width           =   3735
         Begin VB.OptionButton Opt_FiltersType 
            Caption         =   "#Strategic"
            Height          =   255
            Index           =   1
            Left            =   1800
            TabIndex        =   143
            Tag             =   "optFiltersType_Country"
            Top             =   240
            Width           =   1575
         End
         Begin VB.OptionButton Opt_FiltersType 
            Caption         =   "#Country"
            Height          =   255
            Index           =   0
            Left            =   120
            TabIndex        =   142
            Tag             =   "optFiltersType_Country"
            Top             =   240
            Width           =   1575
         End
      End
      Begin VB.Frame fraFiltersDate 
         Caption         =   "#Date range"
         Height          =   735
         Left            =   120
         TabIndex        =   133
         Tag             =   "fraFiltersDate"
         Top             =   960
         Width           =   3735
         Begin VB.OptionButton opt_FiltersDate 
            Caption         =   "#Between"
            Height          =   375
            Index           =   1
            Left            =   1800
            TabIndex        =   135
            Tag             =   "optFiltersDate_Between"
            Top             =   240
            Width           =   1455
         End
         Begin VB.OptionButton opt_FiltersDate 
            Caption         =   "#All"
            Height          =   375
            Index           =   0
            Left            =   120
            TabIndex        =   134
            Tag             =   "optFiltersDate_All"
            Top             =   240
            Value           =   -1  'True
            Width           =   1455
         End
      End
      Begin Project1.ArmTreeView tv_filter 
         Height          =   4935
         Left            =   120
         TabIndex        =   128
         Top             =   3720
         Width           =   3735
         _ExtentX        =   6588
         _ExtentY        =   8705
      End
      Begin Project1.A_calocx cal_filtersMax 
         Height          =   375
         Left            =   2040
         TabIndex        =   136
         Top             =   2280
         Width           =   1815
         _ExtentX        =   3201
         _ExtentY        =   661
      End
      Begin Project1.A_calocx cal_FiltersMin 
         Height          =   375
         Left            =   120
         TabIndex        =   137
         Top             =   2280
         Width           =   1815
         _ExtentX        =   3201
         _ExtentY        =   661
      End
      Begin Project1.ArmCombobox cbo_FiltersDate 
         Height          =   345
         Left            =   120
         TabIndex        =   138
         Top             =   1800
         Width           =   3735
         _ExtentX        =   6588
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_Views 
         Height          =   345
         Left            =   120
         TabIndex        =   139
         Top             =   3120
         Width           =   3735
         _ExtentX        =   6588
         _ExtentY        =   609
      End
      Begin VB.Label lbl_Views 
         Caption         =   "#Views"
         Height          =   255
         Left            =   120
         TabIndex        =   140
         Tag             =   "lbl_Views"
         Top             =   2880
         Width           =   2055
      End
   End
   Begin VB.Frame fra_item 
      Caption         =   "Item"
      Height          =   10380
      Left            =   1800
      TabIndex        =   121
      Tag             =   "CD_Item"
      Top             =   30
      Visible         =   0   'False
      Width           =   11685
      Begin VB.Frame fra_record 
         Caption         =   "SalesEst"
         Height          =   705
         Index           =   4
         Left            =   7740
         TabIndex        =   229
         Tag             =   "CD_SalesEst"
         Top             =   4890
         Visible         =   0   'False
         Width           =   1665
         Begin VB.TextBox txt_SalesEst_Comment 
            Height          =   6195
            Left            =   120
            MaxLength       =   4000
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   114
            Tag             =   "SE_Comment®©Text"
            Text            =   "Comp_DB.ctx":0141
            Top             =   2715
            Width           =   9795
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   12
            Left            =   6720
            TabIndex        =   230
            Tag             =   "Spare1_varchar®©Text"
            Text            =   "Text1"
            Top             =   1170
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   13
            Left            =   6705
            TabIndex        =   231
            Tag             =   "Spare2_varchar®©Text"
            Text            =   "Text1"
            Top             =   1935
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   14
            Left            =   6705
            TabIndex        =   232
            Tag             =   "Spare3_real®©Num®©0"
            Text            =   "Text1"
            Top             =   2700
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   375
            Index           =   15
            Left            =   6660
            TabIndex        =   233
            Tag             =   "Spare4_real®©Num®©0"
            Text            =   "Text1"
            Top             =   3510
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_SalesEst_Source 
            Height          =   345
            Left            =   1125
            MaxLength       =   75
            TabIndex        =   113
            Tag             =   "SE_source®©Text"
            Text            =   "Text1"
            Top             =   1965
            Width           =   8670
         End
         Begin VB.TextBox txt_key 
            Height          =   375
            Index           =   4
            Left            =   8190
            TabIndex        =   243
            Tag             =   "MKT_Sales_est_Key®©Num®©0"
            Text            =   "Text1"
            Top             =   405
            Visible         =   0   'False
            Width           =   1635
         End
         Begin VB.Frame fra_ModifInfo 
            BorderStyle     =   0  'None
            Height          =   510
            Index           =   4
            Left            =   90
            TabIndex        =   234
            Top             =   9045
            Width           =   9870
            Begin VB.TextBox txt_UpdUser 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   4
               Left            =   7830
               Locked          =   -1  'True
               TabIndex        =   238
               Tag             =   "U_login_lastupd®©Text"
               Text            =   "Text1"
               Top             =   135
               Width           =   1995
            End
            Begin VB.TextBox txt_LastUpdDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   345
               Index           =   4
               Left            =   6120
               Locked          =   -1  'True
               TabIndex        =   237
               Tag             =   "Z_last_upd®©Text"
               Text            =   "Text1"
               Top             =   120
               Width           =   1095
            End
            Begin VB.TextBox txt_Creator 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   345
               Index           =   4
               Left            =   2880
               Locked          =   -1  'True
               TabIndex        =   236
               Tag             =   "U_login_creator®©Text"
               Text            =   "Text1"
               Top             =   120
               Width           =   1905
            End
            Begin VB.TextBox txt_CreationDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   345
               Index           =   4
               Left            =   1260
               Locked          =   -1  'True
               TabIndex        =   235
               Tag             =   "Z_creation®©Text"
               Text            =   "Text1"
               Top             =   120
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Date Entered"
               Height          =   240
               Index           =   100
               Left            =   90
               TabIndex        =   242
               Tag             =   "lbl_CreationDate"
               Top             =   195
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   101
               Left            =   2490
               TabIndex        =   241
               Tag             =   "lbl_CreatorBy"
               Top             =   195
               Width           =   330
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Last Updated"
               Height          =   240
               Index           =   102
               Left            =   4860
               TabIndex        =   240
               Tag             =   "lbl_LastUpdateDate"
               Top             =   195
               Width           =   1185
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   103
               Left            =   7350
               TabIndex        =   239
               Tag             =   "lbl_UpdUserBy"
               Top             =   195
               Width           =   375
            End
         End
         Begin VB.TextBox txt_SalesEst_Quantity 
            Alignment       =   1  'Right Justify
            Height          =   345
            Left            =   1110
            MaxLength       =   11
            TabIndex        =   109
            Tag             =   "SE_Volume®©Num®©0"
            Text            =   "999,999,999"
            Top             =   990
            Width           =   1335
         End
         Begin VB.TextBox txt_SalesEst_Value 
            Alignment       =   1  'Right Justify
            Height          =   345
            Left            =   1110
            MaxLength       =   13
            TabIndex        =   111
            Tag             =   "SE_Value®©Num®©0"
            Text            =   "9,999,999,999"
            Top             =   1455
            Width           =   1335
         End
         Begin Project1.ArmCombobox cbo_SalesEst_Year 
            Height          =   345
            Left            =   120
            TabIndex        =   106
            Tag             =   "Sales_Est_Year"
            Top             =   510
            Width           =   1065
            _ExtentX        =   1879
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_SalesEst_Category 
            Height          =   345
            Left            =   2160
            TabIndex        =   107
            Tag             =   "SC_Code"
            Top             =   510
            Width           =   3435
            _ExtentX        =   6059
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_SalesEst_Material 
            Height          =   345
            Left            =   6450
            TabIndex        =   108
            Tag             =   "BM_Code"
            Top             =   510
            Width           =   3435
            _ExtentX        =   6059
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_SalesEst_Unit_of_Measure 
            Height          =   345
            Left            =   3105
            TabIndex        =   110
            Tag             =   "UM_Code"
            Top             =   990
            Width           =   2730
            _ExtentX        =   4815
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_SalesEst_Currency 
            Height          =   345
            Left            =   3105
            TabIndex        =   112
            Tag             =   "CURR_Code"
            Top             =   1485
            Width           =   2730
            _ExtentX        =   4815
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Currency"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   59
            Left            =   3120
            TabIndex        =   562
            Tag             =   "lbl_Currency"
            Top             =   1260
            Visible         =   0   'False
            Width           =   2700
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Unit of Measure"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   58
            Left            =   3090
            TabIndex        =   561
            Tag             =   "lbl_UnitofMeasure"
            Top             =   780
            Visible         =   0   'False
            Width           =   2730
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Value"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   117
            Left            =   135
            TabIndex        =   555
            Tag             =   "lbl_Value"
            Top             =   1530
            Width           =   840
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Quantity"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   116
            Left            =   90
            TabIndex        =   554
            Tag             =   "lbl_Quantity"
            Top             =   1035
            Width           =   930
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Source"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   115
            Left            =   150
            TabIndex        =   245
            Tag             =   "lbl_Source"
            Top             =   2025
            Width           =   855
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare4_real"
            Height          =   285
            Index           =   104
            Left            =   6660
            TabIndex        =   254
            Tag             =   "lbl_Spare4"
            Top             =   3285
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare3_real"
            Height          =   285
            Index           =   105
            Left            =   6705
            TabIndex        =   253
            Tag             =   "lbl_Spare3"
            Top             =   2475
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare2_varchar"
            Height          =   285
            Index           =   106
            Left            =   6705
            TabIndex        =   252
            Tag             =   "lbl_Spare2"
            Top             =   1710
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare1_varchar"
            Height          =   285
            Index           =   107
            Left            =   6660
            TabIndex        =   251
            Tag             =   "lbl_Spare1"
            Top             =   900
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Year"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   108
            Left            =   120
            TabIndex        =   250
            Tag             =   "lbl_Year"
            Top             =   270
            Width           =   1755
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Category"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   109
            Left            =   2160
            TabIndex        =   249
            Tag             =   "lbl_Category"
            Top             =   270
            Width           =   3405
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#in"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   111
            Left            =   2460
            TabIndex        =   248
            Tag             =   "lbl_InUnitOfMeasure"
            Top             =   1050
            Width           =   570
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#in"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   112
            Left            =   2565
            TabIndex        =   247
            Tag             =   "lbl_InCurrency"
            Top             =   1530
            Width           =   480
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Comment"
            Height          =   240
            Index           =   113
            Left            =   120
            TabIndex        =   246
            Tag             =   "lbl_Comment"
            Top             =   2445
            Width           =   1005
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Material"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   110
            Left            =   6450
            TabIndex        =   244
            Tag             =   "lbl_Material"
            Top             =   270
            Width           =   3435
         End
      End
      Begin VB.Frame fra_record 
         Caption         =   "Attachment detail"
         Height          =   1155
         Index           =   50
         Left            =   5940
         TabIndex        =   255
         Tag             =   "CD_Attachment"
         Top             =   1710
         Visible         =   0   'False
         Width           =   2400
         Begin VB.TextBox txt_Attachment_IDblob 
            Height          =   375
            Left            =   8280
            TabIndex        =   577
            Tag             =   "ID_Blob®©Num®©0"
            Top             =   810
            Visible         =   0   'False
            Width           =   1635
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   52
            Left            =   4965
            TabIndex        =   275
            Tag             =   "Spare1_varchar®©Text"
            Top             =   2625
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   53
            Left            =   4965
            TabIndex        =   274
            Tag             =   "Spare2_varchar®©Text"
            Top             =   3435
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   54
            Left            =   4965
            TabIndex        =   273
            Tag             =   "Spare3_real®©Num®©0"
            Top             =   4200
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   55
            Left            =   4920
            TabIndex        =   272
            Tag             =   "Spare4_real®©Num®©0"
            Top             =   5010
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_key 
            Height          =   375
            Index           =   50
            Left            =   8280
            TabIndex        =   271
            Tag             =   "ATT_Key®©Num®©0"
            Top             =   360
            Visible         =   0   'False
            Width           =   1635
         End
         Begin VB.TextBox txt_Attachment_Source 
            Height          =   312
            Left            =   2640
            MaxLength       =   75
            TabIndex        =   12
            Tag             =   "ATT_Source®©Text"
            Top             =   1800
            Width           =   5415
         End
         Begin VB.TextBox txt_Attachment_Title 
            Height          =   312
            Left            =   2640
            MaxLength       =   75
            TabIndex        =   9
            Tag             =   "ATT_Title®©Text"
            Top             =   360
            Width           =   5415
         End
         Begin VB.Frame fra_ModifInfo 
            Caption         =   "Frame1"
            Height          =   375
            Index           =   50
            Left            =   90
            TabIndex        =   262
            Top             =   9180
            Width           =   9870
            Begin VB.TextBox txt_CreationDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   50
               Left            =   1170
               Locked          =   -1  'True
               TabIndex        =   266
               Tag             =   "Z_creation®©Text"
               Top             =   0
               Width           =   1095
            End
            Begin VB.TextBox txt_Creator 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   50
               Left            =   2835
               Locked          =   -1  'True
               TabIndex        =   265
               Tag             =   "U_login_creator®©Text"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_LastUpdDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   50
               Left            =   6120
               Locked          =   -1  'True
               TabIndex        =   264
               Tag             =   "Z_last_upd®©Text"
               Top             =   0
               Width           =   1095
            End
            Begin VB.TextBox txt_UpdUser 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   50
               Left            =   7800
               Locked          =   -1  'True
               TabIndex        =   263
               Tag             =   "U_login_lastupd®©Text"
               Top             =   0
               Width           =   1995
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   208
               Left            =   7380
               TabIndex        =   270
               Tag             =   "lbl_UpdUserBy"
               Top             =   45
               Width           =   375
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Last Updated"
               Height          =   240
               Index           =   207
               Left            =   4860
               TabIndex        =   269
               Tag             =   "lbl_LastUpdateDate"
               Top             =   45
               Width           =   1185
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   206
               Left            =   2430
               TabIndex        =   268
               Tag             =   "lbl_CreatorBy"
               Top             =   45
               Width           =   330
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Date Entered"
               Height          =   240
               Index           =   205
               Left            =   0
               TabIndex        =   267
               Tag             =   "lbl_CreationDate"
               Top             =   45
               Width           =   1095
            End
         End
         Begin Project1.ArmCombobox cbo_Attachment_DocLanguage 
            Height          =   345
            Left            =   2640
            TabIndex        =   11
            Tag             =   "ATT_Language_Code"
            Top             =   1320
            Width           =   5415
            _ExtentX        =   9551
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Attachment_Type 
            Height          =   345
            Left            =   2655
            TabIndex        =   10
            Tag             =   "ATT_Type_Code"
            Top             =   855
            Width           =   5415
            _ExtentX        =   9551
            _ExtentY        =   609
         End
         Begin VB.Frame fra_FileSelector 
            Height          =   4215
            Left            =   135
            TabIndex        =   256
            Top             =   2295
            Width           =   9855
            Begin VB.TextBox txt_Attachment_File 
               Height          =   312
               Left            =   2400
               Locked          =   -1  'True
               TabIndex        =   257
               Tag             =   "N/A®©Text"
               Top             =   3780
               Width           =   7245
            End
            Begin VB.DriveListBox drv_Full 
               Height          =   315
               Left            =   120
               TabIndex        =   260
               Top             =   240
               Width           =   4695
            End
            Begin VB.DirListBox dir_Full 
               Height          =   3015
               Left            =   120
               TabIndex        =   259
               Top             =   600
               Width           =   4695
            End
            Begin VB.FileListBox fil_Full 
               Height          =   3405
               Left            =   4860
               TabIndex        =   258
               Top             =   225
               Width           =   4815
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Current attachment"
               BeginProperty Font 
                  Name            =   "MS Sans Serif"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   700
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Height          =   195
               Index           =   456
               Left            =   240
               TabIndex        =   261
               Tag             =   "lbl_DocFile"
               Top             =   3840
               Width           =   2115
            End
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare4_real"
            Height          =   285
            Index           =   464
            Left            =   4920
            TabIndex        =   283
            Tag             =   "lbl_Spare4"
            Top             =   4785
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare3_real"
            Height          =   285
            Index           =   463
            Left            =   4965
            TabIndex        =   282
            Tag             =   "lbl_Spare3"
            Top             =   3975
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare2_varchar"
            Height          =   285
            Index           =   462
            Left            =   4965
            TabIndex        =   281
            Tag             =   "lbl_Spare2"
            Top             =   3210
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare1_varchar"
            Height          =   285
            Index           =   461
            Left            =   4920
            TabIndex        =   280
            Tag             =   "lbl_Spare1"
            Top             =   2400
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Source"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   455
            Left            =   240
            TabIndex        =   279
            Tag             =   "lbl_DocSource"
            Top             =   1830
            Width           =   2295
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Title"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   451
            Left            =   240
            TabIndex        =   278
            Tag             =   "lbl_DocTitle"
            Top             =   390
            Width           =   2295
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Attachment Type"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   452
            Left            =   270
            TabIndex        =   277
            Tag             =   "lbl_AttType"
            Top             =   915
            Width           =   2295
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Document language"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   453
            Left            =   240
            TabIndex        =   276
            Tag             =   "lbl_DocLanguage"
            Top             =   1350
            Width           =   2295
         End
      End
      Begin VB.Frame fra_record 
         Caption         =   "SalesOrg"
         Height          =   795
         Index           =   1
         Left            =   390
         TabIndex        =   149
         Tag             =   "CD_SalesOrg"
         Top             =   780
         Visible         =   0   'False
         Width           =   1500
         Begin VB.Frame Fra_SalesReps 
            Height          =   2535
            Left            =   225
            TabIndex        =   158
            Tag             =   "CD_SalesReps"
            Top             =   3960
            Width           =   9735
            Begin Project1.ToolbarControl tlb_SalesReps 
               Height          =   2355
               Left            =   9000
               TabIndex        =   194
               Top             =   135
               Width           =   690
               _ExtentX        =   1217
               _ExtentY        =   4154
            End
            Begin Project1.ArmGrid grd_SalesOrg_SalesReps 
               Height          =   1995
               Left            =   90
               TabIndex        =   159
               Tag             =   "Rep Detail"
               Top             =   420
               Width           =   8835
               _ExtentX        =   15584
               _ExtentY        =   3519
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Sales Reps"
               Height          =   195
               Index           =   10
               Left            =   135
               TabIndex        =   162
               Tag             =   "lbl_SalesReps"
               Top             =   180
               Width           =   8610
            End
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   4
            Left            =   225
            TabIndex        =   199
            Tag             =   "Spare1_varchar®©Text"
            Text            =   "Text1"
            Top             =   7155
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   5
            Left            =   3645
            TabIndex        =   198
            Tag             =   "Spare2_varchar®©Text"
            Text            =   "Text1"
            Top             =   7155
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   6
            Left            =   225
            TabIndex        =   197
            Tag             =   "Spare3_real®©Num®©0"
            Text            =   "Text1"
            Top             =   7875
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   7
            Left            =   3645
            TabIndex        =   196
            Tag             =   "Spare4_real®©Num®©0"
            Text            =   "Text1"
            Top             =   7920
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_key 
            Height          =   375
            Index           =   1
            Left            =   8280
            TabIndex        =   195
            Tag             =   "MKT_SO_Key®©Num®©0"
            Text            =   "Text1"
            Top             =   540
            Visible         =   0   'False
            Width           =   1635
         End
         Begin VB.TextBox txt_SalesOrg_source 
            Height          =   330
            Left            =   1035
            MaxLength       =   75
            TabIndex        =   44
            Tag             =   "SO_Struc_Source®©Text"
            Text            =   "Text"
            Top             =   3555
            Width           =   8925
         End
         Begin VB.Frame fra_ModifInfo 
            BorderStyle     =   0  'None
            Caption         =   "Frame1"
            Height          =   375
            Index           =   1
            Left            =   90
            TabIndex        =   183
            Top             =   9135
            Width           =   9870
            Begin VB.TextBox txt_UpdUser 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   1
               Left            =   7830
               Locked          =   -1  'True
               TabIndex        =   187
               Tag             =   "U_login_lastupd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_LastUpdDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   1
               Left            =   6120
               Locked          =   -1  'True
               TabIndex        =   186
               Tag             =   "Z_last_upd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.TextBox txt_Creator 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   1
               Left            =   2835
               Locked          =   -1  'True
               TabIndex        =   185
               Tag             =   "U_login_creator®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_CreationDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   1
               Left            =   1170
               Locked          =   -1  'True
               TabIndex        =   184
               Tag             =   "Z_creation®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Date Entered"
               Height          =   240
               Index           =   457
               Left            =   0
               TabIndex        =   191
               Tag             =   "lbl_CreationDate"
               Top             =   45
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   458
               Left            =   2430
               TabIndex        =   190
               Tag             =   "lbl_CreatorBy"
               Top             =   45
               Width           =   330
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Last Updated"
               Height          =   240
               Index           =   459
               Left            =   4860
               TabIndex        =   189
               Tag             =   "lbl_LastUpdateDate"
               Top             =   45
               Width           =   1185
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   460
               Left            =   7380
               TabIndex        =   188
               Tag             =   "lbl_UpdUserBy"
               Top             =   45
               Width           =   375
            End
         End
         Begin VB.TextBox txt_SalesOrg_Comments 
            Height          =   1005
            Left            =   225
            MaxLength       =   4500
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   43
            Tag             =   "SO_Struc_Comments®©Text"
            Text            =   "Comp_DB.ctx":0147
            Top             =   2430
            Width           =   9720
         End
         Begin VB.TextBox txt_SalesOrg_NbofReps 
            Alignment       =   1  'Right Justify
            Height          =   330
            Left            =   2595
            MaxLength       =   5
            TabIndex        =   40
            Tag             =   "SO_Rep_Number®©Num®©0"
            Text            =   "9,999"
            Top             =   1725
            Width           =   1395
         End
         Begin VB.TextBox txt_SalesOrg_NbofManagers 
            Alignment       =   1  'Right Justify
            Height          =   330
            Left            =   2595
            MaxLength       =   3
            TabIndex        =   39
            Tag             =   "SO_Man_Number®©Num®©0"
            Text            =   "999"
            Top             =   1215
            Width           =   1395
         End
         Begin VB.TextBox txt_SalesOrg_OfficeLocations 
            Height          =   1185
            Left            =   4680
            MaxLength       =   2500
            MultiLine       =   -1  'True
            TabIndex        =   42
            Tag             =   "SO_Location®©Text"
            Text            =   "Comp_DB.ctx":014D
            Top             =   915
            Width           =   5235
         End
         Begin VB.TextBox txt_SalesOrg_NbofOffices 
            Alignment       =   1  'Right Justify
            Height          =   330
            Left            =   2595
            MaxLength       =   2
            TabIndex        =   38
            Tag             =   "SO_Num®©Num®©0"
            Text            =   "99"
            Top             =   735
            Width           =   1395
         End
         Begin Project1.ArmCombobox cbo_SalesOrg_TypeofOffice 
            Height          =   345
            Left            =   6075
            TabIndex        =   41
            Tag             =   "SO_Type_code"
            Top             =   225
            Width           =   3135
            _ExtentX        =   5530
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_SalesOrg_Year 
            Height          =   345
            Left            =   2610
            TabIndex        =   37
            Tag             =   "SO_Year"
            Top             =   225
            Width           =   1065
            _ExtentX        =   1879
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare1_varchar"
            Height          =   285
            Index           =   37
            Left            =   225
            TabIndex        =   203
            Tag             =   "lbl_Spare1"
            Top             =   6885
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare2_varchar"
            Height          =   285
            Index           =   15
            Left            =   3645
            TabIndex        =   202
            Tag             =   "lbl_Spare2"
            Top             =   6930
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare3_real"
            Height          =   285
            Index           =   14
            Left            =   225
            TabIndex        =   201
            Tag             =   "lbl_Spare3"
            Top             =   7650
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare4_real"
            Height          =   285
            Index           =   13
            Left            =   3645
            TabIndex        =   200
            Tag             =   "lbl_Spare4"
            Top             =   7695
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Source"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   12
            Left            =   90
            TabIndex        =   192
            Tag             =   "lbl_Source"
            Top             =   3600
            Width           =   855
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Comments"
            Height          =   255
            Index           =   9
            Left            =   225
            TabIndex        =   157
            Tag             =   "lbl_Comments"
            Top             =   2115
            Width           =   4275
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Number of Reps"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   8
            Left            =   165
            TabIndex        =   155
            Tag             =   "lbl_NbofReps"
            Top             =   1815
            Width           =   2295
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Number of Managers"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   7
            Left            =   165
            TabIndex        =   154
            Tag             =   "lbl_NbofManagers"
            Top             =   1305
            Width           =   2295
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Office Locations"
            Height          =   255
            Index           =   6
            Left            =   4680
            TabIndex        =   153
            Tag             =   "lbl_OfficeLocations"
            Top             =   630
            Width           =   5145
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Number of Offices"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   5
            Left            =   165
            TabIndex        =   152
            Tag             =   "lbl_NbofOffices"
            Top             =   810
            Width           =   2295
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Type of Office"
            Height          =   255
            Index           =   4
            Left            =   4095
            TabIndex        =   151
            Tag             =   "lbl_TypeOfOffice"
            Top             =   285
            Width           =   1845
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Year"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   3
            Left            =   165
            TabIndex        =   150
            Tag             =   "lbl_Year"
            Top             =   330
            Width           =   2295
         End
      End
      Begin VB.Frame fra_record 
         Caption         =   "SalesReps"
         Height          =   855
         Index           =   2
         Left            =   7800
         TabIndex        =   342
         Tag             =   "CD_SalesReps"
         Top             =   690
         Visible         =   0   'False
         Width           =   1635
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   8
            Left            =   540
            TabIndex        =   346
            Tag             =   "Spare1_varchar®©Text"
            Top             =   4140
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_SalesReps_Name 
            Height          =   330
            Left            =   1530
            MaxLength       =   250
            TabIndex        =   13
            Tag             =   "SOP_Name®©Text"
            Top             =   270
            Width           =   6075
         End
         Begin VB.TextBox txt_SalesReps_Comments 
            Height          =   1140
            Left            =   180
            MaxLength       =   2500
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   17
            Tag             =   "SOP_Comment®©Text"
            Top             =   2115
            Width           =   9765
         End
         Begin VB.CheckBox chk_SalesReps_HasLeftComp 
            Alignment       =   1  'Right Justify
            Caption         =   "#Left Company"
            Height          =   285
            Left            =   5310
            TabIndex        =   16
            Tag             =   "SOP_LeftFlag"
            Top             =   900
            Width           =   1455
         End
         Begin VB.Frame fra_ModifInfo 
            BorderStyle     =   0  'None
            Caption         =   "Frame1"
            Height          =   375
            Index           =   2
            Left            =   135
            TabIndex        =   348
            Top             =   9180
            Width           =   9870
            Begin VB.TextBox txt_UpdUser 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   2
               Left            =   7740
               Locked          =   -1  'True
               TabIndex        =   352
               Tag             =   "U_login_lastupd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_LastUpdDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   2
               Left            =   6120
               Locked          =   -1  'True
               TabIndex        =   351
               Tag             =   "Z_last_upd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.TextBox txt_Creator 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   2
               Left            =   2835
               Locked          =   -1  'True
               TabIndex        =   350
               Tag             =   "U_login_creator®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_CreationDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   2
               Left            =   1170
               Locked          =   -1  'True
               TabIndex        =   349
               Tag             =   "Z_creation®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Date Entered"
               Height          =   240
               Index           =   33
               Left            =   0
               TabIndex        =   356
               Tag             =   "lbl_CreationDate"
               Top             =   45
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   34
               Left            =   2430
               TabIndex        =   355
               Tag             =   "lbl_CreatorBy"
               Top             =   45
               Width           =   330
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Last Updated"
               Height          =   240
               Index           =   35
               Left            =   4860
               TabIndex        =   354
               Tag             =   "lbl_LastUpdateDate"
               Top             =   45
               Width           =   1185
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   36
               Left            =   7290
               TabIndex        =   353
               Tag             =   "lbl_UpdUserBy"
               Top             =   45
               Width           =   375
            End
         End
         Begin VB.TextBox txt_key 
            Height          =   330
            Index           =   2
            Left            =   7875
            TabIndex        =   347
            Tag             =   "MKT_SOPeople_Key®©Num®©0"
            Top             =   900
            Visible         =   0   'False
            Width           =   1365
         End
         Begin VB.TextBox txt_SalesReps_Source 
            Height          =   345
            Left            =   1050
            MaxLength       =   75
            TabIndex        =   18
            Tag             =   "SOP_Source®©Text"
            Top             =   3390
            Width           =   8850
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   9
            Left            =   525
            TabIndex        =   345
            Tag             =   "Spare2_varchar®©Text"
            Top             =   4875
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   10
            Left            =   525
            TabIndex        =   344
            Tag             =   "Spare3_real®©Num®©0"
            Top             =   5640
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   11
            Left            =   480
            TabIndex        =   343
            Tag             =   "Spare4_real®©Num®©0"
            Top             =   6450
            Visible         =   0   'False
            Width           =   3165
         End
         Begin Project1.ArmCombobox cbo_SalesReps_BeginYrComp 
            Height          =   345
            Left            =   2655
            TabIndex        =   14
            Tag             =   "SOP_BeginYr_Comp"
            Top             =   855
            Width           =   1410
            _ExtentX        =   2487
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_SalesReps_BeginYrInd 
            Height          =   345
            Left            =   2655
            TabIndex        =   15
            Tag             =   "SOP_BeginYr_Ind"
            Top             =   1395
            Width           =   1410
            _ExtentX        =   2487
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Name"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   16
            Left            =   90
            TabIndex        =   365
            Tag             =   "lbl_Name"
            Top             =   315
            Width           =   1395
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Year joined Company"
            Height          =   255
            Index           =   17
            Left            =   120
            TabIndex        =   364
            Tag             =   "lbl_YearJoinComp"
            Top             =   900
            Width           =   2430
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Year started in Industry"
            Height          =   255
            Index           =   18
            Left            =   225
            TabIndex        =   363
            Tag             =   "lbl_YearJoinInd"
            Top             =   1440
            Width           =   2340
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Comments"
            Height          =   255
            Index           =   19
            Left            =   180
            TabIndex        =   362
            Tag             =   "lbl_Comments"
            Top             =   1845
            Width           =   1125
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Source"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   52
            Left            =   180
            TabIndex        =   361
            Tag             =   "lbl_Source"
            Top             =   3420
            Width           =   750
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare4_real"
            Height          =   285
            Index           =   23
            Left            =   480
            TabIndex        =   360
            Tag             =   "lbl_Spare4"
            Top             =   6225
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare3_real"
            Height          =   285
            Index           =   24
            Left            =   525
            TabIndex        =   359
            Tag             =   "lbl_Spare3"
            Top             =   5415
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare2_varchar"
            Height          =   285
            Index           =   25
            Left            =   525
            TabIndex        =   358
            Tag             =   "lbl_Spare2"
            Top             =   4650
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare1_varchar"
            Height          =   285
            Index           =   53
            Left            =   480
            TabIndex        =   357
            Tag             =   "lbl_Spare1"
            Top             =   3840
            Visible         =   0   'False
            Width           =   3165
         End
      End
      Begin VB.Frame fra_record 
         Caption         =   "Product"
         Height          =   840
         Index           =   6
         Left            =   4350
         TabIndex        =   315
         Tag             =   "CD_Products"
         Top             =   360
         Visible         =   0   'False
         Width           =   1830
         Begin VB.TextBox txt_Product_Price 
            Alignment       =   1  'Right Justify
            Height          =   345
            Left            =   165
            MaxLength       =   6
            TabIndex        =   78
            Tag             =   "GP_Pricing®©Num®©2"
            Text            =   "999.99"
            Top             =   1620
            Width           =   795
         End
         Begin VB.TextBox txt_Product_Item 
            Height          =   345
            Left            =   750
            MaxLength       =   50
            TabIndex        =   77
            Tag             =   "GP_Item®©Text"
            Text            =   "Text1"
            Top             =   840
            Width           =   5490
         End
         Begin VB.TextBox txt_Product_Volume 
            Alignment       =   1  'Right Justify
            Height          =   345
            Left            =   6540
            MaxLength       =   10
            TabIndex        =   81
            Tag             =   "GP_Volume®©Num®©0"
            Text            =   "99,999,999"
            Top             =   1620
            Width           =   945
         End
         Begin VB.TextBox txt_key 
            Height          =   375
            Index           =   6
            Left            =   8190
            TabIndex        =   325
            Tag             =   "MKT_GP_Key®©Num®©0"
            Text            =   "Text1"
            Top             =   405
            Visible         =   0   'False
            Width           =   1635
         End
         Begin VB.Frame fra_ModifInfo 
            Caption         =   "Frame1"
            Height          =   375
            Index           =   6
            Left            =   90
            TabIndex        =   316
            Top             =   9180
            Width           =   9870
            Begin VB.TextBox txt_CreationDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   6
               Left            =   1170
               Locked          =   -1  'True
               TabIndex        =   320
               Tag             =   "Z_creation®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.TextBox txt_Creator 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   6
               Left            =   2835
               Locked          =   -1  'True
               TabIndex        =   319
               Tag             =   "U_login_creator®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_LastUpdDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   6
               Left            =   6120
               Locked          =   -1  'True
               TabIndex        =   318
               Tag             =   "Z_last_upd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.TextBox txt_UpdUser 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   6
               Left            =   7830
               Locked          =   -1  'True
               TabIndex        =   317
               Tag             =   "U_login_lastupd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   158
               Left            =   7380
               TabIndex        =   324
               Tag             =   "lbl_UpdUserBy"
               Top             =   45
               Width           =   375
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Last Updated"
               Height          =   240
               Index           =   157
               Left            =   4860
               TabIndex        =   323
               Tag             =   "lbl_LastUpdateDate"
               Top             =   45
               Width           =   1185
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   156
               Left            =   2430
               TabIndex        =   322
               Tag             =   "lbl_CreatorBy"
               Top             =   45
               Width           =   330
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Date Entered"
               Height          =   240
               Index           =   155
               Left            =   0
               TabIndex        =   321
               Tag             =   "lbl_CreationDate"
               Top             =   45
               Width           =   1095
            End
         End
         Begin VB.TextBox txt_Product_Source 
            Height          =   345
            Left            =   1215
            MaxLength       =   75
            TabIndex        =   83
            Tag             =   "GP_Source®©Text"
            Text            =   "Text1"
            Top             =   2190
            Width           =   7980
         End
         Begin VB.TextBox txt_Product_Comment 
            Height          =   3510
            Left            =   150
            MaxLength       =   1800
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   84
            Tag             =   "GP_Comment®©Text"
            Text            =   "Comp_DB.ctx":0153
            Top             =   2940
            Width           =   9720
         End
         Begin Project1.ArmCombobox cbo_Product_Year 
            Height          =   345
            Left            =   1215
            TabIndex        =   75
            Tag             =   "GP_Year"
            Top             =   225
            Width           =   1365
            _ExtentX        =   2408
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Product_GP_Type 
            Height          =   345
            Left            =   4260
            TabIndex        =   76
            Tag             =   "GP_Type_code"
            Top             =   225
            Width           =   2805
            _ExtentX        =   4948
            _ExtentY        =   609
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   49
            Left            =   1350
            TabIndex        =   328
            Tag             =   "Spare2_varchar®©Text"
            Text            =   "Text1"
            Top             =   6975
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   50
            Left            =   1350
            TabIndex        =   327
            Tag             =   "Spare3_real®©Num®©0"
            Text            =   "Text1"
            Top             =   7740
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   375
            Index           =   51
            Left            =   1350
            TabIndex        =   326
            Tag             =   "Spare4_real®©Num®©0"
            Text            =   "Text1"
            Top             =   8505
            Visible         =   0   'False
            Width           =   3165
         End
         Begin Project1.ArmCombobox cbo_Product_Unit_of_Measure 
            Height          =   345
            Left            =   7500
            TabIndex        =   82
            Tag             =   "UM_Code"
            Top             =   1620
            Width           =   1710
            _ExtentX        =   3016
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Product_Currency 
            Height          =   345
            Left            =   975
            TabIndex        =   79
            Tag             =   "CURR_Code"
            Top             =   1620
            Width           =   2745
            _ExtentX        =   4842
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Product_Price_Positioning 
            Height          =   345
            Left            =   3735
            TabIndex        =   80
            Tag             =   "GP_Posit_Type_code"
            Top             =   1620
            Width           =   2790
            _ExtentX        =   4921
            _ExtentY        =   609
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   48
            Left            =   1350
            TabIndex        =   341
            Tag             =   "Spare1_varchar®©Text"
            Text            =   "Text1"
            Top             =   6165
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Unit of Measure"
            Height          =   240
            Index           =   168
            Left            =   7500
            TabIndex        =   557
            Tag             =   "lbl_UnitofMeasure"
            Top             =   1365
            Width           =   1275
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Curreny"
            Height          =   240
            Index           =   159
            Left            =   990
            TabIndex        =   556
            Tag             =   "lbl_Currency"
            Top             =   1365
            Visible         =   0   'False
            Width           =   1275
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Volume"
            Height          =   240
            Index           =   162
            Left            =   6555
            TabIndex        =   329
            Tag             =   "lbl_Volume"
            Top             =   1365
            Width           =   1485
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Type"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   167
            Left            =   3060
            TabIndex        =   340
            Tag             =   "lbl_Type"
            Top             =   300
            Width           =   1155
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare1_varchar"
            Height          =   285
            Index           =   151
            Left            =   1305
            TabIndex        =   339
            Tag             =   "lbl_Spare1"
            Top             =   5940
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare2_varchar"
            Height          =   285
            Index           =   152
            Left            =   1350
            TabIndex        =   338
            Tag             =   "lbl_Spare2"
            Top             =   6750
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare3_real"
            Height          =   285
            Index           =   153
            Left            =   1350
            TabIndex        =   337
            Tag             =   "lbl_Spare3"
            Top             =   7515
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare4_real"
            Height          =   285
            Index           =   154
            Left            =   1350
            TabIndex        =   336
            Tag             =   "lbl_Spare4"
            Top             =   8280
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Source"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   166
            Left            =   150
            TabIndex        =   335
            Tag             =   "lbl_Source"
            Top             =   2250
            Width           =   975
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Comment"
            Height          =   240
            Index           =   164
            Left            =   150
            TabIndex        =   334
            Tag             =   "lbl_Comment"
            Top             =   2670
            Width           =   2310
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Year"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   165
            Left            =   240
            TabIndex        =   333
            Tag             =   "lbl_Year"
            Top             =   300
            Width           =   945
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Item"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   163
            Left            =   165
            TabIndex        =   332
            Tag             =   "lbl_Item"
            Top             =   900
            Width           =   1485
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Price"
            Height          =   240
            Index           =   160
            Left            =   165
            TabIndex        =   331
            Tag             =   "lbl_Price"
            Top             =   1350
            Width           =   1275
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Price Positioning"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   161
            Left            =   3735
            TabIndex        =   330
            Tag             =   "lbl_Price_Positioning"
            Top             =   1365
            Width           =   2775
         End
      End
      Begin VB.Frame fra_record 
         Caption         =   "Services"
         Height          =   840
         Index           =   5
         Left            =   7890
         TabIndex        =   284
         Tag             =   "CD_Services"
         Top             =   3180
         Visible         =   0   'False
         Width           =   1590
         Begin VB.Frame Fra_opt_services_Warranty 
            BorderStyle     =   0  'None
            Height          =   330
            Left            =   1215
            TabIndex        =   314
            Top             =   2655
            Width           =   1455
            Begin VB.OptionButton opt_Services_Warranty 
               Caption         =   "#Yes"
               Height          =   285
               Index           =   0
               Left            =   45
               TabIndex        =   89
               Tag             =   "SERV_WarrntyYN®©False®©Y"
               Top             =   0
               Width           =   690
            End
            Begin VB.OptionButton opt_Services_Warranty 
               Caption         =   "#No"
               Height          =   285
               Index           =   1
               Left            =   765
               TabIndex        =   90
               Tag             =   "SERV_WarrntyYN®©True®©N"
               Top             =   0
               Width           =   690
            End
         End
         Begin VB.Frame Fra_opt_services_TechSupport 
            BorderStyle     =   0  'None
            Height          =   330
            Left            =   6525
            TabIndex        =   313
            Top             =   2655
            Width           =   1455
            Begin VB.OptionButton opt_Services_TechSupport 
               Caption         =   "#Yes"
               Height          =   285
               Index           =   0
               Left            =   45
               TabIndex        =   92
               Tag             =   "SERV_TechSupYN®©False®©Y"
               Top             =   0
               Width           =   735
            End
            Begin VB.OptionButton opt_Services_TechSupport 
               Caption         =   "#No"
               Height          =   285
               Index           =   1
               Left            =   765
               TabIndex        =   93
               Tag             =   "SERV_TechSupYN®©True®©N"
               Top             =   0
               Width           =   645
            End
         End
         Begin VB.TextBox txt_Spare 
            Height          =   375
            Index           =   31
            Left            =   6660
            TabIndex        =   297
            Tag             =   "Spare4_real®©Num®©0"
            Text            =   "Text1"
            Top             =   3510
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Frame fra_ModifInfo 
            BorderStyle     =   0  'None
            Height          =   510
            Index           =   5
            Left            =   90
            TabIndex        =   288
            Top             =   9045
            Width           =   9870
            Begin VB.TextBox txt_UpdUser 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   5
               Left            =   7830
               Locked          =   -1  'True
               TabIndex        =   292
               Tag             =   "U_login_lastupd®©Text"
               Text            =   "Text1"
               Top             =   135
               Width           =   1995
            End
            Begin VB.TextBox txt_LastUpdDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   5
               Left            =   6120
               Locked          =   -1  'True
               TabIndex        =   291
               Tag             =   "Z_last_upd®©Text"
               Text            =   "Text1"
               Top             =   135
               Width           =   1095
            End
            Begin VB.TextBox txt_Creator 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   5
               Left            =   2835
               Locked          =   -1  'True
               TabIndex        =   290
               Tag             =   "U_login_creator®©Text"
               Text            =   "Text1"
               Top             =   135
               Width           =   1995
            End
            Begin VB.TextBox txt_CreationDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   5
               Left            =   1170
               Locked          =   -1  'True
               TabIndex        =   289
               Tag             =   "Z_creation®©Text"
               Text            =   "Text1"
               Top             =   135
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Date Entered"
               Height          =   240
               Index           =   125
               Left            =   0
               TabIndex        =   296
               Tag             =   "lbl_CreationDate"
               Top             =   180
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   126
               Left            =   2430
               TabIndex        =   295
               Tag             =   "lbl_CreatorBy"
               Top             =   180
               Width           =   330
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Last Updated"
               Height          =   240
               Index           =   127
               Left            =   4860
               TabIndex        =   294
               Tag             =   "lbl_LastUpdateDate"
               Top             =   180
               Width           =   1185
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   128
               Left            =   7380
               TabIndex        =   293
               Tag             =   "lbl_UpdUserBy"
               Top             =   180
               Width           =   375
            End
         End
         Begin VB.TextBox txt_key 
            Height          =   375
            Index           =   5
            Left            =   8190
            TabIndex        =   287
            Tag             =   "MKT_SERV_KEY®©Num®©0"
            Text            =   "Text1"
            Top             =   405
            Visible         =   0   'False
            Width           =   1635
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   29
            Left            =   6705
            TabIndex        =   286
            Tag             =   "Spare2_varchar®©Text"
            Text            =   "Text1"
            Top             =   1935
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   28
            Left            =   6705
            TabIndex        =   285
            Tag             =   "Spare1_varchar®©Text"
            Text            =   "Text1"
            Top             =   1125
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Services_Source 
            Height          =   345
            Left            =   1305
            MaxLength       =   75
            TabIndex        =   98
            Tag             =   "SERV_Source®©Text"
            Text            =   "Text1"
            Top             =   6030
            Width           =   8535
         End
         Begin VB.TextBox txt_Services_DeliveryPolicy 
            Height          =   945
            Left            =   4680
            MaxLength       =   1200
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   87
            Tag             =   "SERV_DelPol®©Text"
            Text            =   "Comp_DB.ctx":0159
            Top             =   360
            Width           =   5175
         End
         Begin VB.TextBox txt_Services_ShipmentTimes 
            Height          =   945
            Left            =   4680
            MaxLength       =   1200
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   88
            Tag             =   "SERV_ShpTime®©Text"
            Text            =   "Comp_DB.ctx":015F
            Top             =   1380
            Width           =   5175
         End
         Begin VB.TextBox txt_Services_Warranty 
            Height          =   1275
            Left            =   150
            MaxLength       =   1200
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   91
            Tag             =   "SERV_WarrntyTxt®©Text"
            Text            =   "Comp_DB.ctx":0165
            Top             =   3015
            Width           =   4785
         End
         Begin VB.TextBox txt_Services_TermsConditions 
            Height          =   1275
            Left            =   150
            MaxLength       =   1200
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   96
            Tag             =   "SERV_PymntTrms®©Text"
            Text            =   "Comp_DB.ctx":016B
            Top             =   4635
            Width           =   4785
         End
         Begin VB.TextBox txt_Services_EnvironmentalPolicy 
            Height          =   1275
            Left            =   5070
            MaxLength       =   1200
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   97
            Tag             =   "SERV_EnvPol®©Text"
            Text            =   "Comp_DB.ctx":0171
            Top             =   4635
            Width           =   4785
         End
         Begin Project1.ArmCombobox cbo_Services_Year 
            Height          =   345
            Left            =   180
            TabIndex        =   85
            Tag             =   "SERV_Year"
            Top             =   450
            Width           =   1065
            _ExtentX        =   1879
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Services_Compliance_Ranking 
            Height          =   345
            Left            =   180
            TabIndex        =   86
            Tag             =   "CR_Code"
            Top             =   1980
            Width           =   4245
            _ExtentX        =   7488
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Services_TechSupportRating 
            Height          =   345
            Left            =   8100
            TabIndex        =   94
            Tag             =   "SERV_TechSupRtg_code"
            Top             =   2610
            Width           =   1785
            _ExtentX        =   2037
            _ExtentY        =   609
         End
         Begin VB.TextBox txt_Services_Tech_Support 
            Height          =   1275
            Left            =   5070
            MaxLength       =   1200
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   95
            Tag             =   "SERV_TechSupTxt®©Text"
            Text            =   "Comp_DB.ctx":0177
            Top             =   3015
            Width           =   4785
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   30
            Left            =   6705
            TabIndex        =   298
            Tag             =   "Spare3_real®©Num®©0"
            Text            =   "Text1"
            Top             =   2700
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Year"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   137
            Left            =   180
            TabIndex        =   299
            Tag             =   "lbl_Year"
            Top             =   225
            Width           =   1695
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Rating"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   134
            Left            =   8100
            TabIndex        =   301
            Tag             =   "lbl_TechSupportRating"
            Top             =   2370
            Width           =   1125
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare4_real"
            Height          =   285
            Index           =   124
            Left            =   6660
            TabIndex        =   312
            Tag             =   "lbl_Spare4"
            Top             =   3285
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare3_real"
            Height          =   285
            Index           =   123
            Left            =   6705
            TabIndex        =   311
            Tag             =   "lbl_Spare3"
            Top             =   2475
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare2_varchar"
            Height          =   285
            Index           =   122
            Left            =   6705
            TabIndex        =   310
            Tag             =   "lbl_Spare2"
            Top             =   1710
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare1_varchar"
            Height          =   285
            Index           =   121
            Left            =   6660
            TabIndex        =   309
            Tag             =   "lbl_Spare1"
            Top             =   900
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Terms && conditions"
            Height          =   240
            Index           =   138
            Left            =   150
            TabIndex        =   308
            Tag             =   "lbl_TermsConditions"
            Top             =   4365
            Width           =   1995
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Source"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   140
            Left            =   105
            TabIndex        =   307
            Tag             =   "lbl_Source"
            Top             =   6090
            Width           =   1155
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Compliance ranking"
            Height          =   240
            Index           =   130
            Left            =   180
            TabIndex        =   306
            Tag             =   "lbl_ComplianceRating"
            Top             =   1740
            Width           =   2280
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Delivery Policy Nearest W/House"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   435
            Index           =   139
            Left            =   2760
            TabIndex        =   305
            Tag             =   "lbl_DeliveryPolicy"
            Top             =   360
            Width           =   1845
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Shipment Details Lead times"
            Height          =   435
            Index           =   131
            Left            =   3270
            TabIndex        =   304
            Tag             =   "lbl_ShipmentTimes"
            Top             =   1380
            Width           =   1305
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Warranty"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   132
            Left            =   135
            TabIndex        =   303
            Tag             =   "lbl_Warranty"
            Top             =   2700
            Width           =   1095
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Tech Support"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   133
            Left            =   5100
            TabIndex        =   302
            Tag             =   "lbl_TechSupport"
            Top             =   2700
            Width           =   1755
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Environmental Policy"
            Height          =   240
            Index           =   136
            Left            =   5070
            TabIndex        =   300
            Tag             =   "lbl_EnvironmentalPolicy"
            Top             =   4365
            Width           =   1995
         End
      End
      Begin VB.Frame fra_record 
         Caption         =   "Channel"
         Height          =   975
         Index           =   9
         Left            =   2370
         TabIndex        =   366
         Tag             =   "CD_Channel"
         Top             =   210
         Visible         =   0   'False
         Width           =   1725
         Begin Project1.ArmCombobox cbo_Channel_Year_began 
            Height          =   345
            Left            =   8460
            TabIndex        =   49
            Tag             =   "CHNL_Begin_Years"
            Top             =   690
            Width           =   1365
            _ExtentX        =   2408
            _ExtentY        =   609
         End
         Begin VB.Frame fra_ModifInfo 
            Caption         =   "Frame1"
            Height          =   375
            Index           =   9
            Left            =   90
            TabIndex        =   374
            Top             =   9180
            Width           =   9870
            Begin VB.TextBox txt_UpdUser 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   9
               Left            =   7830
               Locked          =   -1  'True
               TabIndex        =   378
               Tag             =   "U_login_lastupd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_LastUpdDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   9
               Left            =   6120
               Locked          =   -1  'True
               TabIndex        =   377
               Tag             =   "Z_last_upd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.TextBox txt_Creator 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   9
               Left            =   2835
               Locked          =   -1  'True
               TabIndex        =   376
               Tag             =   "U_login_creator®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_CreationDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   9
               Left            =   1170
               Locked          =   -1  'True
               TabIndex        =   375
               Tag             =   "Z_creation®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Date Entered"
               Height          =   240
               Index           =   305
               Left            =   0
               TabIndex        =   382
               Tag             =   "lbl_CreationDate"
               Top             =   45
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   306
               Left            =   2430
               TabIndex        =   381
               Tag             =   "lbl_CreatorBy"
               Top             =   45
               Width           =   330
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Last Updated"
               Height          =   240
               Index           =   307
               Left            =   4860
               TabIndex        =   380
               Tag             =   "lbl_LastUpdateDate"
               Top             =   45
               Width           =   1185
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   308
               Left            =   7380
               TabIndex        =   379
               Tag             =   "lbl_UpdUserBy"
               Top             =   45
               Width           =   375
            End
         End
         Begin VB.TextBox txt_key 
            Height          =   375
            Index           =   9
            Left            =   8145
            TabIndex        =   373
            Tag             =   "MKT_CHNL_Key®©Num®©0"
            Text            =   "Text1"
            Top             =   2430
            Visible         =   0   'False
            Width           =   1635
         End
         Begin VB.Frame Fra_Products 
            Height          =   3120
            Left            =   120
            TabIndex        =   367
            Tag             =   "CD_Products"
            Top             =   5985
            Width           =   9735
            Begin Project1.ToolbarControl tlb_Products 
               Height          =   2940
               Left            =   9000
               TabIndex        =   368
               Top             =   135
               Width           =   690
               _ExtentX        =   1217
               _ExtentY        =   5186
            End
            Begin Project1.ArmGrid grd_Products 
               Height          =   2625
               Left            =   90
               TabIndex        =   369
               Tag             =   "Products"
               Top             =   405
               Width           =   8835
               _ExtentX        =   15584
               _ExtentY        =   4630
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Products"
               Height          =   195
               Index           =   309
               Left            =   135
               TabIndex        =   370
               Tag             =   "lbl_Products"
               Top             =   180
               Width           =   8565
            End
         End
         Begin VB.TextBox txt_Channel_Source 
            Height          =   345
            Left            =   3750
            MaxLength       =   75
            TabIndex        =   46
            Tag             =   "CHNL_Source®©Text"
            Text            =   "Text1"
            Top             =   240
            Width           =   3930
         End
         Begin VB.TextBox txt_Channel_Name 
            Height          =   345
            Left            =   1170
            MaxLength       =   125
            TabIndex        =   48
            Tag             =   "CHNL_Name®©Text"
            Text            =   "Text1"
            Top             =   720
            Width           =   5820
         End
         Begin VB.TextBox txt_Channel_percent_of_Turnover 
            Alignment       =   1  'Right Justify
            Height          =   345
            Left            =   8460
            MaxLength       =   3
            TabIndex        =   50
            Tag             =   "CHNL_percentBus®©Num®©0"
            Text            =   "100"
            Top             =   1140
            Width           =   480
         End
         Begin Project1.ArmCombobox cbo_Channel_Year 
            Height          =   345
            Left            =   8460
            TabIndex        =   47
            Tag             =   "CHNL_Year"
            Top             =   240
            Width           =   1365
            _ExtentX        =   2408
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Channel_Type 
            Height          =   345
            Left            =   1170
            TabIndex        =   45
            Tag             =   "CHNL_Type_code"
            Top             =   240
            Width           =   1755
            _ExtentX        =   3096
            _ExtentY        =   609
         End
         Begin VB.Frame Fra_ChannelInfo 
            Height          =   1335
            Left            =   90
            TabIndex        =   396
            Top             =   1110
            Width           =   9600
            Begin VB.TextBox txt_Channel_percent_End_User 
               Alignment       =   1  'Right Justify
               Height          =   345
               Left            =   8070
               MaxLength       =   3
               TabIndex        =   56
               Tag             =   "CHNL_EU®©Num®©0"
               Text            =   "100"
               Top             =   885
               Width           =   435
            End
            Begin VB.TextBox txt_Channel_percent_Main_Contractor 
               Alignment       =   1  'Right Justify
               Height          =   345
               Left            =   5880
               MaxLength       =   3
               TabIndex        =   55
               Tag             =   "CHNL_MC®©Num®©0"
               Text            =   "100"
               Top             =   885
               Width           =   435
            End
            Begin VB.TextBox txt_Channel_percent_Strat_Accounts 
               Alignment       =   1  'Right Justify
               Height          =   345
               Left            =   3750
               MaxLength       =   3
               TabIndex        =   54
               Tag             =   "CHNL_SA®©Num®©0"
               Text            =   "100"
               Top             =   885
               Width           =   435
            End
            Begin VB.TextBox txt_Channel_percent_Contractor 
               Alignment       =   1  'Right Justify
               Height          =   345
               Left            =   1980
               MaxLength       =   3
               TabIndex        =   53
               Tag             =   "CHNL_Cont®©Num®©0"
               Text            =   "100"
               Top             =   885
               Width           =   435
            End
            Begin VB.TextBox txt_Channel_percent_Distributor 
               Alignment       =   1  'Right Justify
               Height          =   345
               Left            =   390
               MaxLength       =   3
               TabIndex        =   52
               Tag             =   "CHNL_Dist®©Num®©0"
               Text            =   "100"
               Top             =   885
               Width           =   435
            End
            Begin Project1.ArmCombobox cbo_Channel_Category 
               Height          =   345
               Left            =   1080
               TabIndex        =   51
               Tag             =   "SC_Code"
               Top             =   60
               Width           =   1785
               _ExtentX        =   3149
               _ExtentY        =   609
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Category"
               BeginProperty Font 
                  Name            =   "MS Sans Serif"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   700
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Height          =   240
               Index           =   312
               Left            =   90
               TabIndex        =   402
               Tag             =   "lbl_Category"
               Top             =   120
               Width           =   945
            End
            Begin VB.Label lbl_label 
               Caption         =   "#% End User"
               Height          =   240
               Index           =   318
               Left            =   8070
               TabIndex        =   401
               Tag             =   "lbl_percent_End_User"
               Top             =   615
               Width           =   1935
            End
            Begin VB.Label lbl_label 
               Caption         =   "#% Main Contractor"
               Height          =   240
               Index           =   317
               Left            =   5850
               TabIndex        =   400
               Tag             =   "lbl_percent_Main_Contractor"
               Top             =   615
               Width           =   2025
            End
            Begin VB.Label lbl_label 
               Caption         =   "#% Strat Accounts"
               Height          =   240
               Index           =   316
               Left            =   3720
               TabIndex        =   399
               Tag             =   "lbl_percent_Strat_Accounts"
               Top             =   615
               Width           =   1935
            End
            Begin VB.Label lbl_label 
               Caption         =   "#% Contractor"
               Height          =   240
               Index           =   315
               Left            =   1950
               TabIndex        =   398
               Tag             =   "lbl_percent_Contractor"
               Top             =   615
               Width           =   1485
            End
            Begin VB.Label lbl_label 
               Caption         =   "#% Distributor"
               Height          =   240
               Index           =   314
               Left            =   360
               TabIndex        =   397
               Tag             =   "lbl_percent_Distributor"
               Top             =   615
               Width           =   1485
            End
         End
         Begin VB.TextBox txt_Channel_Comments 
            Height          =   3075
            Left            =   120
            MaxLength       =   5000
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   57
            Tag             =   "CHNL_Comment®©Text"
            Text            =   "Comp_DB.ctx":017D
            Top             =   2835
            Width           =   9720
         End
         Begin VB.TextBox txt_Spare 
            Height          =   375
            Index           =   17
            Left            =   2070
            TabIndex        =   383
            Tag             =   "Spare2_varchar®©Text"
            Text            =   "Text1"
            Top             =   3195
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   16
            Left            =   2070
            TabIndex        =   384
            Tag             =   "Spare1_varchar®©Text"
            Text            =   "Text1"
            Top             =   3960
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   375
            Index           =   19
            Left            =   1980
            TabIndex        =   372
            Tag             =   "Spare4_real®©Num®©0"
            Text            =   "Text1"
            Top             =   5445
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   18
            Left            =   2025
            TabIndex        =   371
            Tag             =   "Spare3_real®©Num®©0"
            Text            =   "Text1"
            Top             =   4635
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Year began"
            Height          =   240
            Index           =   313
            Left            =   6660
            TabIndex        =   385
            Tag             =   "lbl_Year_began"
            Top             =   750
            Width           =   1725
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare4_real"
            Height          =   285
            Index           =   304
            Left            =   1980
            TabIndex        =   395
            Tag             =   "lbl_Spare4"
            Top             =   5220
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Year"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   320
            Left            =   7440
            TabIndex        =   391
            Tag             =   "lbl_Year"
            Top             =   300
            Width           =   945
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Type"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   321
            Left            =   180
            TabIndex        =   390
            Tag             =   "lbl_Type"
            Top             =   300
            Width           =   945
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Source"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   322
            Left            =   2760
            TabIndex        =   389
            Tag             =   "lbl_Source"
            Top             =   300
            Width           =   945
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Comments"
            Height          =   240
            Index           =   319
            Left            =   180
            TabIndex        =   388
            Tag             =   "lbl_Comments"
            Top             =   2610
            Width           =   1005
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Name"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   310
            Left            =   210
            TabIndex        =   387
            Tag             =   "lbl_Name"
            Top             =   780
            Width           =   885
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#% of Turnover"
            Height          =   240
            Index           =   311
            Left            =   6885
            TabIndex        =   386
            Tag             =   "lbl_percent_of_Turnover"
            Top             =   1185
            Width           =   1485
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare3_real"
            Height          =   285
            Index           =   303
            Left            =   2025
            TabIndex        =   394
            Tag             =   "lbl_Spare3"
            Top             =   4410
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare2_varchar"
            Height          =   285
            Index           =   302
            Left            =   2025
            TabIndex        =   393
            Tag             =   "lbl_Spare2"
            Top             =   3645
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare1_varchar"
            Height          =   285
            Index           =   301
            Left            =   1980
            TabIndex        =   392
            Tag             =   "lbl_Spare1"
            Top             =   2835
            Visible         =   0   'False
            Width           =   3165
         End
      End
      Begin VB.Frame Fra_Attachments 
         Height          =   2535
         Left            =   300
         TabIndex        =   160
         Tag             =   "DB_Attachments"
         Top             =   6930
         Visible         =   0   'False
         Width           =   9735
         Begin Project1.ToolbarControl tlb_Attachments 
            Height          =   2355
            Left            =   9000
            TabIndex        =   193
            Top             =   135
            Width           =   690
            _ExtentX        =   1217
            _ExtentY        =   4154
         End
         Begin Project1.ArmGrid grd_Attachments 
            Height          =   1995
            Left            =   90
            TabIndex        =   161
            Tag             =   "Attachment"
            Top             =   420
            Width           =   8835
            _ExtentX        =   15584
            _ExtentY        =   3519
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Attachments"
            Height          =   195
            Index           =   11
            Left            =   135
            TabIndex        =   163
            Tag             =   "lbl_Attachments"
            Top             =   180
            Width           =   8565
         End
      End
      Begin VB.Frame fra_record 
         Caption         =   "Channel_PE"
         Height          =   915
         Index           =   51
         Left            =   4080
         TabIndex        =   504
         Tag             =   "CD_Channel_PE"
         Top             =   2400
         Width           =   1170
         Begin VB.TextBox txt_Channel_PE_Source 
            Height          =   375
            Left            =   1800
            MaxLength       =   75
            TabIndex        =   3
            Tag             =   "PE_Source®©Text"
            Top             =   1200
            Width           =   8055
         End
         Begin VB.TextBox txt_Channel_PE_Quantity 
            Alignment       =   1  'Right Justify
            Height          =   330
            Left            =   1800
            MaxLength       =   10
            TabIndex        =   4
            Tag             =   "PE_Volume®©Num®©0"
            Text            =   "99,999,999"
            Top             =   1965
            Width           =   1095
         End
         Begin VB.TextBox txt_Channel_PE_Value 
            Alignment       =   1  'Right Justify
            Height          =   330
            Left            =   1800
            MaxLength       =   11
            TabIndex        =   6
            Tag             =   "PE_value®©Num®©0"
            Text            =   "999,999,999"
            Top             =   2445
            Width           =   1095
         End
         Begin VB.TextBox txt_Channel_PE_Comment 
            Height          =   1875
            Left            =   120
            MaxLength       =   4000
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   8
            Tag             =   "PE_Comment®©Text"
            Top             =   3180
            Width           =   9675
         End
         Begin VB.Frame fra_ModifInfo 
            Height          =   375
            Index           =   51
            Left            =   0
            TabIndex        =   510
            Top             =   9120
            Width           =   9870
            Begin VB.TextBox txt_UpdUser 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   51
               Left            =   7830
               Locked          =   -1  'True
               TabIndex        =   514
               Tag             =   "U_login_lastupd®©Text"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_LastUpdDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   51
               Left            =   6120
               Locked          =   -1  'True
               TabIndex        =   513
               Tag             =   "Z_last_upd®©Text"
               Top             =   0
               Width           =   1095
            End
            Begin VB.TextBox txt_Creator 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   51
               Left            =   2835
               Locked          =   -1  'True
               TabIndex        =   512
               Tag             =   "U_login_creator®©Text"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_CreationDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   51
               Left            =   1170
               Locked          =   -1  'True
               TabIndex        =   511
               Tag             =   "Z_creation®©Text"
               Top             =   0
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Date Entered"
               Height          =   240
               Index           =   477
               Left            =   0
               TabIndex        =   518
               Tag             =   "lbl_CreationDate"
               Top             =   45
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   478
               Left            =   2430
               TabIndex        =   517
               Tag             =   "lbl_CreatorBy"
               Top             =   45
               Width           =   330
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Last Updated"
               Height          =   240
               Index           =   479
               Left            =   4860
               TabIndex        =   516
               Tag             =   "lbl_LastUpdateDate"
               Top             =   45
               Width           =   1185
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   480
               Left            =   7335
               TabIndex        =   515
               Tag             =   "lbl_UpdUserBy"
               Top             =   45
               Width           =   375
            End
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   40
            Left            =   555
            TabIndex        =   509
            Tag             =   "Spare1_varchar®©Text"
            Top             =   6135
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   41
            Left            =   555
            TabIndex        =   508
            Tag             =   "Spare2_varchar®©Text"
            Top             =   6945
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   42
            Left            =   555
            TabIndex        =   507
            Tag             =   "Spare3_real®©Num®©0"
            Top             =   7710
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   43
            Left            =   510
            TabIndex        =   506
            Tag             =   "Spare4_real®©Num®©0"
            Top             =   8520
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_key 
            Height          =   375
            Index           =   51
            Left            =   8055
            TabIndex        =   505
            Tag             =   "MKT_CHNL_PE_Key®©Num®©0"
            Top             =   180
            Visible         =   0   'False
            Width           =   1455
         End
         Begin Project1.ArmCombobox cbo_Channel_PE_BM 
            Height          =   345
            Left            =   6840
            TabIndex        =   2
            Tag             =   "BM_Code"
            Top             =   600
            Width           =   3015
            _ExtentX        =   5318
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Channel_PE_Category 
            Height          =   345
            Left            =   1800
            TabIndex        =   1
            Tag             =   "SC_Code"
            Top             =   600
            Width           =   3015
            _ExtentX        =   5318
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Channel_PE_UM 
            Height          =   345
            Left            =   3330
            TabIndex        =   5
            Tag             =   "UM_Code"
            Top             =   1950
            Width           =   2235
            _ExtentX        =   3942
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Channel_PE_Curr 
            Height          =   345
            Left            =   3300
            TabIndex        =   7
            Tag             =   "CURR_Code"
            Top             =   2430
            Width           =   3045
            _ExtentX        =   5371
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#in"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   57
            Left            =   2880
            TabIndex        =   560
            Tag             =   "lbl_QuantityIn"
            Top             =   2040
            Width           =   375
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Currency"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   486
            Left            =   3300
            TabIndex        =   559
            Tag             =   "lbl_Currency"
            Top             =   2220
            Visible         =   0   'False
            Width           =   1575
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Unit of Measure"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   485
            Left            =   3330
            TabIndex        =   558
            Tag             =   "lbl_UnitOfMeasure"
            Top             =   1740
            Visible         =   0   'False
            Width           =   1575
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Category"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   470
            Left            =   120
            TabIndex        =   529
            Tag             =   "lbl_Category"
            Top             =   720
            Width           =   1575
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Base-Item"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   471
            Left            =   5160
            TabIndex        =   528
            Tag             =   "lbl_BaseItem"
            Top             =   720
            Width           =   1575
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Source"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   472
            Left            =   120
            TabIndex        =   527
            Tag             =   "lbl_Source"
            Top             =   1320
            Width           =   1575
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Quantity"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   473
            Left            =   120
            TabIndex        =   526
            Tag             =   "lbl_Quantity"
            Top             =   2040
            Width           =   1575
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Value"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   474
            Left            =   330
            TabIndex        =   525
            Tag             =   "lbl_Value"
            Top             =   2490
            Width           =   1335
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#in"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   475
            Left            =   2880
            TabIndex        =   524
            Tag             =   "lbl_ValueIn"
            Top             =   2490
            Width           =   375
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Comments"
            Height          =   255
            Index           =   476
            Left            =   120
            TabIndex        =   523
            Tag             =   "lbl_Comments"
            Top             =   2880
            Width           =   1575
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare4_real"
            Height          =   285
            Index           =   484
            Left            =   510
            TabIndex        =   522
            Tag             =   "lbl_Spare4"
            Top             =   8295
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare3_real"
            Height          =   285
            Index           =   483
            Left            =   555
            TabIndex        =   521
            Tag             =   "lbl_Spare3"
            Top             =   7485
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare2_varchar"
            Height          =   285
            Index           =   482
            Left            =   555
            TabIndex        =   520
            Tag             =   "lbl_Spare2"
            Top             =   6720
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare1_varchar"
            Height          =   285
            Index           =   481
            Left            =   510
            TabIndex        =   519
            Tag             =   "lbl_Spare1"
            Top             =   5910
            Visible         =   0   'False
            Width           =   3165
         End
      End
      Begin VB.Frame fra_record 
         Caption         =   "General"
         Height          =   780
         Index           =   0
         Left            =   3720
         TabIndex        =   132
         Tag             =   "CD_General"
         Top             =   6030
         Visible         =   0   'False
         Width           =   1470
         Begin VB.Frame fra_ModifInfo 
            Caption         =   "Frame1"
            Height          =   375
            Index           =   0
            Left            =   90
            TabIndex        =   174
            Top             =   9180
            Width           =   9870
            Begin VB.TextBox txt_UpdUser 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   0
               Left            =   7830
               Locked          =   -1  'True
               TabIndex        =   178
               Tag             =   "U_login_lastupd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_LastUpdDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   0
               Left            =   6120
               Locked          =   -1  'True
               TabIndex        =   177
               Tag             =   "Z_last_upd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.TextBox txt_Creator 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   0
               Left            =   2835
               Locked          =   -1  'True
               TabIndex        =   176
               Tag             =   "U_login_creator®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_CreationDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   0
               Left            =   1170
               Locked          =   -1  'True
               TabIndex        =   175
               Tag             =   "Z_creation®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Date Entered"
               Height          =   240
               Index           =   20
               Left            =   0
               TabIndex        =   182
               Tag             =   "lbl_CreationDate"
               Top             =   45
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   21
               Left            =   2430
               TabIndex        =   181
               Tag             =   "lbl_CreatorBy"
               Top             =   45
               Width           =   330
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Last Updated"
               Height          =   240
               Index           =   26
               Left            =   4860
               TabIndex        =   180
               Tag             =   "lbl_LastUpdateDate"
               Top             =   45
               Width           =   1185
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   27
               Left            =   7380
               TabIndex        =   179
               Tag             =   "lbl_UpdUserBy"
               Top             =   45
               Width           =   375
            End
         End
         Begin VB.TextBox txt_key 
            Height          =   330
            Index           =   0
            Left            =   8190
            TabIndex        =   173
            Tag             =   "MKT_Key®©Num®©0"
            Text            =   "Text1"
            Top             =   405
            Visible         =   0   'False
            Width           =   1635
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   3
            Left            =   225
            TabIndex        =   171
            Tag             =   "Spare4_real®©Num®©0"
            Text            =   "Text1"
            Top             =   6435
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   2
            Left            =   270
            TabIndex        =   169
            Tag             =   "Spare3_real®©Num®©0"
            Text            =   "Text1"
            Top             =   5625
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   1
            Left            =   270
            TabIndex        =   167
            Tag             =   "Spare2_varchar®©Text"
            Text            =   "Text1"
            Top             =   4860
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   0
            Left            =   270
            TabIndex        =   165
            Tag             =   "Spare1_varchar®©Text"
            Text            =   "Text1"
            Top             =   4050
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_General_comment 
            Height          =   1665
            Left            =   240
            MaxLength       =   4000
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   118
            Tag             =   "Master_Comment®©Text"
            Text            =   "Comp_DB.ctx":0183
            Top             =   1980
            Width           =   9645
         End
         Begin Project1.ArmCombobox cbo_General_Competitor 
            Height          =   345
            Left            =   240
            TabIndex        =   116
            Tag             =   "Comp_code"
            Top             =   1200
            Width           =   3375
            _ExtentX        =   5953
            _ExtentY        =   609
         End
         Begin VB.OptionButton opt_General_Strat_Flag 
            Caption         =   "#Strategic"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   1
            Left            =   2115
            TabIndex        =   105
            Tag             =   "Strat_Flag®©False®©S"
            Top             =   480
            Value           =   -1  'True
            Width           =   1335
         End
         Begin VB.OptionButton opt_General_Strat_Flag 
            Caption         =   "#Country"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   0
            Left            =   480
            TabIndex        =   0
            Tag             =   "Strat_Flag®©True®©C"
            Top             =   480
            Width           =   1335
         End
         Begin Project1.ArmCombobox cbo_General_Country 
            Height          =   345
            Left            =   3960
            TabIndex        =   117
            Tag             =   "CT_code"
            Top             =   1200
            Width           =   3375
            _ExtentX        =   5953
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare4_real"
            Height          =   285
            Index           =   32
            Left            =   225
            TabIndex        =   172
            Tag             =   "lbl_Spare4"
            Top             =   6210
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare3_real"
            Height          =   285
            Index           =   31
            Left            =   270
            TabIndex        =   170
            Tag             =   "lbl_Spare3"
            Top             =   5400
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare2_varchar"
            Height          =   285
            Index           =   30
            Left            =   270
            TabIndex        =   168
            Tag             =   "lbl_Spare2"
            Top             =   4635
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare1_varchar"
            Height          =   285
            Index           =   29
            Left            =   225
            TabIndex        =   166
            Tag             =   "lbl_Spare1"
            Top             =   3825
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Comments"
            Height          =   255
            Index           =   2
            Left            =   225
            TabIndex        =   148
            Tag             =   "lbl_Comment"
            Top             =   1710
            Width           =   9255
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Country"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   1
            Left            =   3960
            TabIndex        =   147
            Tag             =   "lbl_country"
            Top             =   960
            Width           =   3375
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Competitor"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   0
            Left            =   240
            TabIndex        =   146
            Tag             =   "lbl_competitor"
            Top             =   960
            Width           =   3375
         End
      End
      Begin VB.Frame fra_record 
         Caption         =   "Communication"
         Height          =   780
         Index           =   8
         Left            =   4890
         TabIndex        =   530
         Tag             =   "CD_Communication"
         Top             =   4320
         Width           =   1740
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   56
            Left            =   6705
            TabIndex        =   544
            Tag             =   "Spare1_varchar®©Text"
            Text            =   "Text1"
            Top             =   1125
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   57
            Left            =   6705
            TabIndex        =   543
            Tag             =   "Spare2_varchar®©Text"
            Text            =   "Text1"
            Top             =   1935
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   58
            Left            =   6705
            TabIndex        =   542
            Tag             =   "Spare3_real®©Num®©0"
            Text            =   "Text1"
            Top             =   2700
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   375
            Index           =   59
            Left            =   6660
            TabIndex        =   541
            Tag             =   "Spare4_real®©Num®©0"
            Text            =   "Text1"
            Top             =   3510
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_key 
            Height          =   375
            Index           =   8
            Left            =   8190
            TabIndex        =   540
            Tag             =   "MKT_COM_Key®©Num®©0"
            Text            =   "Text1"
            Top             =   405
            Visible         =   0   'False
            Width           =   1635
         End
         Begin VB.Frame fra_ModifInfo 
            Caption         =   "Frame1"
            Height          =   375
            Index           =   8
            Left            =   90
            TabIndex        =   531
            Top             =   9180
            Width           =   9870
            Begin VB.TextBox txt_CreationDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   8
               Left            =   1170
               Locked          =   -1  'True
               TabIndex        =   535
               Tag             =   "Z_creation®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.TextBox txt_Creator 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   8
               Left            =   2835
               Locked          =   -1  'True
               TabIndex        =   534
               Tag             =   "U_login_creator®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_LastUpdDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   8
               Left            =   6120
               Locked          =   -1  'True
               TabIndex        =   533
               Tag             =   "Z_last_upd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.TextBox txt_UpdUser 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   8
               Left            =   7830
               Locked          =   -1  'True
               TabIndex        =   532
               Tag             =   "U_login_lastupd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   258
               Left            =   7380
               TabIndex        =   539
               Tag             =   "lbl_UpdUserBy"
               Top             =   45
               Width           =   375
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Last Updated"
               Height          =   240
               Index           =   257
               Left            =   4860
               TabIndex        =   538
               Tag             =   "lbl_LastUpdateDate"
               Top             =   45
               Width           =   1185
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   256
               Left            =   2430
               TabIndex        =   537
               Tag             =   "lbl_CreatorBy"
               Top             =   45
               Width           =   330
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Date Entered"
               Height          =   240
               Index           =   255
               Left            =   0
               TabIndex        =   536
               Tag             =   "lbl_CreationDate"
               Top             =   45
               Width           =   1095
            End
         End
         Begin VB.TextBox txt_Communication_Comments 
            Height          =   2190
            Left            =   225
            MaxLength       =   4000
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   62
            Tag             =   "COM_Comment®©Text"
            Text            =   "Comp_DB.ctx":018B
            Top             =   2970
            Width           =   9630
         End
         Begin VB.TextBox txt_Communication_Source 
            Height          =   345
            Left            =   1440
            MaxLength       =   75
            TabIndex        =   61
            Tag             =   "COM_Source®©Text"
            Text            =   "Text1"
            Top             =   1710
            Width           =   5445
         End
         Begin VB.TextBox txt_Communication_Web_Address 
            Height          =   345
            Left            =   1440
            MaxLength       =   100
            TabIndex        =   60
            Tag             =   "COM_WebAddrs®©Text"
            Text            =   "Text1"
            Top             =   1020
            Width           =   5445
         End
         Begin Project1.ArmCombobox cbo_Communication_Year 
            Height          =   345
            Left            =   1170
            TabIndex        =   58
            Tag             =   "COM_Year"
            Top             =   210
            Width           =   1365
            _ExtentX        =   2408
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Communication_Type 
            Height          =   345
            Left            =   4470
            TabIndex        =   59
            Tag             =   "COM_Type_code"
            Top             =   210
            Width           =   1365
            _ExtentX        =   2408
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare1_varchar"
            Height          =   285
            Index           =   251
            Left            =   6660
            TabIndex        =   553
            Tag             =   "lbl_Spare1"
            Top             =   900
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare2_varchar"
            Height          =   285
            Index           =   252
            Left            =   6705
            TabIndex        =   552
            Tag             =   "lbl_Spare2"
            Top             =   1710
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare3_real"
            Height          =   285
            Index           =   253
            Left            =   6705
            TabIndex        =   551
            Tag             =   "lbl_Spare3"
            Top             =   2475
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare4_real"
            Height          =   285
            Index           =   254
            Left            =   6660
            TabIndex        =   550
            Tag             =   "lbl_Spare4"
            Top             =   3285
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Comments"
            Height          =   240
            Index           =   264
            Left            =   225
            TabIndex        =   549
            Tag             =   "lbl_Comments"
            Top             =   2655
            Width           =   1005
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Source"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   263
            Left            =   240
            TabIndex        =   548
            Tag             =   "lbl_Source"
            Top             =   1770
            Width           =   1155
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Type"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   262
            Left            =   3450
            TabIndex        =   547
            Tag             =   "lbl_Type"
            Top             =   270
            Width           =   945
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Year"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   261
            Left            =   150
            TabIndex        =   546
            Tag             =   "lbl_Year"
            Top             =   270
            Width           =   945
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Web Address"
            Height          =   240
            Index           =   260
            Left            =   240
            TabIndex        =   545
            Tag             =   "lbl_Web_Address"
            Top             =   1080
            Width           =   1155
         End
      End
      Begin VB.Frame fra_record 
         Caption         =   "Production"
         Height          =   660
         Index           =   12
         Left            =   3840
         TabIndex        =   450
         Tag             =   "CD_Production"
         Top             =   3480
         Width           =   1380
         Begin VB.TextBox txt_Production_Comments 
            Height          =   2475
            Left            =   1410
            MaxLength       =   4000
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   26
            Tag             =   "PRD_Comments®©Text"
            Text            =   "Comp_DB.ctx":0191
            Top             =   5880
            Width           =   8415
         End
         Begin VB.Frame fra_ModifInfo 
            Caption         =   "Frame1"
            Height          =   375
            Index           =   12
            Left            =   90
            TabIndex        =   456
            Top             =   9180
            Width           =   9870
            Begin VB.TextBox txt_UpdUser 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   12
               Left            =   7830
               Locked          =   -1  'True
               TabIndex        =   460
               Tag             =   "U_login_lastupd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_LastUpdDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   12
               Left            =   6120
               Locked          =   -1  'True
               TabIndex        =   459
               Tag             =   "Z_last_upd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.TextBox txt_Creator 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   12
               Left            =   2835
               Locked          =   -1  'True
               TabIndex        =   458
               Tag             =   "U_login_creator®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_CreationDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   12
               Left            =   1170
               Locked          =   -1  'True
               TabIndex        =   457
               Tag             =   "Z_creation®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Date Entered"
               Height          =   240
               Index           =   425
               Left            =   0
               TabIndex        =   464
               Tag             =   "lbl_CreationDate"
               Top             =   45
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   426
               Left            =   2430
               TabIndex        =   463
               Tag             =   "lbl_CreatorBy"
               Top             =   45
               Width           =   330
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Last Updated"
               Height          =   240
               Index           =   427
               Left            =   4860
               TabIndex        =   462
               Tag             =   "lbl_LastUpdateDate"
               Top             =   45
               Width           =   1185
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   428
               Left            =   7380
               TabIndex        =   461
               Tag             =   "lbl_UpdUserBy"
               Top             =   45
               Width           =   375
            End
         End
         Begin VB.TextBox txt_key 
            Height          =   375
            Index           =   12
            Left            =   5130
            TabIndex        =   455
            Tag             =   "MKT_PRD_Key®©Num®©0"
            Text            =   "Text1"
            Top             =   225
            Visible         =   0   'False
            Width           =   1635
         End
         Begin VB.TextBox txt_Production_Source 
            Height          =   345
            Left            =   1410
            MaxLength       =   75
            TabIndex        =   27
            Tag             =   "PRD_Source®©Text"
            Text            =   "Text1"
            Top             =   8490
            Width           =   6375
         End
         Begin VB.TextBox txt_Production_Technology 
            Height          =   1725
            Left            =   1410
            MaxLength       =   4000
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   25
            Tag             =   "PRD_Tech®©Text"
            Text            =   "Comp_DB.ctx":0197
            Top             =   3810
            Width           =   8415
         End
         Begin VB.TextBox txt_Production_Capacity 
            Alignment       =   1  'Right Justify
            Height          =   345
            Left            =   1410
            MaxLength       =   13
            TabIndex        =   23
            Tag             =   "PRD_Cap®©Num®©0"
            Text            =   "9,999,999,999"
            Top             =   2970
            Width           =   1395
         End
         Begin VB.TextBox txt_Production_Location 
            Height          =   1845
            Left            =   1410
            MaxLength       =   500
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   21
            Tag             =   "PRD_Location®©Text"
            Text            =   "Comp_DB.ctx":019D
            Top             =   870
            Width           =   5295
         End
         Begin Project1.ArmCombobox cbo_Production_Year 
            Height          =   345
            Left            =   7650
            TabIndex        =   20
            Tag             =   "PRD_Year"
            Top             =   360
            Width           =   1365
            _ExtentX        =   2408
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Production_Type 
            Height          =   345
            Left            =   1410
            TabIndex        =   19
            Tag             =   "PRD_Type_code"
            Top             =   360
            Width           =   3030
            _ExtentX        =   5345
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Production_Country 
            Height          =   345
            Left            =   7650
            TabIndex        =   22
            Tag             =   "CT_Code"
            Top             =   960
            Width           =   2175
            _ExtentX        =   3836
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Production_Unit_of_Measure 
            Height          =   345
            Left            =   2880
            TabIndex        =   24
            Tag             =   "UM_Code"
            Top             =   2970
            Width           =   1785
            _ExtentX        =   3149
            _ExtentY        =   609
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   32
            Left            =   2475
            TabIndex        =   451
            Tag             =   "Spare1_varchar®©Text"
            Text            =   "Text1"
            Top             =   4995
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   33
            Left            =   2475
            TabIndex        =   452
            Tag             =   "Spare2_varchar®©Text"
            Text            =   "Text1"
            Top             =   5805
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   34
            Left            =   2475
            TabIndex        =   453
            Tag             =   "Spare3_real®©Num®©0"
            Text            =   "Text1"
            Top             =   6570
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   375
            Index           =   35
            Left            =   2430
            TabIndex        =   454
            Tag             =   "Spare4_real®©Num®©0"
            Text            =   "Text1"
            Top             =   7380
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Type"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   429
            Left            =   135
            TabIndex        =   472
            Tag             =   "lbl_Type"
            Top             =   405
            Width           =   1215
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Year"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   430
            Left            =   5850
            TabIndex        =   471
            Tag             =   "lbl_Year"
            Top             =   405
            Width           =   1755
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Country"
            Height          =   240
            Index           =   432
            Left            =   6795
            TabIndex        =   470
            Tag             =   "lbl_Country"
            Top             =   1035
            Width           =   780
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Comments"
            Height          =   240
            Index           =   435
            Left            =   120
            TabIndex        =   469
            Tag             =   "lbl_Comments"
            Top             =   5880
            Width           =   1215
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Source"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   436
            Left            =   90
            TabIndex        =   468
            Tag             =   "lbl_Source"
            Top             =   8550
            Width           =   1245
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Technology"
            Height          =   240
            Index           =   434
            Left            =   120
            TabIndex        =   467
            Tag             =   "lbl_Technology"
            Top             =   3840
            Width           =   1215
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Capacity"
            Height          =   240
            Index           =   433
            Left            =   90
            TabIndex        =   466
            Tag             =   "lbl_Capacity"
            Top             =   3030
            Width           =   1245
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Location"
            Height          =   240
            Index           =   431
            Left            =   120
            TabIndex        =   465
            Tag             =   "lbl_Location"
            Top             =   900
            Width           =   1215
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare4_real"
            Height          =   285
            Index           =   424
            Left            =   2430
            TabIndex        =   476
            Tag             =   "lbl_Spare4"
            Top             =   7155
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare3_real"
            Height          =   285
            Index           =   423
            Left            =   2475
            TabIndex        =   475
            Tag             =   "lbl_Spare3"
            Top             =   6345
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare2_varchar"
            Height          =   285
            Index           =   422
            Left            =   2475
            TabIndex        =   474
            Tag             =   "lbl_Spare2"
            Top             =   5580
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare1_varchar"
            Height          =   285
            Index           =   421
            Left            =   2430
            TabIndex        =   473
            Tag             =   "lbl_Spare1"
            Top             =   4770
            Visible         =   0   'False
            Width           =   3165
         End
      End
      Begin VB.Frame fra_record 
         Caption         =   "BusMod"
         Height          =   660
         Index           =   11
         Left            =   2040
         TabIndex        =   427
         Tag             =   "CD_BusinessModel"
         Top             =   4440
         Width           =   1380
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   36
            Left            =   6705
            TabIndex        =   441
            Tag             =   "Spare1_varchar®©Text"
            Text            =   "Text1"
            Top             =   1125
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   37
            Left            =   6705
            TabIndex        =   440
            Tag             =   "Spare2_varchar®©Text"
            Text            =   "Text1"
            Top             =   1935
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   38
            Left            =   6705
            TabIndex        =   439
            Tag             =   "Spare3_real®©Num®©0"
            Text            =   "Text1"
            Top             =   2700
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   375
            Index           =   39
            Left            =   6660
            TabIndex        =   438
            Tag             =   "Spare4_real®©Num®©0"
            Text            =   "Text1"
            Top             =   3510
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_key 
            Height          =   375
            Index           =   11
            Left            =   8190
            TabIndex        =   437
            Tag             =   "MKT_BM_Key®©Num®©0"
            Text            =   "Text1"
            Top             =   405
            Width           =   1635
         End
         Begin VB.Frame fra_ModifInfo 
            Caption         =   "Frame1"
            Height          =   375
            Index           =   11
            Left            =   90
            TabIndex        =   428
            Top             =   9180
            Width           =   9870
            Begin VB.TextBox txt_CreationDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   11
               Left            =   1170
               Locked          =   -1  'True
               TabIndex        =   432
               Tag             =   "Z_creation®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.TextBox txt_Creator 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   11
               Left            =   2835
               Locked          =   -1  'True
               TabIndex        =   431
               Tag             =   "U_login_creator®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_LastUpdDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   11
               Left            =   6120
               Locked          =   -1  'True
               TabIndex        =   430
               Tag             =   "Z_last_upd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.TextBox txt_UpdUser 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   11
               Left            =   7830
               Locked          =   -1  'True
               TabIndex        =   429
               Tag             =   "U_login_lastupd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   408
               Left            =   7380
               TabIndex        =   436
               Tag             =   "lbl_UpdUserBy"
               Top             =   45
               Width           =   375
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Last Updated"
               Height          =   240
               Index           =   407
               Left            =   4860
               TabIndex        =   435
               Tag             =   "lbl_LastUpdateDate"
               Top             =   45
               Width           =   1185
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   406
               Left            =   2430
               TabIndex        =   434
               Tag             =   "lbl_CreatorBy"
               Top             =   45
               Width           =   330
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Date Entered"
               Height          =   240
               Index           =   405
               Left            =   0
               TabIndex        =   433
               Tag             =   "lbl_CreationDate"
               Top             =   45
               Width           =   1095
            End
         End
         Begin VB.TextBox txt_BusMod_Source 
            Height          =   345
            Left            =   1320
            MaxLength       =   75
            TabIndex        =   30
            Tag             =   "MKT_BM_Source®©Text"
            Text            =   "Text1"
            Top             =   750
            Width           =   8535
         End
         Begin VB.TextBox txt_BusMod_Comment 
            Height          =   4905
            Left            =   195
            MaxLength       =   5000
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   31
            Tag             =   "MKT_BM_Comments®©Text"
            Text            =   "Comp_DB.ctx":01A3
            Top             =   1470
            Width           =   9720
         End
         Begin Project1.ArmCombobox cbo_BusMod_Year 
            Height          =   345
            Left            =   1200
            TabIndex        =   28
            Tag             =   "MKT_BM_Year"
            Top             =   210
            Width           =   1365
            _ExtentX        =   2408
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_BusMod_Type 
            Height          =   345
            Left            =   4500
            TabIndex        =   29
            Tag             =   "BM_Type_code"
            Top             =   210
            Width           =   2445
            _ExtentX        =   4313
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare1_varchar"
            Height          =   285
            Index           =   401
            Left            =   6660
            TabIndex        =   449
            Tag             =   "lbl_Spare1"
            Top             =   900
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare2_varchar"
            Height          =   285
            Index           =   402
            Left            =   6705
            TabIndex        =   448
            Tag             =   "lbl_Spare2"
            Top             =   1710
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare3_real"
            Height          =   285
            Index           =   403
            Left            =   6705
            TabIndex        =   447
            Tag             =   "lbl_Spare3"
            Top             =   2475
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare4_real"
            Height          =   285
            Index           =   404
            Left            =   6660
            TabIndex        =   446
            Tag             =   "lbl_Spare4"
            Top             =   3285
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Year"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   410
            Left            =   180
            TabIndex        =   445
            Tag             =   "lbl_Year"
            Top             =   270
            Width           =   945
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Type"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   411
            Left            =   3480
            TabIndex        =   444
            Tag             =   "lbl_Type"
            Top             =   270
            Width           =   945
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Source"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   412
            Left            =   120
            TabIndex        =   443
            Tag             =   "lbl_Source"
            Top             =   810
            Width           =   1155
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Comment"
            Height          =   240
            Index           =   413
            Left            =   150
            TabIndex        =   442
            Tag             =   "lbl_Comments"
            Top             =   1200
            Width           =   1005
         End
      End
      Begin VB.Frame fra_record 
         Caption         =   "Location"
         Height          =   660
         Index           =   10
         Left            =   360
         TabIndex        =   403
         Tag             =   "CD_Location"
         Top             =   4440
         Visible         =   0   'False
         Width           =   1380
         Begin VB.Frame fra_ModifInfo 
            Caption         =   "Frame1"
            Height          =   375
            Index           =   10
            Left            =   90
            TabIndex        =   409
            Top             =   9180
            Width           =   9870
            Begin VB.TextBox txt_UpdUser 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   10
               Left            =   7830
               Locked          =   -1  'True
               TabIndex        =   413
               Tag             =   "U_login_lastupd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_LastUpdDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   10
               Left            =   6120
               Locked          =   -1  'True
               TabIndex        =   412
               Tag             =   "Z_last_upd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.TextBox txt_Creator 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   10
               Left            =   2835
               Locked          =   -1  'True
               TabIndex        =   411
               Tag             =   "U_login_creator®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_CreationDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   10
               Left            =   1170
               Locked          =   -1  'True
               TabIndex        =   410
               Tag             =   "Z_creation®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Date Entered"
               Height          =   240
               Index           =   355
               Left            =   0
               TabIndex        =   417
               Tag             =   "lbl_CreationDate"
               Top             =   45
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   356
               Left            =   2430
               TabIndex        =   416
               Tag             =   "lbl_CreatorBy"
               Top             =   45
               Width           =   330
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Last Updated"
               Height          =   240
               Index           =   357
               Left            =   4860
               TabIndex        =   415
               Tag             =   "lbl_LastUpdateDate"
               Top             =   45
               Width           =   1185
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   358
               Left            =   7380
               TabIndex        =   414
               Tag             =   "lbl_UpdUserBy"
               Top             =   45
               Width           =   375
            End
         End
         Begin VB.TextBox txt_key 
            Height          =   375
            Index           =   10
            Left            =   8190
            TabIndex        =   408
            Tag             =   "MKT_LOC_Key®©Num®©0"
            Text            =   "Text1"
            Top             =   405
            Visible         =   0   'False
            Width           =   1635
         End
         Begin VB.TextBox txt_Spare 
            Height          =   375
            Index           =   23
            Left            =   6660
            TabIndex        =   407
            Tag             =   "Spare4_real®©Num®©0"
            Text            =   "Text1"
            Top             =   3510
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   22
            Left            =   6705
            TabIndex        =   406
            Tag             =   "Spare3_real®©Num®©0"
            Text            =   "Text1"
            Top             =   2700
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   21
            Left            =   6705
            TabIndex        =   405
            Tag             =   "Spare2_varchar®©Text"
            Text            =   "Text1"
            Top             =   1935
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   20
            Left            =   6705
            TabIndex        =   404
            Tag             =   "Spare1_varchar®©Text"
            Text            =   "Text1"
            Top             =   1125
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Location_Comment 
            Height          =   2490
            Left            =   210
            MaxLength       =   5000
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   36
            Tag             =   "ML_Comment®©Text"
            Text            =   "Comp_DB.ctx":01A9
            Top             =   4020
            Width           =   9675
         End
         Begin VB.TextBox txt_Location_Source 
            Height          =   345
            Left            =   1380
            MaxLength       =   75
            TabIndex        =   35
            Tag             =   "ML_Source®©Text"
            Text            =   "Text1"
            Top             =   3270
            Width           =   7395
         End
         Begin VB.TextBox txt_Location_HQ_Location 
            Height          =   2115
            Left            =   5190
            MaxLength       =   1000
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   34
            Tag             =   "MKT_Location®©Text"
            Text            =   "Comp_DB.ctx":01AF
            Top             =   840
            Width           =   4695
         End
         Begin VB.TextBox txt_Location_Owner 
            Height          =   2115
            Left            =   270
            MaxLength       =   1000
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   33
            Tag             =   "MKT_Owner®©Text"
            Text            =   "Comp_DB.ctx":01B5
            Top             =   840
            Width           =   4695
         End
         Begin Project1.ArmCombobox cbo_Location_Year 
            Height          =   345
            Left            =   8400
            TabIndex        =   32
            Tag             =   "MKT_LOC_year"
            Top             =   240
            Width           =   1365
            _ExtentX        =   2408
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare4_real"
            Height          =   285
            Index           =   354
            Left            =   6660
            TabIndex        =   426
            Tag             =   "lbl_Spare4"
            Top             =   3285
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare3_real"
            Height          =   285
            Index           =   353
            Left            =   6705
            TabIndex        =   425
            Tag             =   "lbl_Spare3"
            Top             =   2475
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare2_varchar"
            Height          =   285
            Index           =   352
            Left            =   6705
            TabIndex        =   424
            Tag             =   "lbl_Spare2"
            Top             =   1710
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare1_varchar"
            Height          =   285
            Index           =   351
            Left            =   6660
            TabIndex        =   423
            Tag             =   "lbl_Spare1"
            Top             =   900
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Comment"
            Height          =   240
            Index           =   360
            Left            =   120
            TabIndex        =   422
            Tag             =   "lbl_Comment"
            Top             =   3750
            Width           =   1005
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Source"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   362
            Left            =   180
            TabIndex        =   421
            Tag             =   "lbl_Source"
            Top             =   3330
            Width           =   1155
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Year"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   361
            Left            =   7380
            TabIndex        =   420
            Tag             =   "lbl_Year"
            Top             =   300
            Width           =   945
         End
         Begin VB.Label lbl_label 
            Caption         =   "#HQ Location"
            Height          =   240
            Index           =   363
            Left            =   5220
            TabIndex        =   419
            Tag             =   "lbl_HQ_Location"
            Top             =   570
            Width           =   1005
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Owner"
            Height          =   240
            Index           =   364
            Left            =   270
            TabIndex        =   418
            Tag             =   "lbl_Owner"
            Top             =   540
            Width           =   1005
         End
      End
      Begin VB.Frame fra_record 
         Caption         =   "Financial"
         Height          =   900
         Index           =   7
         Left            =   3960
         TabIndex        =   477
         Tag             =   "CD_Financial"
         Top             =   4800
         Width           =   1020
         Begin VB.Frame fra_ModifInfo 
            Caption         =   "Frame1"
            Height          =   375
            Index           =   7
            Left            =   90
            TabIndex        =   482
            Top             =   9180
            Width           =   9870
            Begin VB.TextBox txt_UpdUser 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   7
               Left            =   7830
               Locked          =   -1  'True
               TabIndex        =   486
               Tag             =   "U_login_lastupd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_LastUpdDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   7
               Left            =   6120
               Locked          =   -1  'True
               TabIndex        =   485
               Tag             =   "Z_last_upd®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.TextBox txt_Creator 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   7
               Left            =   2835
               Locked          =   -1  'True
               TabIndex        =   484
               Tag             =   "U_login_creator®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1995
            End
            Begin VB.TextBox txt_CreationDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   7
               Left            =   1170
               Locked          =   -1  'True
               TabIndex        =   483
               Tag             =   "Z_creation®©Text"
               Text            =   "Text1"
               Top             =   0
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Date Entered"
               Height          =   240
               Index           =   56
               Left            =   0
               TabIndex        =   490
               Tag             =   "lbl_CreationDate"
               Top             =   45
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   55
               Left            =   2430
               TabIndex        =   489
               Tag             =   "lbl_CreatorBy"
               Top             =   45
               Width           =   330
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Last Updated"
               Height          =   240
               Index           =   54
               Left            =   4860
               TabIndex        =   488
               Tag             =   "lbl_LastUpdateDate"
               Top             =   45
               Width           =   1185
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   22
               Left            =   7380
               TabIndex        =   487
               Tag             =   "lbl_UpdUserBy"
               Top             =   45
               Width           =   375
            End
         End
         Begin VB.TextBox txt_key 
            Height          =   375
            Index           =   7
            Left            =   270
            TabIndex        =   481
            Tag             =   "MKT_Fin_Key®©Num®©0"
            Text            =   "Text1"
            Top             =   855
            Visible         =   0   'False
            Width           =   1635
         End
         Begin VB.TextBox txt_Spare 
            Height          =   375
            Index           =   47
            Left            =   1215
            TabIndex        =   480
            Tag             =   "Spare4_real®©Num®©0"
            Text            =   "Text1"
            Top             =   6390
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   46
            Left            =   1215
            TabIndex        =   479
            Tag             =   "Spare3_real®©Num®©0"
            Text            =   "Text1"
            Top             =   5580
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   45
            Left            =   1215
            TabIndex        =   478
            Tag             =   "Spare2_varchar®©Text"
            Text            =   "Text1"
            Top             =   4815
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   44
            Left            =   1215
            TabIndex        =   74
            Tag             =   "Spare1_varchar®©Text"
            Text            =   "Text1"
            Top             =   4005
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Financial_Source 
            Height          =   345
            Left            =   4170
            MaxLength       =   75
            TabIndex        =   64
            Tag             =   "FIN_Source®©Text"
            Text            =   "Text1"
            Top             =   315
            Width           =   5655
         End
         Begin VB.TextBox txt_Financial_TurnOver 
            Alignment       =   1  'Right Justify
            Height          =   345
            Left            =   4170
            MaxLength       =   16
            TabIndex        =   65
            Tag             =   "FIN_TO®©Num®©0"
            Text            =   "-999,999,999,999"
            Top             =   720
            Width           =   1680
         End
         Begin VB.TextBox txt_Financial_Profit_Loss 
            Alignment       =   1  'Right Justify
            Height          =   345
            Left            =   4170
            MaxLength       =   16
            TabIndex        =   67
            Tag             =   "FIN_PL®©Num®©0"
            Text            =   "-999,999,999,999"
            Top             =   1125
            Width           =   1680
         End
         Begin VB.TextBox txt_Financial_Profit_Margin 
            Alignment       =   1  'Right Justify
            Height          =   345
            Left            =   4170
            MaxLength       =   7
            TabIndex        =   69
            Tag             =   "FIN_PM®©Num®©2"
            Text            =   "-100.00"
            Top             =   1515
            Width           =   1680
         End
         Begin VB.TextBox txt_Financial_Turnover_Euro 
            Alignment       =   1  'Right Justify
            BackColor       =   &H80000018&
            Height          =   345
            Left            =   4170
            TabIndex        =   72
            Tag             =   "FIN_TO_EURO®©Num®©0"
            Text            =   "Text1"
            Top             =   1905
            Width           =   1680
         End
         Begin VB.TextBox txt_Financial_Profit_Loss_Euro 
            Alignment       =   1  'Right Justify
            BackColor       =   &H80000018&
            Height          =   345
            Left            =   4170
            TabIndex        =   73
            Tag             =   "FIN_PL_Euro®©Num®©0"
            Text            =   "Text1"
            Top             =   2295
            Width           =   1680
         End
         Begin VB.TextBox txt_Financial_Number_of_Employees 
            Alignment       =   1  'Right Justify
            Height          =   345
            Left            =   4170
            MaxLength       =   7
            TabIndex        =   70
            Tag             =   "FIN_NumberEmpl®©Num®©0"
            Text            =   "999,999"
            Top             =   2685
            Width           =   1680
         End
         Begin Project1.ArmCombobox cbo_Financial_Fin_PL_Currency 
            Height          =   345
            Left            =   5895
            TabIndex        =   68
            Tag             =   "FIN_PL_CURR_code"
            Top             =   1125
            Width           =   3105
            _ExtentX        =   5477
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Financial_Fin_Currency 
            Height          =   345
            Left            =   5895
            TabIndex        =   66
            Tag             =   "FIN_TO_CURR_code"
            Top             =   720
            Width           =   3105
            _ExtentX        =   5477
            _ExtentY        =   609
         End
         Begin VB.TextBox txt_Financial_Comments 
            Height          =   3180
            Left            =   225
            MaxLength       =   4000
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   71
            Tag             =   "FIN_Comment®©Text"
            Text            =   "Comp_DB.ctx":01BB
            Top             =   3240
            Width           =   9675
         End
         Begin Project1.ArmCombobox cbo_Financial_Year 
            Height          =   345
            Left            =   1170
            TabIndex        =   63
            Tag             =   "FIN_Year"
            Top             =   285
            Width           =   1365
            _ExtentX        =   2408
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "%"
            Height          =   240
            Index           =   209
            Left            =   5970
            TabIndex        =   563
            Tag             =   "lbl_Profit_MarginPct"
            Top             =   1590
            Width           =   255
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare4_real"
            Height          =   285
            Index           =   204
            Left            =   1170
            TabIndex        =   503
            Tag             =   "lbl_Spare4"
            Top             =   6165
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare2_varchar"
            Height          =   285
            Index           =   202
            Left            =   1215
            TabIndex        =   501
            Tag             =   "lbl_Spare2"
            Top             =   4590
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare1_varchar"
            Height          =   285
            Index           =   201
            Left            =   1170
            TabIndex        =   500
            Tag             =   "lbl_Spare1"
            Top             =   3780
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Comment"
            Height          =   240
            Index           =   217
            Left            =   120
            TabIndex        =   499
            Tag             =   "lbl_Comments"
            Top             =   3000
            Width           =   1005
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Source"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   215
            Left            =   2910
            TabIndex        =   497
            Tag             =   "lbl_Source"
            Top             =   375
            Width           =   1155
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Turnover"
            Height          =   240
            Index           =   210
            Left            =   2910
            TabIndex        =   496
            Tag             =   "lbl_TurnOver"
            Top             =   810
            Width           =   1155
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Profit / Loss"
            Height          =   240
            Index           =   211
            Left            =   240
            TabIndex        =   495
            Tag             =   "lbl_Profit_Loss"
            Top             =   1215
            Width           =   3825
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Profit margin"
            Height          =   210
            Index           =   212
            Left            =   2910
            TabIndex        =   494
            Tag             =   "lbl_Profit_Margin"
            Top             =   1590
            Width           =   1155
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Turnover Converted to euros"
            Height          =   240
            Index           =   213
            Left            =   270
            TabIndex        =   493
            Tag             =   "lbl_Turnover_Euro"
            Top             =   1995
            Width           =   3795
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Profit / Loss Converted to euros"
            Height          =   240
            Index           =   214
            Left            =   240
            TabIndex        =   492
            Tag             =   "lbl_Profit_Loss_Euro"
            Top             =   2385
            Width           =   3825
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Number of Employees"
            Height          =   240
            Index           =   218
            Left            =   150
            TabIndex        =   491
            Tag             =   "lbl_Number_of_Employees"
            Top             =   2775
            Width           =   3915
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare3_real"
            Height          =   285
            Index           =   203
            Left            =   1215
            TabIndex        =   502
            Tag             =   "lbl_Spare3"
            Top             =   5355
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Year"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   216
            Left            =   150
            TabIndex        =   498
            Tag             =   "lbl_Year"
            Top             =   345
            Width           =   945
         End
      End
      Begin VB.Frame fra_record 
         Caption         =   "SWOT"
         Height          =   660
         Index           =   3
         Left            =   2040
         TabIndex        =   204
         Tag             =   "CD_SWOT"
         Top             =   6120
         Visible         =   0   'False
         Width           =   1380
         Begin VB.TextBox txt_SWOT_Source 
            Height          =   345
            Left            =   2295
            MaxLength       =   75
            TabIndex        =   100
            Tag             =   "Swot_Source®©Text"
            Text            =   "Text1"
            Top             =   480
            Width           =   7545
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   24
            Left            =   6705
            TabIndex        =   218
            Tag             =   "Spare1_varchar®©Text"
            Text            =   "Text1"
            Top             =   1125
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   25
            Left            =   6705
            TabIndex        =   217
            Tag             =   "Spare2_varchar®©Text"
            Text            =   "Text1"
            Top             =   1935
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   420
            Index           =   26
            Left            =   6705
            TabIndex        =   216
            Tag             =   "Spare3_real®©Num®©0"
            Text            =   "Text1"
            Top             =   2700
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_Spare 
            Height          =   375
            Index           =   27
            Left            =   6660
            TabIndex        =   215
            Tag             =   "Spare4_real®©Num®©0"
            Text            =   "Text1"
            Top             =   3510
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.TextBox txt_key 
            Height          =   375
            Index           =   3
            Left            =   8190
            TabIndex        =   214
            Tag             =   "MKT_SWOT_Key®©Num®©0"
            Text            =   "Text1"
            Top             =   405
            Visible         =   0   'False
            Width           =   1635
         End
         Begin VB.Frame fra_ModifInfo 
            Height          =   645
            Index           =   3
            Left            =   90
            TabIndex        =   205
            Top             =   8910
            Width           =   9810
            Begin VB.TextBox txt_CreationDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   3
               Left            =   1200
               Locked          =   -1  'True
               TabIndex        =   209
               Tag             =   "Z_creation®©Text"
               Text            =   "Text1"
               Top             =   210
               Width           =   1095
            End
            Begin VB.TextBox txt_Creator 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   3
               Left            =   2805
               Locked          =   -1  'True
               TabIndex        =   208
               Tag             =   "U_login_creator®©Text"
               Text            =   "Text1"
               Top             =   210
               Width           =   1905
            End
            Begin VB.TextBox txt_LastUpdDate 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   3
               Left            =   6090
               Locked          =   -1  'True
               TabIndex        =   207
               Tag             =   "Z_last_upd®©Text"
               Text            =   "Text1"
               Top             =   210
               Width           =   1095
            End
            Begin VB.TextBox txt_UpdUser 
               Alignment       =   2  'Center
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   3
               Left            =   7800
               Locked          =   -1  'True
               TabIndex        =   206
               Tag             =   "U_login_lastupd®©Text"
               Text            =   "Text1"
               Top             =   210
               Width           =   1905
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   41
               Left            =   7380
               TabIndex        =   213
               Tag             =   "lbl_UpdUserBy"
               Top             =   255
               Width           =   375
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Last Updated"
               Height          =   240
               Index           =   40
               Left            =   4830
               TabIndex        =   212
               Tag             =   "lbl_LastUpdateDate"
               Top             =   255
               Width           =   1185
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#By"
               Height          =   240
               Index           =   39
               Left            =   2400
               TabIndex        =   211
               Tag             =   "lbl_CreatorBy"
               Top             =   255
               Width           =   330
            End
            Begin VB.Label lbl_label 
               Alignment       =   1  'Right Justify
               Caption         =   "#Date Entered"
               Height          =   240
               Index           =   38
               Left            =   30
               TabIndex        =   210
               Tag             =   "lbl_CreationDate"
               Top             =   255
               Width           =   1095
            End
         End
         Begin VB.TextBox txt_SWOT_Strength 
            Height          =   3600
            Left            =   150
            MaxLength       =   2000
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   101
            Tag             =   "Swot_S®©Text"
            Text            =   "Comp_DB.ctx":01C1
            Top             =   1245
            Width           =   4785
         End
         Begin VB.TextBox txt_SWOT_Weakness 
            Height          =   3600
            Left            =   5070
            MaxLength       =   2000
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   102
            Tag             =   "Swot_W®©Text"
            Text            =   "Comp_DB.ctx":01C7
            Top             =   1245
            Width           =   4785
         End
         Begin VB.TextBox txt_SWOT_Opportunity 
            Height          =   3600
            Left            =   150
            MaxLength       =   2000
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   103
            Tag             =   "Swot_O®©Text"
            Text            =   "Comp_DB.ctx":01CD
            Top             =   5310
            Width           =   4785
         End
         Begin VB.TextBox txt_SWOT_Threat 
            Height          =   3600
            Left            =   5070
            MaxLength       =   2000
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   104
            Tag             =   "Swot_T®©Text"
            Text            =   "Comp_DB.ctx":01D3
            Top             =   5310
            Width           =   4785
         End
         Begin Project1.ArmCombobox cbo_SWOT_Year 
            Height          =   345
            Left            =   210
            TabIndex        =   99
            Tag             =   "Swot_Year"
            Top             =   480
            Width           =   1065
            _ExtentX        =   1879
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Source"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   51
            Left            =   2295
            TabIndex        =   219
            Tag             =   "lbl_Source"
            Top             =   225
            Width           =   885
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare1_varchar"
            Height          =   285
            Index           =   45
            Left            =   6660
            TabIndex        =   228
            Tag             =   "lbl_Spare1"
            Top             =   900
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare2_varchar"
            Height          =   285
            Index           =   44
            Left            =   6705
            TabIndex        =   227
            Tag             =   "lbl_Spare2"
            Top             =   1710
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare3_real"
            Height          =   285
            Index           =   43
            Left            =   6705
            TabIndex        =   226
            Tag             =   "lbl_Spare3"
            Top             =   2475
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Spare4_real"
            Height          =   285
            Index           =   42
            Left            =   6660
            TabIndex        =   225
            Tag             =   "lbl_Spare4"
            Top             =   3285
            Visible         =   0   'False
            Width           =   3165
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Year"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Index           =   49
            Left            =   210
            TabIndex        =   224
            Tag             =   "lbl_Year"
            Top             =   210
            Width           =   1755
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Strength"
            Height          =   240
            Index           =   50
            Left            =   135
            TabIndex        =   223
            Tag             =   "lbl_Strength"
            Top             =   975
            Width           =   1005
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Weakness"
            Height          =   240
            Index           =   46
            Left            =   5070
            TabIndex        =   222
            Tag             =   "lbl_Weakness"
            Top             =   975
            Width           =   1005
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Opportunity"
            Height          =   240
            Index           =   47
            Left            =   135
            TabIndex        =   221
            Tag             =   "lbl_Opportunity"
            Top             =   5010
            Width           =   1005
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Threat"
            Height          =   240
            Index           =   48
            Left            =   5070
            TabIndex        =   220
            Tag             =   "lbl_Threat"
            Top             =   5010
            Width           =   1005
         End
      End
      Begin Project1.ToolbarControl tlb_item 
         Height          =   9690
         Left            =   10260
         TabIndex        =   124
         Top             =   315
         Width           =   690
         _ExtentX        =   1217
         _ExtentY        =   17092
      End
      Begin VB.Label lbl_ItemTitle 
         Caption         =   "Title"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   238
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   270
         Left            =   120
         TabIndex        =   156
         Tag             =   "Title"
         Top             =   165
         Visible         =   0   'False
         Width           =   10065
      End
   End
   Begin VB.Frame fra_detail 
      Caption         =   "Detail"
      Height          =   10455
      Left            =   1800
      TabIndex        =   120
      Tag             =   "CD_Detail"
      Top             =   120
      Visible         =   0   'False
      Width           =   11115
      Begin VB.Frame fra_ModifInfo 
         Caption         =   "Frame1"
         Height          =   375
         Index           =   13
         Left            =   120
         TabIndex        =   568
         Top             =   3240
         Visible         =   0   'False
         Width           =   9855
         Begin VB.TextBox txt_CreationDate 
            Alignment       =   2  'Center
            BackColor       =   &H8000000F&
            Height          =   330
            Index           =   13
            Left            =   1170
            Locked          =   -1  'True
            TabIndex        =   572
            Tag             =   "Z_creation®©Text"
            Text            =   "Text1"
            Top             =   0
            Width           =   1095
         End
         Begin VB.TextBox txt_Creator 
            Alignment       =   2  'Center
            BackColor       =   &H8000000F&
            Height          =   330
            Index           =   13
            Left            =   2835
            Locked          =   -1  'True
            TabIndex        =   571
            Tag             =   "U_login_creator®©Text"
            Text            =   "Text1"
            Top             =   0
            Width           =   1860
         End
         Begin VB.TextBox txt_LastUpdDate 
            Alignment       =   2  'Center
            BackColor       =   &H8000000F&
            Height          =   330
            Index           =   13
            Left            =   6120
            Locked          =   -1  'True
            TabIndex        =   570
            Tag             =   "Z_last_upd®©Text"
            Text            =   "Text1"
            Top             =   0
            Width           =   1095
         End
         Begin VB.TextBox txt_UpdUser 
            Alignment       =   2  'Center
            BackColor       =   &H8000000F&
            Height          =   330
            Index           =   13
            Left            =   7800
            Locked          =   -1  'True
            TabIndex        =   569
            Tag             =   "U_login_lastupd®©Text"
            Text            =   "Text1"
            Top             =   0
            Width           =   1935
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#By"
            Height          =   240
            Index           =   63
            Left            =   7320
            TabIndex        =   576
            Tag             =   "lbl_UpdUserBy"
            Top             =   45
            Width           =   375
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Last Updated"
            Height          =   240
            Index           =   62
            Left            =   4800
            TabIndex        =   575
            Tag             =   "lbl_LastUpdateDate"
            Top             =   45
            Width           =   1185
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#By"
            Height          =   240
            Index           =   61
            Left            =   2430
            TabIndex        =   574
            Tag             =   "lbl_CreatorBy"
            Top             =   45
            Width           =   330
         End
         Begin VB.Label lbl_label 
            Alignment       =   1  'Right Justify
            Caption         =   "#Date Entered"
            Height          =   240
            Index           =   60
            Left            =   0
            TabIndex        =   573
            Tag             =   "lbl_CreationDate"
            Top             =   45
            Width           =   1095
         End
      End
      Begin MSComctlLib.TabStrip tbs_selector 
         Height          =   855
         Index           =   0
         Left            =   120
         TabIndex        =   144
         Tag             =   "tbs_Country"
         Top             =   240
         Width           =   7755
         _ExtentX        =   13679
         _ExtentY        =   1508
         TabWidthStyle   =   2
         MultiRow        =   -1  'True
         Style           =   1
         ShowTips        =   0   'False
         TabFixedWidth   =   2646
         TabFixedHeight  =   706
         _Version        =   393216
         BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
            NumTabs         =   9
            BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#General"
               Object.Tag             =   "CD_General"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab2 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Channel"
               Object.Tag             =   "CD_Channel"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab3 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Communication"
               Object.Tag             =   "CD_Communication"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab4 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Financial"
               Object.Tag             =   "CD_Financial_C"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab5 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Products"
               Object.Tag             =   "CD_Products_C"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab6 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Sales Est."
               Object.Tag             =   "CD_SalesEst_C"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab7 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Sales Org."
               Object.Tag             =   "CD_SalesOrg_C"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab8 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Services"
               Object.Tag             =   "CD_Services"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab9 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#SWOT"
               Object.Tag             =   "CD_SWOT"
               ImageVarType    =   2
            EndProperty
         EndProperty
      End
      Begin Project1.ArmGrid grd_detail1 
         Height          =   2970
         Left            =   105
         TabIndex        =   126
         Tag             =   "grd_detail1"
         Top             =   3420
         Width           =   10065
         _ExtentX        =   17754
         _ExtentY        =   5239
      End
      Begin Project1.ArmGrid grd_detail2 
         Height          =   3645
         Left            =   90
         TabIndex        =   127
         Tag             =   "grd_detail2"
         Top             =   6480
         Width           =   10065
         _ExtentX        =   17754
         _ExtentY        =   6429
      End
      Begin Project1.ToolbarControl tlb_detail 
         Height          =   9960
         Left            =   10305
         TabIndex        =   123
         Top             =   225
         Width           =   690
         _ExtentX        =   1217
         _ExtentY        =   17568
      End
      Begin VB.TextBox txt_DetailGeneral_comment 
         BackColor       =   &H80000018&
         Height          =   1350
         Left            =   90
         Locked          =   -1  'True
         MaxLength       =   4000
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   129
         Tag             =   "Master_Comment"
         Text            =   "Comp_DB.ctx":01D9
         Top             =   1800
         Width           =   10065
      End
      Begin MSComctlLib.TabStrip tbs_selector 
         Height          =   855
         Index           =   1
         Left            =   120
         TabIndex        =   130
         Tag             =   "tbs_Strat"
         Top             =   240
         Width           =   7800
         _ExtentX        =   13758
         _ExtentY        =   1508
         TabWidthStyle   =   2
         MultiRow        =   -1  'True
         Style           =   1
         ShowTips        =   0   'False
         TabFixedWidth   =   2646
         TabFixedHeight  =   706
         _Version        =   393216
         BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
            NumTabs         =   10
            BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#General"
               Object.Tag             =   "CD_General"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab2 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Business Model"
               Object.Tag             =   "CD_BusinessModel"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab3 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Communication"
               Object.Tag             =   "CD_Communication"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab4 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Financial"
               Object.Tag             =   "CD_Financial_S"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab5 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Location"
               Object.Tag             =   "CD_Location"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab6 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Production"
               Object.Tag             =   "CD_Production"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab7 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Products"
               Object.Tag             =   "CD_Products_S"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab8 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Sales Est."
               Object.Tag             =   "CD_SalesEst_S"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab9 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Sales Org."
               Object.Tag             =   "CD_SalesOrg_S"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab10 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#SWOT"
               Object.Tag             =   "CD_SWOT"
               ImageVarType    =   2
            EndProperty
         EndProperty
      End
      Begin VB.Label lbl_label 
         Caption         =   "#General - Comments"
         Height          =   285
         Index           =   28
         Left            =   105
         TabIndex        =   164
         Tag             =   "lbl_DetailGenComment"
         Top             =   1530
         Width           =   7170
      End
      Begin VB.Label lbl_DetailTitle 
         Caption         =   "Title"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   238
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   240
         Left            =   135
         TabIndex        =   131
         Top             =   1260
         Width           =   10020
      End
   End
End
Attribute VB_Name = "Comp_DB"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwnd As Long) As Long


Private Const SCREEN_NAME As String = "COMP_DB"

Private Const SEP As String = "®©"
Private Const SEP1 As String = "®"
Private Const SEP2 As String = "©"

Const CL_COLOR_ENABLED As Long = &H80000005
Const CL_COLOR_DISABLED As Long = &H8000000F
Const CL_COLOR_LOCKED As Long = &H80000018
Const C_ERRORRAISE As Long = 2500

Private Const LOCALE_USER_DEFAULT = &H400

Public Event quit()

#If LIVE Then
    Private mo_Db                   As Object
#Else
    Private mo_Db                   As ArmDb
#End If

Private mo_FSO                      As Object

Private ms_TempPath                 As String

Private mb_Initialized              As Boolean
Private ms_LoginName                As String
Private ms_Language_Code           As String
Private ml_UCode                    As Long

Private ms_DecimalSeparator  As String
Private ms_ThousandSeparator As String


Private Type TConfigRecord
    IndexFrame                      As Long
    NameFrame                       As String
    IndexClassAtt                   As Long
    Initialized                     As Boolean
    ExistAttach                     As Boolean
    RequestView                     As String
    RequestAdd                      As String
    RequestUpd                      As String
    RequestDel                      As String
    RequestCheck                    As String
    RequestCheckDelete              As String
    TableName                       As String
    ListFieldsToDisable             As Variant
    ListFieldsMandatory             As Variant
    ListFieldsDefaultValue          As Variant
    DeleteMsg(0, 1)                 As String
    UpdateMsg(0, 1)                 As String
    CheckMsg(0, 1)                  As String
    CheckDelMsg(0, 1)               As String
End Type

Private Type TConfigGrid
    Visible                         As Boolean
    Request                         As String
    Columns()                       As String
    Labels                          As String
End Type

Private Type TConfigDetail
    FaceToolbar                     As String
    ConfigGrid(3)                   As TConfigGrid ' if request = "" -> grid not used
End Type

Private Type TClassInfo
    ConfigDetail                    As TConfigDetail
    ConfigRecord                    As TConfigRecord
End Type
Private mt_ClassInfoLst() As TClassInfo

Private Type TRect
    top As Long
    left As Long
    Width As Long
    Height As Long
End Type
Private Zone_Client As TRect


Private Enum eMode
    emList = 0
    emDetail = 1
    emView = 2
    emAdd = 3
    emUpdate = 4
    emDelete = 5
    emAgg = 6
    emCopy = 7
End Enum

Private me_Mode                     As eMode
Private me_OldMode                  As eMode

Private mb_internal                 As Boolean
Private mb_internalFin                 As Boolean

Private ml_tbsidx                   As Long
Private ml_CurrentKey               As Long
Private ml_MasterKey                As Long
Private ml_SubItemKey               As Long
Private ml_Cursor                   As Long
Private ml_Cursor_SubItem           As Long

Private mb_IsUpdater                As Boolean
Private mb_IsStrategic              As Boolean
Private mb_ChangeSubItemNbFromat    As Boolean

Private Type TTreeViewInfo
    Levels As Long
    NodeRequest() As String
    GridRequest() As String
    ExcelRequest() As String
    CountRequest() As String
    FindRequest() As String
    Images() As Integer
    SelectedImages() As Integer
    TreeViewCode As String
    Loaded As Boolean
End Type
Private mTreeViewInfos() As TTreeViewInfo

' Treeview has difficulties to manage properly the checkboxes
' NodeCheck then NodeClick
' NodeCheck is raised only for the one checked but the request are only available when the ancestor are checked... AFTER THE EVENT BY THE TV
' Only way is to all job in NodeClick but use this flag to know if it's a check (that do job) or a click (that do nothing)
Private mb_TvwAfterCheck As Boolean
Private mb_TVCmdReloadShow As Boolean    ' it's not safe to take decision with .Visible


' The different way to select data in the treeview
Private Enum eTvwSelMethod
    etmNode = 0         ' User click on the last node of a branch
    etmBranch = 1       ' User click on a branch and use the load button
    etmCheckBoxes = 2   ' User click on the load button when checkboxes mode is set
End Enum
Private me_CurrentTvwSelMethod  As eTvwSelMethod

Private Declare Function GetLocaleInfo Lib "Kernel32" Alias "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long
Private Declare Function GetSystemDefaultLCID Lib "Kernel32" () As Long

Private Const LOCALE_SDECIMAL = &HE ' Decimal separator
Private Const LOCALE_STHOUSAND = &HF ' Thousand separator

Private Enum ArmErr
    DBCnxFailed = C_ERRORRAISE + 1             ' Unable to connect to the database
    CPTAlreadyInitialized = C_ERRORRAISE + 2   ' We try to initialize a component that is already initialized
    CPTNotInitialized = C_ERRORRAISE + 3       ' We try to use or free that is not initialized yet
    InvalidArgument = C_ERRORRAISE + 4
    PropertyNotSet = C_ERRORRAISE + 5
    SQLFailure = C_ERRORRAISE + 6               ' A SQL runtime error has occured : syntax wrong....
    SQLBadRowAffectedCount = C_ERRORRAISE + 7   ' A SQL request has not affected the expected rowcount (ex: one Update do nothing)
    SQLBadRowExpectedCount = C_ERRORRAISE + 8   ' A SQL request does not return the expected rowcount : select an item return nothing...
    DrivingError = C_ERRORRAISE + 9
    CompFncFailed = C_ERRORRAISE + 10           ' when component function fail
    GridLoadFailed = C_ERRORRAISE + 11          ' load function failed ... bad sql
End Enum

Private Enum ArmCusErr
    DuplicityDetected = C_ERRORRAISE + 2301                ' detected row with same unique id
End Enum

Private Function CheckNumericField(ByVal ao_value As TextBox, ByVal ai_NbDecimal As Integer, ByVal av_Min As Variant, ByVal av_Max As Variant) As Long
On Error GoTo errHandler
    Dim ls_Value As Variant
    
    ls_Value = Replace(Trim(ao_value.Text), ".", ms_DecimalSeparator, , , vbTextCompare)
    
    On Error Resume Next
    Dim ld_Number As Double
    Dim ll_errnum As Long
    ld_Number = CDbl(ls_Value)
    ll_errnum = Err.Number
    Err.Clear
    On Error GoTo errHandler
    If ll_errnum <> 0 Then
        CheckNumericField = 2131
        GoTo BackToControl
    End If

    
    If ai_NbDecimal = 0 And InStr(1, ls_Value, ms_DecimalSeparator) Then
        CheckNumericField = 2134
        GoTo BackToControl
    End If
    
    If Not (ld_Number >= av_Min And ld_Number <= av_Max) Then
        CheckNumericField = 2132
        GoTo BackToControl
    End If

    ao_value.Text = ls_Value
    CheckNumericField = 0
    
    Exit Function

BackToControl:
    ao_value.SelStart = 0
    ao_value.SelLength = Len(ao_value.Text)
    If ao_value.Visible Then ao_value.SetFocus
    
    Exit Function

errHandler:
    Call ErrorHandler("CheckNumericField")
   
End Function


#If LIVE Then
Public Property Set Db(ByRef aDb As Object)
#Else
Public Property Set Db(ByRef aDb As ArmDb)
#End If
    Set mo_Db = aDb
End Property

Public Property Get Initialized() As Boolean
    Initialized = mb_Initialized
End Property



Private Function Item_CheckDelete(ByVal al_InfoArrayIndex As Long) As Boolean

On Error GoTo errHandler
    
    Dim ls_check_request As String
    Dim ll_Curs As Long
    Dim li_Count As Integer
    
    ls_check_request = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.RequestCheckDelete
    If ls_check_request = "" Then
        Item_CheckDelete = True
        Exit Function
    End If
    
    ls_check_request = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.RequestCheckDelete
    ls_check_request = Replace(ls_check_request, "$MKT_Key$", ml_MasterKey, , , vbTextCompare)
    ls_check_request = Replace(ls_check_request, "$Language_code$", ms_Language_Code, , , vbTextCompare)
    ls_check_request = Replace(ls_check_request, "$Key$", ml_CurrentKey)

    
    ' THIS IS NOT AN ERROR
    ' WE CHECK IS USER IS ALLOWED TO DELETE THIS DATA
    ' A DATA CAN'T BE DELETE IF IT HAVE SOME DEPENDANCIES, LIKE ATTACHMENT
    ' Li_Count is the count of dependancies
    ll_Curs = OpenSQLSafe(mo_Db, ls_check_request)
    li_Count = mo_Db.RowCount(ll_Curs)
    mo_Db.Close (ll_Curs)
    If li_Count > 0 Then
        MsgBox MsgText(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.CheckDelMsg(0, 0), ms_Language_Code, mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.CheckDelMsg(0, 1)), vbInformation + vbOKOnly
        Item_CheckDelete = False
        Exit Function
    End If
            
    Item_CheckDelete = True
    
    Exit Function

errHandler:
    mo_Db.Close (ll_Curs)
    Call ErrorHandler("Item_CheckDelete")
    
End Function

Public Property Let LoginName(ByVal aLoginName As String)
    ms_LoginName = aLoginName
End Property

Public Property Let Ucode(ByVal aUcode As Long)
    ml_UCode = aUcode
End Property


Public Property Let Language_Code(ByVal aLanguage_Code As String)
    ms_Language_Code = aLanguage_Code
End Property

Public Property Let Visible(ByVal aVisible As Boolean)
    UserControl.Extender.Visible = aVisible
End Property
Public Property Get Visible() As Boolean
    Visible = UserControl.Extender.Visible
End Property

Public Sub Move(ByVal aLeft As Single, ByVal aTop As Single, ByVal aWidth As Single, ByVal aHeight As Single)
    Call UserControl.Extender.Move(aLeft, aTop, aWidth, aHeight)
End Sub



Private Function HaveRight(ByVal as_Right As String) As Boolean

On Error GoTo errHandler
    Dim mb_Ok As Boolean
    
    mb_Ok = False
    Dim lc_Data As Long
    
    Select Case as_Right
        Case "COMP_DB_UPD"
            lc_Data = OpenSQLSafe(mo_Db, "SELECT CFG_Value FROM A_Config WHERE CFG_Key = '" & as_Right & "'")
        Case "COMP_DB_STRA"
            Dim aa As String
            lc_Data = OpenSQLSafe(mo_Db, "SELECT U_Code FROM MKT_Authorised_Users WHERE U_Code = " & ml_UCode & " AND Strat_Country = 'X'")
    End Select
    
    Dim lv_ArrUpd As Variant
    lv_ArrUpd = Split(mo_Db.GetFields(lc_Data, 0) & SEP, SEP, , vbTextCompare)
    mo_Db.Close (lc_Data)
    Dim ll_Idx As Long, ll_Count As Long
    ll_Count = UBound(lv_ArrUpd)
    For ll_Idx = 0 To ll_Count
        If lv_ArrUpd(ll_Idx) = ml_UCode Then
            mb_Ok = True
            Exit For
        End If
    Next
    HaveRight = mb_Ok

    Exit Function

errHandler:
    mo_Db.Close (lc_Data)
    Call ErrorHandler("HaveRight")

End Function



Public Function Load_A_Com() As Boolean

On Error GoTo errHandler

    If mb_Initialized Then Exit Function
    
    Call LockScreen(True)
    
    Dim ls_TrueLanguage As String
    ls_TrueLanguage = ms_Language_Code
    ms_Language_Code = "E"   ' Competitive is only english system
    

    Dim sBuffer As String
    Dim nBufferLen As Long
    Dim LCID As Long

    LCID = GetSystemDefaultLCID
    
    ms_DecimalSeparator = Format(0, ".")

    nBufferLen = 255
    sBuffer = String$(nBufferLen, vbNullChar)
    nBufferLen = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, sBuffer, nBufferLen)
    If nBufferLen > 0 Then
        ms_ThousandSeparator = left$(sBuffer, nBufferLen - 1)
    End If
    
    mb_IsUpdater = HaveRight("COMP_DB_UPD")
    If Not mb_IsUpdater Then
        mb_IsStrategic = HaveRight("COMP_DB_STRA")
    Else
        mb_IsStrategic = True
    End If
    
    Set mo_FSO = CreateObject("Scripting.FileSystemObject")
    ms_TempPath = App.Path & "\Download\"
    
    'hide all the frames
    fra_filter.Visible = False
    fra_list.Visible = False
    fra_detail.Visible = False
    fra_item.Visible = False
    
    cmd_TVReLoad.Visible = True
    cmd_TVReLoad.Picture = LoadResPicture(61, vbResIcon)
    
    'Initialize Components
    Call InitComponents
    
    Call InitCtrlSize

    'check if db and language are initialized
    Call Load_ClassInfo
         
    fra_filter.Visible = True
    fra_filter.ZOrder
    
    fra_list.Visible = True
    fra_list.ZOrder
    
    me_OldMode = emList
    me_Mode = emList
    
    fra_CompetitorType.Visible = mb_IsStrategic
    opt_General_Strat_Flag(0).Visible = mb_IsStrategic
    opt_General_Strat_Flag(1).Visible = mb_IsStrategic
    
    Call fra_Disclaimer.Move(120, 120, UserControl.Width - 240, UserControl.Height - 240)
    
    Dim ll_left As Long, ll_top As Long
    
    ll_top = fra_Disclaimer.Height - cmd_DisclaimerYes.Height - 120
    ll_left = (fra_Disclaimer.Width / 2) - cmd_DisclaimerYes.Width - 120
    
    Call cmd_DisclaimerYes.Move(ll_left, ll_top)
    ll_left = (fra_Disclaimer.Width / 2) + 120
    Call cmd_DisclaimerNo.Move(ll_left, ll_top)
    
    Call txt_Disclaimer.Move(120, 240, fra_Disclaimer.Width - 240, cmd_DisclaimerYes.top - 360)
    
    Call LoadAllLabels
    Call LoadLabels(UserControl.Controls, fra_Disclaimer, SCREEN_NAME & "_" & fra_Disclaimer.Tag, ls_TrueLanguage)
    Call OnFilterChange
    
    fra_Disclaimer.Visible = True
    fra_Disclaimer.ZOrder

    
    LockScreen (False)
    
    mb_Initialized = True
    
    Load_A_Com = True
    
    Exit Function

errHandler:
    LockScreen (False)
    Call ErrorHandler("Load_A_Com")

End Function



Private Sub InitComponents()

On Error GoTo errHandler

    Const CL_REQUEST_TB As String = "SELECT Toolbar_Info FROM Toolbars_Users WHERE User_Code=$user_id$"
    

    Dim ls_Toolbar_Info As String
    Dim lCursTB As Long
    
    'load design toolbars. If you want load user specific toolbars replace 0 for real user id
'    lCursTB = mo_Db.OpenSQL(Replace(CL_REQUEST_TB, "$user_id$", 0))
    lCursTB = OpenSQLSafe(mo_Db, Replace(CL_REQUEST_TB, "$user_id$", 0))
    
    ls_Toolbar_Info = mo_Db.GetFields(lCursTB, "toolbar_info")
    Call mo_Db.Close(lCursTB)
    
    Call tlb_list.Load_A_Com
    tlb_list.Language = "E"
    Call tlb_list.SetToolbarInfoStringParameters(ls_Toolbar_Info, "014")
    Call HandleToolbar(tlb_list, "0", mb_IsUpdater)
    
            
    Call tlb_detail.Load_A_Com
    tlb_detail.Language = "E"
    Call tlb_detail.SetToolbarInfoStringParameters(ls_Toolbar_Info, "024")
    Call HandleToolbar(tlb_detail, "0", mb_IsUpdater)
    
    Call tlb_item.Load_A_Com
    tlb_item.Language = "E"
    Call tlb_item.SetToolbarInfoStringParameters(ls_Toolbar_Info, "025")
    Call HandleToolbar(tlb_item, "0", mb_IsUpdater)
    
    Call tlb_Attachments.Load_A_Com
    tlb_Attachments.Language = "E"
    Call tlb_Attachments.SetToolbarInfoStringParameters(ls_Toolbar_Info, "020")
    Call HandleToolbar(tlb_Attachments, "0", mb_IsUpdater)
    
    Call tlb_SalesReps.Load_A_Com
    tlb_SalesReps.Language = "E"
    Call tlb_SalesReps.SetToolbarInfoStringParameters(ls_Toolbar_Info, "022")
    Call HandleToolbar(tlb_SalesReps, "0", mb_IsUpdater)
    
    Call tlb_Products.Load_A_Com
    tlb_Products.Language = "E"
    Call tlb_Products.SetToolbarInfoStringParameters(ls_Toolbar_Info, "021")
    Call HandleToolbar(tlb_Products, "0", mb_IsUpdater)
    
' Filters components -> option + calendar + combo
    mb_internal = True
    Opt_FiltersType.Item(0).value = True
    tbs_selector(0).Tabs(1).Selected = True
    tbs_selector(1).Tabs(1).Selected = True
        
    cal_FiltersMin.Language = ms_Language_Code
    cal_FiltersMin.ZOrder
    cal_filtersMax.Language = ms_Language_Code
    cal_filtersMax.ZOrder
    
    Set cbo_FiltersDate.ArmDb = mo_Db
    cbo_FiltersDate.Load_A_Com
    cbo_FiltersDate.Request = "exec captv_date_cbo '" & SCREEN_NAME & "','" & ms_Language_Code & "'"
    cbo_FiltersDate.Load
    cbo_FiltersDate.SearchItem "1", 2, 0
    
    opt_FiltersDate.Item(0).value = True
    Call SelectDateFilters(0)

    mb_internal = False
    
    cmd_TVReLoad.Visible = False

'Grids
    Set grd_List.ArmDb = mo_Db
    grd_List.Load_A_Com
    grd_List.AllowExcelExport = True
    grd_List.ExportTitles = True
    grd_List.MultiSelect = False
    ReDim lColumns(3)
    lColumns(0) = Join(Array("MKT_Key", 0, 1, "MKT_Key", "#MKT_Key"), SEP)
    lColumns(1) = Join(Array("Comp_desc", 3000, 0, "Comp_desc", "#Competitor"), SEP)
    lColumns(2) = Join(Array("CT_desc", 2000, 0, "CT_desc", "#Country"), SEP)
    lColumns(3) = Join(Array("Master_Comment", 5500, 0, "Master_Comment", "#Comments"), SEP)
    
    If Not grd_List.SetColumns(lColumns) Then
        Debug.Print "grd_list.SetColumns error"
        Call Unload_A_Com
        End
    End If
    
    Set grd_detail1.ArmDb = mo_Db
    grd_detail1.Load_A_Com
    grd_detail1.AllowExcelExport = True
    grd_detail1.ExportTitles = True
    grd_detail1.MultiSelect = False
    
    Set grd_detail2.ArmDb = mo_Db
    grd_detail2.Load_A_Com
    grd_detail2.AllowExcelExport = True
    grd_detail2.ExportTitles = True
    grd_detail2.MultiSelect = False
    
' START Attachments **********************************************************
            Set grd_Attachments.ArmDb = mo_Db
            grd_Attachments.Load_A_Com
            grd_Attachments.AllowExcelExport = True
            grd_Attachments.ExportTitles = True
            grd_Attachments.MultiSelect = False
            ReDim lColumns(3)
            lColumns(0) = Join(Array("ATT_Key", 0, 1, "ATT_Key", "ATT_Key"), SEP)
            lColumns(1) = Join(Array("ID_Blob", 0, 0, "ID_Blob", "ID_Blob"), SEP)
            lColumns(2) = Join(Array("ATT_Language_Desc", 2000, 0, "ATT_Language_Desc", "#Document Language"), SEP)
            lColumns(3) = Join(Array("ATT_Title", 6500, 0, "ATT_Title", "#Title"), SEP)
            
            If Not grd_Attachments.SetColumns(lColumns) Then
                Debug.Print "grd_Attachments.SetColumns error"
                Call Unload_A_Com
                End
            End If
            
' END Attachments **********************************************************'Treeview + cbo_views
    
    Set tv_filter.ArmDb = mo_Db
    tv_filter.Language = ms_Language_Code
    tv_filter.AllowCheckboxes = True
    tv_filter.UseImages = False
    tv_filter.Load_A_Com
    
    ' Initializing the view combo
    Set cbo_Views.ArmDb = mo_Db
    Call cbo_Views.Load_A_Com
    Call cbo_Views.Clear
    cbo_Views.FirstBlankItem = False
    cbo_Views.Request = "exec TreeView_View_t_lst '" & SCREEN_NAME & "'," & "'" & ms_Language_Code & "'"
    cbo_Views.Load
    
    If cbo_Views.Count = 0 Then
        Debug.Print "No views"
        Exit Sub
    End If
    
    Dim ll_Idx As Long, ll_Count As Long
    ll_Count = cbo_Views.Count - 1
    ReDim mTreeViewInfos(ll_Count)
    For ll_Idx = 0 To ll_Count
        mTreeViewInfos(ll_Idx).Loaded = False
        mTreeViewInfos(ll_Idx).TreeViewCode = cbo_Views.ComboItems(ll_Idx + 1).Key
    Next
    
    cbo_Views.SearchItem "X", "TV_Default", 0

'cbo
    Dim lo_Control As Control
    
    For Each lo_Control In UserControl.Controls
        Select Case UCase(lo_Control.Name)
            Case "FRA_RECORD"
                lo_Control.BorderStyle = 0
                lo_Control.Visible = False
            Case "FRA_MODIFINFO"
                lo_Control.BorderStyle = 0
            Case "FRA_FILTER", "FRA_ITEM", "FRA_DETAIL", "FRA_LIST"
                lo_Control.Caption = ""
            Case "TXT_KEY"
                lo_Control.Visible = False
            Case "TXT_GENERAL_COMMENT"
                lo_Control.BackColor = CL_COLOR_LOCKED
                lo_Control.Locked = True
            Case "FRA_CHANNELINFO"
                lo_Control.BorderStyle = 0
        End Select
        If UCase(lo_Control.Name) Like "TXT_SPARE" Then lo_Control.Visible = False
    Next
    
    Exit Sub

errHandler:
    mo_Db.Close (lCursTB)
    Call ErrorHandler("InitComponents")
    
End Sub
Private Sub HandleToolbar(ByVal atlb_Toolbar As Object, ByVal as_face As String, ByVal ab_ButtonsVisible As Boolean)
On Error GoTo errHandler

    atlb_Toolbar.Visible = False
    atlb_Toolbar.DisplayFace (as_face)
    If Not ab_ButtonsVisible Then
        atlb_Toolbar.Redraw = False
        atlb_Toolbar.ButtonVisible("A") = False
        atlb_Toolbar.ButtonVisible("B") = False
        atlb_Toolbar.ButtonVisible("C") = False
        atlb_Toolbar.ButtonVisible("l") = False
        atlb_Toolbar.ButtonVisible("p") = False
        atlb_Toolbar.ButtonVisible("R") = False
        atlb_Toolbar.Redraw = True
    End If
    atlb_Toolbar.Visible = True
    
    Exit Sub
    
errHandler:
    Call ErrorHandler("HandleToolbar")
    
End Sub


Private Sub Load_ClassInfo()
On Error GoTo errHandler
    'TODO: fill the collection
    
    Dim info As TClassInfo
    
    ReDim mt_ClassInfoLst(18)

' <<<<<<<<******* General
    With mt_ClassInfoLst(0)
        
        With .ConfigRecord
            .IndexFrame = 0
            .NameFrame = "CD_General"
            .Initialized = False
            .ExistAttach = False
            .RequestAdd = "exec MKT_Master_Ins $MKT_Key$," & _
                                                "'$Language_code$'," & _
                                                "$Comp_code$," & _
                                                "'$CT_Code$'," & _
                                                "'$Strat_flag$'," & _
                                                "'$Master_Comment$'," & _
                                                "$Z_Creator_User$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"
                                                
            .RequestUpd = "exec MKT_Master_Upd $MKT_Key$," & _
                                                "$Comp_code$," & _
                                                "'$CT_Code$'," & _
                                                "'$Strat_flag$'," & _
                                                "'$Master_Comment$'," & _
                                                "$Z_last_upd_user$," & _
                                                "$iConcurrency$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"
                                                
            .RequestDel = "exec MKT_Master_Del $MKT_Key$," & _
                                                "$Z_last_upd_user$," & _
                                                "$iConcurrency$"
            
            .RequestView = "exec MKT_Master_Sel $MKT_Key$," & _
                                                "'$Language_code$'"
            
            .RequestCheck = "exec MKT_Master_CheckUnicity '$Language_code$'," & _
                                                    "$Comp_code$," & _
                                                    "'$CT_Code$'," & _
                                                    "'$Strat_flag$'"
            
            .RequestCheckDelete = "exec MKT_Master_CheckDelete '$Language_code$'," & _
                                                        "$MKT_Key$"

            .TableName = "MKT_Master"
            
            ReDim .ListFieldsDefaultValue(-1 To -1)
            
            
            ReDim .ListFieldsMandatory(1, 1)
            Set .ListFieldsMandatory(0, 0) = cbo_General_Competitor
             .ListFieldsMandatory(0, 1) = 0
            Set .ListFieldsMandatory(1, 0) = cbo_General_Country
             .ListFieldsMandatory(1, 1) = 1
            
            
            ReDim .ListFieldsToDisable(3)
            Set .ListFieldsToDisable(0) = opt_General_Strat_Flag(0) '"Strat_flag"
            Set .ListFieldsToDisable(1) = opt_General_Strat_Flag(1) '"Strat_flag"
            Set .ListFieldsToDisable(2) = cbo_General_Competitor '"Comp_code"
            Set .ListFieldsToDisable(3) = cbo_General_Country '"CT_Code" & SEP
            
            .DeleteMsg(0, 0) = "2117"
            .DeleteMsg(0, 1) = "#Do you really want to delete this master record?"
            .UpdateMsg(0, 0) = "2133"
            .UpdateMsg(0, 1) = "#You can not update this master record."
            .CheckMsg(0, 0) = "2102"
            .CheckMsg(0, 1) = "#You cannot add this item because this master is already in the database."
            .CheckDelMsg(0, 0) = "2103"
            .CheckDelMsg(0, 1) = "#You cannot delete this record because there is some data link to it." & vbCrLf & "You must delete all the records attached to it before being able to delete this record."
        End With
        
        With .ConfigDetail
        
            ReDim .ConfigGrid(0).Columns(1)
            .ConfigGrid(0).Visible = False
            .ConfigGrid(0).Request = ""
            
            ReDim .ConfigGrid(1).Columns(1)
            .ConfigGrid(1).Visible = False
            .ConfigGrid(1).Request = ""
            
            .FaceToolbar = "0"
            
        End With
    End With
    
'<<<<<<<<******* Channel
    With mt_ClassInfoLst(1)
        With .ConfigRecord
            .IndexFrame = 9
            .NameFrame = "CD_Channel"
            .Initialized = False
            .ExistAttach = False
            .RequestAdd = "exec MKT_Channel_Ins $MKT_Key$," & _
                                                    "$MKT_CHNL_Key$," & _
                                                    "'$Language_code$'," & _
                                                    "$CHNL_type_code$," & _
                                                    "'$CHNL_Name$'," & _
                                                    "$CHNL_Year$," & _
                                                    "'$CHNL_Comment$'," & _
                                                    "$CHNL_Dist$," & _
                                                    "$CHNL_Cont$," & _
                                                    "$CHNL_SA$," & _
                                                    "$CHNL_MC$," & _
                                                    "$CHNL_EU$," & _
                                                    "$CHNL_percentBus$," & _
                                                    "$CHNL_Begin_Years$," & _
                                                    "$SC_code$," & _
                                                    "'$CHNL_Source$'," & _
                                                    "$Z_Creator_User$," & _
                                                    "'$Spare1_varchar$'," & _
                                                    "'$Spare2_varchar$'," & _
                                                    "$Spare3_real$," & _
                                                    "$Spare4_real$"
                                                
            .RequestUpd = "exec MKT_Channel_Upd $MKT_CHNL_Key$," & _
                                                    "$CHNL_type_code$," & _
                                                    "'$CHNL_Name$'," & _
                                                    "$CHNL_Year$," & _
                                                    "'$CHNL_Comment$'," & _
                                                    "$CHNL_Dist$," & _
                                                    "$CHNL_Cont$," & _
                                                    "$CHNL_SA$," & _
                                                    "$CHNL_MC$," & _
                                                    "$CHNL_EU$," & _
                                                    "$CHNL_percentBus$," & _
                                                    "$CHNL_Begin_Years$," & _
                                                    "$SC_code$," & _
                                                    "'$CHNL_Source$'," & _
                                                    "$Z_last_upd_user$," & _
                                                    "$iConcurrency$," & _
                                                    "'$Spare1_varchar$'," & _
                                                    "'$Spare2_varchar$'," & _
                                                    "$Spare3_real$," & _
                                                    "$Spare4_real$"
                                                
            .RequestDel = "exec MKT_Channel_Del $MKT_CHNL_Key$," & _
                                                    "$Z_last_upd_user$," & _
                                                    "$iConcurrency$"
            
            .RequestView = "exec MKT_Channel_Sel $Key$,'$Language_code$'"
            
            .RequestCheckDelete = "MKT_Channel_CheckDelete $Key$,'$Language_code$'"
            
            
            ReDim .ListFieldsDefaultValue(6, 1)
            Set .ListFieldsDefaultValue(0, 0) = txt_Channel_percent_of_Turnover
             .ListFieldsDefaultValue(0, 1) = "0"
            Set .ListFieldsDefaultValue(1, 0) = txt_Channel_percent_Distributor
             .ListFieldsDefaultValue(1, 1) = "0"
            Set .ListFieldsDefaultValue(2, 0) = txt_Channel_percent_Contractor
             .ListFieldsDefaultValue(2, 1) = "0"
            Set .ListFieldsDefaultValue(3, 0) = txt_Channel_percent_Strat_Accounts
             .ListFieldsDefaultValue(3, 1) = "0"
            Set .ListFieldsDefaultValue(4, 0) = txt_Channel_percent_Main_Contractor
             .ListFieldsDefaultValue(4, 1) = "0"
            Set .ListFieldsDefaultValue(5, 0) = txt_Channel_percent_End_User
             .ListFieldsDefaultValue(5, 1) = "0"
            Set .ListFieldsDefaultValue(6, 0) = cbo_Channel_Type
             .ListFieldsDefaultValue(6, 1) = "3" & SEP1 & "Key Customer"
            
            
            ReDim .ListFieldsMandatory(2, 1)
            Set .ListFieldsMandatory(0, 0) = cbo_Channel_Type
             .ListFieldsMandatory(0, 1) = 321
            Set .ListFieldsMandatory(1, 0) = txt_Channel_Source
             .ListFieldsMandatory(1, 1) = 322
            Set .ListFieldsMandatory(2, 0) = cbo_Channel_Year
             .ListFieldsMandatory(2, 1) = 320
            'Set .ListFieldsMandatory(3, 0) = cbo_Channel_Category
             '.ListFieldsMandatory(3, 1) = 312
             
            
            ReDim .ListFieldsToDisable(0)
            Set .ListFieldsToDisable(0) = cbo_Channel_Type
            
            .TableName = "MKT_Channel"
            .DeleteMsg(0, 0) = "2117"
            .DeleteMsg(0, 1) = "#Do you really want to delete this channel record?"
            .UpdateMsg(0, 0) = "2133"
            .UpdateMsg(0, 1) = "#You cannot update this channel record."
            .CheckDelMsg(0, 0) = "2104"
            .CheckDelMsg(0, 1) = "#You cannot delete this record." & vbCrLf & "You have some products linked to this records." & vbCrLf & "You must delete it before being able to delete this record."
        End With
        
        With .ConfigDetail
        
            .ConfigGrid(0).Visible = True
            ReDim .ConfigGrid(0).Columns(5)
            .ConfigGrid(0).Columns(0) = Join(Array("Key", 0, 1, "Key", "#Key"), SEP)
            .ConfigGrid(0).Columns(1) = Join(Array("CHNL_Year", 600, 0, "CHNL_Year", "#Year"), SEP)
            .ConfigGrid(0).Columns(2) = Join(Array("CHNL_Type_desc", 1200, 0, "CHNL_Type_desc", "#Type"), SEP)
            .ConfigGrid(0).Columns(3) = Join(Array("CHNL_Name", 1800, 0, "CHNL_Name", "#Name"), SEP)
            .ConfigGrid(0).Columns(4) = Join(Array("CHNL_Begin_Years", 1100, 0, "CHNL_Begin_Years", "#Year Began"), SEP)
            .ConfigGrid(0).Columns(5) = Join(Array("CHNL_Comment", 5000, 0, "CHNL_Comment", "#Comment"), SEP)
            
            .ConfigGrid(0).Request = "exec MKT_Channel_Lst $MKT_Key$,'$Language_code$'"
            
            .ConfigGrid(1).Visible = False
            .ConfigGrid(1).Request = ""
            .FaceToolbar = "0"
        
        End With
        
    End With

'<<<<<<<<******* Communication
    With mt_ClassInfoLst(2)
        With .ConfigRecord
            .IndexFrame = 8
            .NameFrame = "CD_Communication"
            .Initialized = False
            .ExistAttach = True
            .IndexClassAtt = 2
            
            .RequestAdd = "exec MKT_Communication_Ins $MKT_Key$," & _
                                                    "$MKT_COM_Key$," & _
                                                    "'$Language_code$'," & _
                                                    "$COM_Year$," & _
                                                    "$COM_Type_code$," & _
                                                    "'$COM_WebAddrs$'," & _
                                                    "'$COM_Source$'," & _
                                                    "'$COM_Comment$'," & _
                                                    "$Z_Creator_User$," & _
                                                    "'$Spare1_varchar$'," & _
                                                    "'$Spare2_varchar$'," & _
                                                    "$Spare3_real$," & _
                                                    "$Spare4_real$"
                                                
            .RequestUpd = "exec MKT_Communication_Upd $MKT_COM_Key$," & _
                                                    "$COM_Year$," & _
                                                    "$COM_Type_code$," & _
                                                    "'$COM_WebAddrs$'," & _
                                                    "'$COM_Source$'," & _
                                                    "'$COM_Comment$'," & _
                                                    "$Z_last_upd_user$," & _
                                                    "$iConcurrency$," & _
                                                    "'$Spare1_varchar$'," & _
                                                    "'$Spare2_varchar$'," & _
                                                    "$Spare3_real$," & _
                                                    "$Spare4_real$"
                                                
            .RequestDel = "MKT_Communication_Del $MKT_COM_Key$," & _
                                                    "$Z_last_upd_user$," & _
                                                    "$iConcurrency$"
            
            .RequestView = "exec MKT_Communication_Sel $Key$,'$Language_code$'"
            
            .RequestCheckDelete = "exec MKT_Communication_CheckDelete $Key$,'$Language_code$'"
            
            ReDim .ListFieldsDefaultValue(0, 1)
            Set .ListFieldsDefaultValue(0, 0) = cbo_Communication_Type
             .ListFieldsDefaultValue(0, 1) = "2" & SEP1 & "Advertising"
             
            ReDim .ListFieldsMandatory(2, 1)
            Set .ListFieldsMandatory(0, 0) = cbo_Communication_Year
             .ListFieldsMandatory(0, 1) = 261
            Set .ListFieldsMandatory(1, 0) = cbo_Communication_Type
             .ListFieldsMandatory(1, 1) = 262
            Set .ListFieldsMandatory(2, 0) = txt_Communication_Source
             .ListFieldsMandatory(2, 1) = 263
            
            ReDim .ListFieldsToDisable(0)
            Set .ListFieldsToDisable(0) = cbo_Communication_Type
            
            .TableName = "MKT_Communication"
            .DeleteMsg(0, 0) = "2117"
            .DeleteMsg(0, 1) = "#Do you really want to delete this communication record?"
            .UpdateMsg(0, 0) = "2133"
            .UpdateMsg(0, 1) = "#You cannot update this communication record."
            .CheckDelMsg(0, 0) = "2105"
            .CheckDelMsg(0, 1) = "#You cannot delete this record." & vbCrLf & "You have some attachments linked to this records." & vbCrLf & "You must delete it before being able to delete this record."
        End With
        
        With .ConfigDetail
            .ConfigGrid(0).Visible = True
            ReDim .ConfigGrid(0).Columns(4)
            .ConfigGrid(0).Columns(0) = Join(Array("Key", 0, 1, "Key", "#Key"), SEP)
            .ConfigGrid(0).Columns(1) = Join(Array("COM_Year", 600, 0, "COM_Year", "#Year"), SEP)
            .ConfigGrid(0).Columns(2) = Join(Array("COM_Type_Desc", 1000, 0, "COM_Type_Desc", "#Type"), SEP)
            .ConfigGrid(0).Columns(3) = Join(Array("COM_Comment", 5000, 0, "COM_Comment", "#Comments"), SEP)
            .ConfigGrid(0).Columns(4) = Join(Array("Attachment", 1000, 0, "Attachment", "#Attachment", "string", "", "center"), SEP)
            
            .ConfigGrid(0).Request = "exec MKT_Communication_Lst $MKT_Key$,'$Language_code$'"
            
            .ConfigGrid(1).Visible = False
            .ConfigGrid(1).Request = ""
            .FaceToolbar = "0"
        End With
    End With
    
'<<<<<<<<******* SalesOrg_C
    With mt_ClassInfoLst(3)
        With .ConfigRecord
            .IndexFrame = 1
            .NameFrame = "CD_SalesOrg_C"
            .Initialized = False
            .ExistAttach = True
            .IndexClassAtt = 5
            .RequestAdd = "exec MKT_Sales_Organisation_Ins $MKT_Key$," & _
                                                           "'$Language_code$'," & _
                                                           "$MKT_SO_Key$," & _
                                                           "$SO_Year$," & _
                                                           "$SO_Num$," & _
                                                           "$SO_Type_code$," & _
                                                           "'$SO_Location$'," & _
                                                           "$SO_Rep_number$," & _
                                                           "$SO_Man_number$," & _
                                                           "'$SO_Struc_Source$'," & _
                                                           "'$SO_Struc_Comments$'," & _
                                                           "$Z_Creator_User$," & _
                                                           "'$Spare1_varchar$'," & _
                                                           "'$Spare2_varchar$'," & _
                                                           "$Spare3_real$," & _
                                                           "$Spare4_real$"
                                                
            .RequestUpd = "exec MKT_Sales_Organisation_Upd $MKT_SO_Key$," & _
                                                           "$SO_Year$," & _
                                                           "$SO_Num$," & _
                                                           "$SO_Type_code$," & _
                                                           "'$SO_Location$'," & _
                                                           "$SO_Rep_number$," & _
                                                           "$SO_Man_number$," & _
                                                           "'$SO_Struc_Source$'," & _
                                                           "'$SO_Struc_Comments$'," & _
                                                           "$Z_last_upd_user$," & _
                                                           "$iConcurrency$," & _
                                                           "'$Spare1_varchar$'," & _
                                                           "'$Spare2_varchar$'," & _
                                                           "$Spare3_real$," & _
                                                           "$Spare4_real$"
                                                
            .RequestDel = "exec MKT_Sales_Organisation_Del $MKT_SO_Key$," & _
                                                           "$Z_last_upd_user$," & _
                                                           "$iConcurrency$"
            
            .RequestView = "exec MKT_Sales_Organisation_Sel $Key$,'$Language_code$'"
            
            .RequestCheck = "exec MKT_Sales_Organisation_C_CheckUnicity '$Language_Code$'," & _
                                                           "$MKT_Key$," & _
                                                           "$SO_Year$"
            
            .RequestCheckDelete = "exec MKT_Sales_Organisation_CheckDelete $Key$,'$Language_code$'"
            
            
            ReDim .ListFieldsDefaultValue(2, 1)
            Set .ListFieldsDefaultValue(0, 0) = txt_SalesOrg_NbofOffices
             .ListFieldsDefaultValue(0, 1) = "0"
            Set .ListFieldsDefaultValue(1, 0) = txt_SalesOrg_NbofManagers
             .ListFieldsDefaultValue(1, 1) = "0"
            Set .ListFieldsDefaultValue(2, 0) = txt_SalesOrg_NbofReps
             .ListFieldsDefaultValue(2, 1) = "0"
             
             
            ReDim .ListFieldsMandatory(4, 1)
            Set .ListFieldsMandatory(0, 0) = cbo_SalesOrg_Year
             .ListFieldsMandatory(0, 1) = 3
            Set .ListFieldsMandatory(1, 0) = txt_SalesOrg_NbofOffices
             .ListFieldsMandatory(1, 1) = 5
            Set .ListFieldsMandatory(2, 0) = txt_SalesOrg_NbofManagers
             .ListFieldsMandatory(2, 1) = 7
            Set .ListFieldsMandatory(3, 0) = txt_SalesOrg_NbofReps
             .ListFieldsMandatory(3, 1) = 8
            Set .ListFieldsMandatory(4, 0) = txt_SalesOrg_source
             .ListFieldsMandatory(4, 1) = 12
            
            ReDim .ListFieldsToDisable(-1 To -1)
            
            .TableName = "MKT_Sales_Organisation"
            .DeleteMsg(0, 0) = "2117"
            .DeleteMsg(0, 1) = "#Do you really want to delete this sales organisation record?"
            .UpdateMsg(0, 0) = "2133"
            .UpdateMsg(0, 1) = "#You can not update this sales organisation record."
            .CheckMsg(0, 0) = "2106"
            .CheckMsg(0, 1) = "#You can only have one sales organisation per year, per country. This record is already in the database."
            .CheckDelMsg(0, 0) = "2107"
            .CheckDelMsg(0, 1) = "#You cannot delete this record." & vbCrLf & "You have some attachments or sales reps linked to this records." & vbCrLf & "You must delete it before being able to delete this record."
            
        End With
        
        With .ConfigDetail
            .ConfigGrid(0).Visible = True
            ReDim .ConfigGrid(0).Columns(7)
            .ConfigGrid(0).Columns(0) = Join(Array("Key", 0, 1, "Key", "#Key"), SEP)
            .ConfigGrid(0).Columns(1) = Join(Array("SO_Year", 600, 0, "SO_Year", "#Year"), SEP)
            .ConfigGrid(0).Columns(2) = Join(Array("SO_Type_desc", 2500, 0, "SO_Type_desc", "#Type"), SEP)
            .ConfigGrid(0).Columns(3) = Join(Array("SO_Num", 1500, 0, "SO_Num", "#No of Offices", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(4) = Join(Array("SO_Man_number", 1500, 0, "SO_Man_number", "#No of Managers", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(5) = Join(Array("SO_Rep_number", 1100, 0, "SO_Rep_number", "#No of Reps", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(6) = Join(Array("Rep Detail", 1000, 0, "Rep Detail", "#Rep Detail", "", "", "center"), SEP)
            .ConfigGrid(0).Columns(7) = Join(Array("Attachment", 1000, 0, "Attachment", "#Attachment", "string", "", "center"), SEP)
            
            .ConfigGrid(0).Request = "exec MKT_Sales_Organisation_Lst_C $MKT_Key$,'$Language_code$'"
            
            .ConfigGrid(1).Visible = False
            .ConfigGrid(1).Request = ""
            
            .FaceToolbar = "0"
        End With
        
    End With
'<<<<<<<<******* SalesOrg Strategic
    With mt_ClassInfoLst(4)
        With .ConfigRecord
            .IndexFrame = 1
            .NameFrame = "CD_SalesOrg_S"
            .Initialized = False
            .ExistAttach = True
            .IndexClassAtt = 5
            .RequestAdd = ""
                                                
            .RequestUpd = "exec MKT_Sales_Organisation_Upd $MKT_SO_Key$," & _
                                                           "$SO_Year$," & _
                                                           "$SO_Num$," & _
                                                           "$SO_Type_code$," & _
                                                           "'$SO_Location$'," & _
                                                           "$SO_Rep_number$," & _
                                                           "$SO_Man_number$," & _
                                                           "'$SO_Struc_Source$'," & _
                                                           "'$SO_Struc_Comments$'," & _
                                                           "$Z_last_upd_user$," & _
                                                           "$iConcurrency$," & _
                                                           "'$Spare1_varchar$'," & _
                                                           "'$Spare2_varchar$'," & _
                                                           "$Spare3_real$," & _
                                                           "$Spare4_real$"
                                                
            .RequestDel = ""
            
            .RequestView = "exec MKT_Sales_Organisation_Sel $Key$,'$Language_code$'"
            
            .RequestCheck = "exec MKT_Sales_Organisation_S_CheckUnicity '$Language_Code$'," & _
                                                           "$MKT_SO_Key$," & _
                                                           "$SO_Year$"
            ReDim .ListFieldsDefaultValue(-1 To -1)
             
            ReDim .ListFieldsMandatory(4, 1)
            Set .ListFieldsMandatory(0, 0) = cbo_SalesOrg_Year
             .ListFieldsMandatory(0, 1) = 3
            Set .ListFieldsMandatory(1, 0) = txt_SalesOrg_NbofOffices
             .ListFieldsMandatory(1, 1) = 5
            Set .ListFieldsMandatory(2, 0) = txt_SalesOrg_NbofManagers
             .ListFieldsMandatory(2, 1) = 7
            Set .ListFieldsMandatory(3, 0) = txt_SalesOrg_NbofReps
             .ListFieldsMandatory(3, 1) = 8
            Set .ListFieldsMandatory(4, 0) = txt_SalesOrg_source
             .ListFieldsMandatory(4, 1) = 12
            
            ReDim .ListFieldsToDisable(-1 To -1)
            
            .TableName = "MKT_Sales_Organisation"
            .DeleteMsg(0, 0) = "2117"
            .DeleteMsg(0, 1) = "#Do you really want to delete this sales organisation record?"
            .UpdateMsg(0, 0) = "2133"
            .UpdateMsg(0, 1) = "#You can not update this sales organisation record."
            .CheckMsg(0, 0) = "2106"
            .CheckMsg(0, 1) = "#You can only have one sales organisation per year, per country. This record is already in the database."
        End With
        
        With .ConfigDetail
            .ConfigGrid(0).Visible = True
            ReDim .ConfigGrid(0).Columns(8)
            .ConfigGrid(0).Columns(0) = Join(Array("Key", 0, 1, "Key", "#Key"), SEP)
            .ConfigGrid(0).Columns(1) = Join(Array("SO_Year", 600, 0, "SO_Year", "#Year"), SEP)
            .ConfigGrid(0).Columns(2) = Join(Array("CT_Desc", 1000, 0, "CT_Desc", "#Country"), SEP)
            .ConfigGrid(0).Columns(3) = Join(Array("SO_Type_desc", 2500, 0, "SO_Type_desc", "#Type"), SEP)
            .ConfigGrid(0).Columns(4) = Join(Array("SO_Num", 1200, 0, "SO_Num", "#No of Offices", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(5) = Join(Array("SO_Man_number", 1400, 0, "SO_Man_number", "#No of Managers", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(6) = Join(Array("SO_Rep_number", 1000, 0, "SO_Rep_number", "#No of Reps", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(7) = Join(Array("Rep Detail", 900, 0, "Rep Detail", "#Rep Detail", "", "", "center"), SEP)
            .ConfigGrid(0).Columns(8) = Join(Array("Attachment", 1000, 0, "Attachment", "#Attachment", "string", "", "center"), SEP)
            
            .ConfigGrid(0).Request = "exec MKT_Sales_Organisation_Lst_S $MKT_Key$,'$Language_code$'"
            
            .ConfigGrid(1).Visible = False
            .ConfigGrid(1).Request = ""
            
            ReDim .ConfigGrid(2).Columns(3) 'For the aggregate function
            .ConfigGrid(2).Columns(0) = Join(Array("SO_Year", 800, 0, "SO_Year", "#Year"), SEP)
            .ConfigGrid(2).Columns(1) = Join(Array("SO_Num", 1300, 0, "SO_Num", "#No of Offices"), SEP)
            .ConfigGrid(2).Columns(2) = Join(Array("SO_Man_number", 1500, 0, "SO_Man_number", "#No of Managers"), SEP)
            .ConfigGrid(2).Columns(3) = Join(Array("SO_Rep_number", 1100, 0, "SO_Rep_number", "#No of Reps"), SEP)
            
            .ConfigGrid(2).Request = "exec MKT_Sales_Organisation_Lst_S_Agg $MKT_Key$,'$Language_code$'"
            
            .FaceToolbar = "4"
        End With
        
    End With

'------- Sales Estimate Country
    With mt_ClassInfoLst(5)
        With .ConfigRecord
            .IndexFrame = 4
            .NameFrame = "CD_SalesEst_C"
            .Initialized = False
            .ExistAttach = False
            .RequestAdd = "exec MKT_Sales_Est_Ins $MKT_Key$," & _
                                                "'$Language_code$'," & _
                                                "$MKT_Sales_est_Key$," & _
                                                "$Sales_Est_Year$," & _
                                                "$SC_Code$," & _
                                                "$BM_Code$," & _
                                                "$SE_Value$," & _
                                                "'$CURR_Code$'," & _
                                                "'$UM_Code$'," & _
                                                "$SE_Volume$," & _
                                                "'$SE_Source$'," & _
                                                "'$SE_Comment$'," & _
                                                "$Z_Creator_User$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"
                                                
            .RequestUpd = "exec MKT_Sales_Est_Upd $MKT_Sales_est_Key$," & _
                                                "$Sales_Est_Year$," & _
                                                "$SC_Code$," & _
                                                "$BM_Code$," & _
                                                "$SE_Value$," & _
                                                "'$CURR_Code$'," & _
                                                "'$UM_Code$'," & _
                                                "$SE_Volume$," & _
                                                "'$SE_Source$'," & _
                                                "'$SE_Comment$'," & _
                                                "$Z_last_upd_user$," & _
                                                "$iConcurrency$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"
  
                                                
            .RequestDel = "exec MKT_Sales_Est_Del $MKT_Sales_Est_Key$," & _
                                                           "$Z_last_upd_user$," & _
                                                           "$iConcurrency$"
            
            .RequestView = "exec MKT_Sales_Est_Sel $Key$,'$Language_code$'"
            
            .RequestCheck = "exec MKT_Sales_Est_C_CheckUnicity '$Language_code$'," & _
                                                            "$MKT_Key$," & _
                                                            "$Sales_Est_Year$," & _
                                                            "$SC_Code$," & _
                                                            "$BM_Code$"
            
            
            .TableName = "MKT_Sales_Est"
            
            ReDim .ListFieldsDefaultValue(3, 1)
            Set .ListFieldsDefaultValue(0, 0) = txt_SalesEst_Quantity
             .ListFieldsDefaultValue(0, 1) = "0"
            Set .ListFieldsDefaultValue(1, 0) = cbo_SalesEst_Unit_of_Measure
             .ListFieldsDefaultValue(1, 1) = "M2" & SEP1 & "Square metre"
            Set .ListFieldsDefaultValue(2, 0) = txt_SalesEst_Value
             .ListFieldsDefaultValue(2, 1) = "0"
            Set .ListFieldsDefaultValue(3, 0) = cbo_SalesEst_Currency
             .ListFieldsDefaultValue(3, 1) = "EUR" & SEP1 & "European Monetary Unit (EURO)"
            
            ReDim .ListFieldsMandatory(7, 1)
            Set .ListFieldsMandatory(0, 0) = cbo_SalesEst_Year
             .ListFieldsMandatory(0, 1) = 108
            Set .ListFieldsMandatory(1, 0) = cbo_SalesEst_Category
             .ListFieldsMandatory(1, 1) = 109
            Set .ListFieldsMandatory(2, 0) = cbo_SalesEst_Material
             .ListFieldsMandatory(2, 1) = 110
            Set .ListFieldsMandatory(3, 0) = txt_SalesEst_Quantity
             .ListFieldsMandatory(3, 1) = 116
            Set .ListFieldsMandatory(4, 0) = cbo_SalesEst_Unit_of_Measure
             .ListFieldsMandatory(4, 1) = 58
            Set .ListFieldsMandatory(5, 0) = txt_SalesEst_Value
             .ListFieldsMandatory(5, 1) = 117
            Set .ListFieldsMandatory(6, 0) = cbo_SalesEst_Currency
             .ListFieldsMandatory(6, 1) = 59
            Set .ListFieldsMandatory(7, 0) = txt_SalesEst_Source
             .ListFieldsMandatory(7, 1) = 115
                                   
            ReDim .ListFieldsToDisable(-1 To -1)
                                   
            .DeleteMsg(0, 0) = "2117"
            .DeleteMsg(0, 1) = "#Do you really want to delete this sales estimate record?"
            .UpdateMsg(0, 0) = "2133"
            .UpdateMsg(0, 1) = "#You can not update this sales estimate record."
            .CheckMsg(0, 0) = "2108"
            .CheckMsg(0, 1) = "#You can only have one estimate per year, per category and per material. This record is already in the database."
            
        End With
        With .ConfigDetail
            .ConfigGrid(0).Visible = True
            
            ReDim .ConfigGrid(0).Columns(8)
            .ConfigGrid(0).Columns(0) = Join(Array("Key", 0, 1, "Key", "#Key"), SEP)
            .ConfigGrid(0).Columns(1) = Join(Array("Sales_Est_Year", 600, 0, "Sales_Est_Year", "#Year"), SEP)
            .ConfigGrid(0).Columns(2) = Join(Array("SC_desc", 1300, 0, "SC_desc", "#Super Category"), SEP)
            .ConfigGrid(0).Columns(3) = Join(Array("SBM_desc", 1100, 0, "SBM_desc", "#SBM"), SEP)
            .ConfigGrid(0).Columns(4) = Join(Array("BM_Desc", 1100, 0, "BM_Desc", "#Material"), SEP)
            .ConfigGrid(0).Columns(5) = Join(Array("SE_Value", 1200, 0, "SE_Value", "#Value", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(6) = Join(Array("CURR_desc", 1800, 0, "CURR_desc", "#Currency"), SEP)
            .ConfigGrid(0).Columns(7) = Join(Array("SE_Volume", 1200, 0, "SE_Volume", "#Quantity", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(8) = Join(Array("UM_desc", 1400, 0, "UM_desc", "#Unit of Measure"), SEP)
            
            .ConfigGrid(0).Request = "exec MKT_Sales_Est_Lst_C $MKT_Key$,'$Language_code$'"
            
            .ConfigGrid(1).Visible = False
            .ConfigGrid(1).Request = ""
            
            
            ReDim .ConfigGrid(2).Columns(5) 'For the aggregate function
            .ConfigGrid(2).Columns(0) = Join(Array("Sales_Est_Year", 600, 0, "Sales_Est_Year", "#Year"), SEP)
            .ConfigGrid(2).Columns(1) = Join(Array("SC_desc", 1300, 0, "SC_desc", "#Super Category"), SEP)
            .ConfigGrid(2).Columns(2) = Join(Array("SE_Value", 1500, 0, "SE_Value", "#Value", "Float", "0"), SEP)
            .ConfigGrid(2).Columns(3) = Join(Array("CURR_desc", 2500, 0, "CURR_desc", "#Currency"), SEP)
            .ConfigGrid(2).Columns(4) = Join(Array("SE_Volume", 1500, 0, "SE_Volume", "#Quantity", "Float", "0"), SEP)
            .ConfigGrid(2).Columns(5) = Join(Array("UM_desc", 1400, 0, "UM_desc", "#Unit of Measure"), SEP)
            
            .ConfigGrid(2).Request = "exec MKT_Sales_Est_Lst_C_Agg $MKT_Key$,'$Language_code$'"
            
            .FaceToolbar = "1"
            
        End With
        
        
        
    End With
    
'------- Sales Estimate Strategic
    With mt_ClassInfoLst(6)
        With .ConfigRecord
            .IndexFrame = 4
            .NameFrame = "CD_SalesEst_S"
            .Initialized = False
            .ExistAttach = False
            .RequestAdd = ""
            .RequestUpd = "exec MKT_Sales_Est_Upd $MKT_Sales_est_Key$," & _
                                                "$Sales_Est_Year$," & _
                                                "$SC_Code$," & _
                                                "$BM_Code$," & _
                                                "$SE_Value$," & _
                                                "'$CURR_Code$'," & _
                                                "'$UM_Code$'," & _
                                                "$SE_Volume$," & _
                                                "'$SE_Source$'," & _
                                                "'$SE_Comment$'," & _
                                                "$Z_last_upd_user$," & _
                                                "$iConcurrency$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"
  
                                                
            .RequestDel = ""
            
            .RequestView = "exec MKT_Sales_Est_Sel $Key$,'$Language_code$'"
            
            .RequestCheck = "exec MKT_Sales_Est_S_CheckUnicity '$Language_code$'," & _
                                                            "$MKT_Sales_est_Key$," & _
                                                            "$Sales_Est_Year$," & _
                                                            "$SC_Code$," & _
                                                            "$BM_Code$"
            
            .TableName = "MKT_Sales_Est"
            
            ReDim .ListFieldsDefaultValue(-1 To -1)
            
            ReDim .ListFieldsMandatory(7, 1)
            Set .ListFieldsMandatory(0, 0) = cbo_SalesEst_Year
             .ListFieldsMandatory(0, 1) = 108
            Set .ListFieldsMandatory(1, 0) = cbo_SalesEst_Category
             .ListFieldsMandatory(1, 1) = 109
            Set .ListFieldsMandatory(2, 0) = cbo_SalesEst_Material
             .ListFieldsMandatory(2, 1) = 110
            Set .ListFieldsMandatory(3, 0) = txt_SalesEst_Quantity
             .ListFieldsMandatory(3, 1) = 116
            Set .ListFieldsMandatory(4, 0) = cbo_SalesEst_Unit_of_Measure
             .ListFieldsMandatory(4, 1) = 111
            Set .ListFieldsMandatory(5, 0) = txt_SalesEst_Value
             .ListFieldsMandatory(5, 1) = 117
            Set .ListFieldsMandatory(6, 0) = cbo_SalesEst_Currency
             .ListFieldsMandatory(6, 1) = 112
            Set .ListFieldsMandatory(7, 0) = txt_SalesEst_Source
             .ListFieldsMandatory(7, 1) = 115
                                   
            ReDim .ListFieldsToDisable(-1 To -1)
            
            .DeleteMsg(0, 0) = "2117"
            .DeleteMsg(0, 1) = "#Do you really want to delete this sales estimate record?"
            .UpdateMsg(0, 0) = "2133"
            .UpdateMsg(0, 1) = "#You can not update this sales estimate record."
            .CheckMsg(0, 0) = "2108"
            .CheckMsg(0, 1) = "#You can only have one estimate per year, per category and per material. This record is already in the database."
        
        End With
        With .ConfigDetail
            .ConfigGrid(0).Visible = True
            ReDim .ConfigGrid(0).Columns(9)
            .ConfigGrid(0).Columns(0) = Join(Array("Key", 0, 1, "Key", "#Key"), SEP)
            .ConfigGrid(0).Columns(1) = Join(Array("Sales_Est_Year", 600, 0, "Sales_Est_Year", "#Year"), SEP)
            .ConfigGrid(0).Columns(2) = Join(Array("CT_desc", 1000, 0, "CT_desc", "#Country"), SEP)
            .ConfigGrid(0).Columns(3) = Join(Array("SC_desc", 1300, 0, "SC_desc", "#Super Category"), SEP)
            .ConfigGrid(0).Columns(4) = Join(Array("SBM_desc", 1200, 0, "SBM_desc", "#SBM"), SEP)
            .ConfigGrid(0).Columns(5) = Join(Array("BM_Desc", 1200, 0, "BM_Desc", "#Material"), SEP)
            .ConfigGrid(0).Columns(6) = Join(Array("SE_Value", 1200, 0, "SE_Value", "#Value", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(7) = Join(Array("CURR_desc", 1800, 0, "CURR_desc", "#Currency"), SEP)
            .ConfigGrid(0).Columns(8) = Join(Array("SE_Volume", 1200, 0, "SE_Volume", "#Volume", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(9) = Join(Array("UM_desc", 1400, 0, "UM_desc", "#Unit of Measure"), SEP)
            
            .ConfigGrid(0).Request = "exec MKT_Sales_Est_Lst_S $MKT_Key$,'$Language_code$'"
            
            .ConfigGrid(1).Visible = False
            .ConfigGrid(1).Request = ""
            
            ReDim .ConfigGrid(2).Columns(5) 'For the aggregate function
            .ConfigGrid(2).Columns(0) = Join(Array("Sales_Est_Year", 600, 0, "Sales_Est_Year", "#Year"), SEP)
            .ConfigGrid(2).Columns(1) = Join(Array("SC_desc", 1300, 0, "SC_desc", "#Super Category"), SEP)
            .ConfigGrid(2).Columns(2) = Join(Array("SE_Value", 1500, 0, "SE_Value", "#Value", "Float", "0"), SEP)
            .ConfigGrid(2).Columns(3) = Join(Array("CURR_desc", 2500, 0, "CURR_desc", "#Currency"), SEP)
            .ConfigGrid(2).Columns(4) = Join(Array("SE_Volume", 1500, 0, "SE_Volume", "#Quantity", "Float", "0"), SEP)
            .ConfigGrid(2).Columns(5) = Join(Array("UM_desc", 1400, 0, "UM_desc", "#Unit of Measure"), SEP)
            
            .ConfigGrid(2).Request = "exec MKT_Sales_Est_Lst_S_Agg $MKT_Key$,'$Language_code$'"
            
            .FaceToolbar = "4"
        End With
        
    End With

'------- Attachments
    With mt_ClassInfoLst(7)
        With .ConfigRecord
            .IndexFrame = 50
            .NameFrame = "CD_Attachments"
            .Initialized = False
            .RequestAdd = "exec MKT_Attachments_ins $ATT_Key$," & _
                                                        "'$Language_Code$'," & _
                                                        "'$ATT_Title$'," & _
                                                        "$ATT_Type_code$," & _
                                                        "'$ATT_Language_Code$'," & _
                                                        "$MKT_IndexClass$," & _
                                                        "$MKT_BM_Key$," & _
                                                        "$MKT_COM_Key$," & _
                                                        "$MKT_LOC_Key$," & _
                                                        "$MKT_GP_Key$," & _
                                                        "$MKT_SO_Key$," & _
                                                        "$MKT_SERV_KEY$," & _
                                                        "$MKT_Fin_Key$," & _
                                                        "'$ATT_Source$'," & _
                                                        "$ID_Blob$," & _
                                                        "$Z_Creator_User$," & _
                                                        "'$Spare1_varchar$'," & _
                                                        "'$Spare2_varchar$'," & _
                                                        "$Spare3_real$," & _
                                                        "$Spare4_real$"

                                                
            .RequestUpd = "exec MKT_Attachments_upd $ATT_Key$," & _
                                                        "'$Language_Code$'," & _
                                                        "'$ATT_Title$'," & _
                                                        "$ATT_Type_code$," & _
                                                        "'$ATT_Language_Code$'," & _
                                                        "'$ATT_Source$'," & _
                                                        "$Z_Last_Upd_User$," & _
                                                        "$iConcurrency$," & _
                                                        "'$Spare1_varchar$'," & _
                                                        "'$Spare2_varchar$'," & _
                                                        "$Spare3_real$," & _
                                                        "$Spare4_real$"

                                                
            .RequestDel = "exec MKT_Attachments_del $ATT_Key$," & _
                                                        "'$Language_Code$'," & _
                                                        "$iConcurrency$," & _
                                                        "$Z_Last_Upd_User$"

            
            .RequestView = "exec MKT_Attachments_sel $Key$,'$Language_Code$'"
            
            ReDim .ListFieldsDefaultValue(-1 To -1)
            
            ReDim .ListFieldsMandatory(3, 1)
            Set .ListFieldsMandatory(0, 0) = txt_Attachment_Title
             .ListFieldsMandatory(0, 1) = 451
            Set .ListFieldsMandatory(1, 0) = cbo_Attachment_Type
             .ListFieldsMandatory(1, 1) = 452
            Set .ListFieldsMandatory(2, 0) = cbo_Attachment_DocLanguage
             .ListFieldsMandatory(2, 1) = 453
            Set .ListFieldsMandatory(3, 0) = txt_Attachment_Source
             .ListFieldsMandatory(3, 1) = 455
            
            ReDim .ListFieldsToDisable(0)
            Set .ListFieldsToDisable(0) = cbo_Attachment_Type
            
            .TableName = "MKT_Attachments"
            .DeleteMsg(0, 0) = "2109"
            .DeleteMsg(0, 1) = "#Do you really want to delete this attachment record?"
            .UpdateMsg(0, 0) = "2110"
            .UpdateMsg(0, 1) = "#You cannot update this attachment record."
        End With
        
    End With
    
'------- SWOT
    With mt_ClassInfoLst(8)
        With .ConfigRecord
            .IndexFrame = 3
            .NameFrame = "CD_SWOT"
            .Initialized = False
            .ExistAttach = False
            .RequestAdd = "exec MKT_SWOT_Ins $MKT_Key$," & _
                                                "'$Language_code$'," & _
                                                "$MKT_SWOT_Key$," & _
                                                "$Swot_Year$," & _
                                                "'$Swot_S$'," & _
                                                "'$Swot_W$'," & _
                                                "'$Swot_O$'," & _
                                                "'$Swot_T$'," & _
                                                "'$Swot_Source$'," & _
                                                "$Z_Creator_User$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"
                                                
                                                
            .RequestUpd = "exec MKT_SWOT_Upd $MKT_SWOT_Key$," & _
                                            "$Swot_Year$," & _
                                            "'$Swot_S$'," & _
                                            "'$Swot_W$'," & _
                                            "'$Swot_O$'," & _
                                            "'$Swot_T$'," & _
                                            "'$Swot_Source$'," & _
                                            "$Z_last_upd_user$," & _
                                            "$iConcurrency$," & _
                                            "'$Spare1_varchar$'," & _
                                            "'$Spare2_varchar$'," & _
                                            "$Spare3_real$," & _
                                            "$Spare4_real$"

  
                                                
            .RequestDel = "exec MKT_SWOT_Del $MKT_SWOT_Key$," & _
                                            "$Z_last_upd_user$," & _
                                            "$iConcurrency$"
            
            .RequestView = "exec MKT_SWOT_Sel $Key$,'$Language_code$'"
            
            .RequestCheck = "exec MKT_SWOT_CheckUnicity '$Language_Code$', " & _
                                                        "$MKT_Key$," & _
                                                        "$SWOT_Year$"
            
            ReDim .ListFieldsDefaultValue(-1 To -1)
            
            ReDim .ListFieldsMandatory(1, 1)
            Set .ListFieldsMandatory(0, 0) = cbo_SWOT_Year
             .ListFieldsMandatory(0, 1) = 49
            Set .ListFieldsMandatory(1, 0) = txt_SWOT_Source
             .ListFieldsMandatory(1, 1) = 51
             
            ReDim .ListFieldsToDisable(-1 To -1)
            
            
                        
            .TableName = "MKT_Swot"
            
            .DeleteMsg(0, 0) = "2117"
            .DeleteMsg(0, 1) = "#Do you really want to delete this SWOT record?"
            .UpdateMsg(0, 0) = "2133"
            .UpdateMsg(0, 1) = "#You can not update this SWOT record."
            .CheckMsg(0, 0) = "2111"
            .CheckMsg(0, 1) = "#You can only have one SWOT per competitor, per country and per year. This record is already in the database."
            
        End With
        
        With .ConfigDetail
            .ConfigGrid(0).Visible = True
            ReDim .ConfigGrid(0).Columns(6)
            .ConfigGrid(0).Columns(0) = Join(Array("Key", 0, 1, "Key", "#Key"), SEP)
            .ConfigGrid(0).Columns(1) = Join(Array("Swot_Year", 600, 0, "Swot_Year", "#Year"), SEP)
            .ConfigGrid(0).Columns(2) = Join(Array("Swot_S", 1925, 0, "Swot_S", "#S"), SEP)
            .ConfigGrid(0).Columns(3) = Join(Array("Swot_W", 1925, 0, "Swot_W", "#W"), SEP)
            .ConfigGrid(0).Columns(4) = Join(Array("Swot_O", 1925, 0, "Swot_O", "#0"), SEP)
            .ConfigGrid(0).Columns(5) = Join(Array("Swot_T", 1925, 0, "Swot_T", "#T"), SEP)
            .ConfigGrid(0).Columns(6) = Join(Array("Z_Last_upd", 1200, 0, "Z_Last_upd", "#Last updated"), SEP)
            
            .ConfigGrid(0).Request = "exec MKT_SWOT_lst $MKT_Key$,'$Language_code$'"
            
            .ConfigGrid(1).Visible = False
            .ConfigGrid(1).Request = ""
            .FaceToolbar = "0"
        End With
        
        
        
    End With
    
'------- Services
    With mt_ClassInfoLst(9)
        With .ConfigRecord
            .IndexFrame = 5
            .NameFrame = "CD_Services"
            .Initialized = False
            .ExistAttach = True
            .IndexClassAtt = 6
            .RequestAdd = "exec MKT_Services_Ins $MKT_Key$," & _
                                            "$MKT_SERV_KEY$," & _
                                            "'$Language_Code$'," & _
                                            "$SERV_Year$," & _
                                            "'$SERV_DelPol$'," & _
                                            "'$SERV_ShpTime$'," & _
                                            "$CR_Code$," & _
                                            "'$SERV_WarrntyYN$'," & _
                                            "'$SERV_WarrntyTxt$'," & _
                                            "'$SERV_TechSupYN$'," & _
                                            "$SERV_TechSupRtg_code$," & _
                                            "'$SERV_TechSupTxt$'," & _
                                            "'$SERV_PymntTrms$'," & _
                                            "'$SERV_EnvPol$'," & _
                                            "'$SERV_Source$'," & _
                                            "$Z_Creator_User$," & _
                                            "'$Spare1_varchar$'," & _
                                            "'$Spare2_varchar$'," & _
                                            "$Spare3_real$," & _
                                            "$Spare4_real$"
                                                
            .RequestUpd = "exec dbo.MKT_Services_Upd $MKT_SERV_KEY$," & _
                                            "$SERV_Year$," & _
                                            "'$SERV_DelPol$'," & _
                                            "'$SERV_ShpTime$'," & _
                                            "$CR_Code$," & _
                                            "'$SERV_WarrntyYN$'," & _
                                            "'$SERV_WarrntyTxt$'," & _
                                            "'$SERV_TechSupYN$'," & _
                                            "$SERV_TechSupRtg_code$," & _
                                            "'$SERV_TechSupTxt$'," & _
                                            "'$SERV_PymntTrms$'," & _
                                            "'$SERV_EnvPol$'," & _
                                            "'$SERV_Source$'," & _
                                            "$Z_last_upd_user$," & _
                                            "$iConcurrency$," & _
                                            "'$Spare1_varchar$'," & _
                                            "'$Spare2_varchar$'," & _
                                            "$Spare3_real$," & _
                                            "$Spare4_real$"
                                                
            .RequestDel = "exec MKT_Services_Del $MKT_SERV_Key$," & _
                                            "$Z_last_upd_user$," & _
                                            "$iConcurrency$"
            
            .RequestView = "exec MKT_Services_Sel $Key$,'$Language_code$'"
            
            .RequestCheck = "exec MKT_Services_CheckUnicity '$Language_code$'," & _
                                                            "$MKT_Key$," & _
                                                            "$SERV_Year$"
            
            .RequestCheckDelete = "exec MKT_Services_CheckDelete $Key$,'$Language_code$'"
            
            
            ReDim .ListFieldsDefaultValue(-1 To -1)
            
            ReDim .ListFieldsMandatory(2, 1)
            Set .ListFieldsMandatory(0, 0) = cbo_Services_Year
             .ListFieldsMandatory(0, 1) = 137
            Set .ListFieldsMandatory(1, 0) = txt_Services_DeliveryPolicy
             .ListFieldsMandatory(1, 1) = 139
            Set .ListFieldsMandatory(2, 0) = txt_Services_Source
             .ListFieldsMandatory(2, 1) = 140
                 
            ReDim .ListFieldsToDisable(-1 To -1)
            
            .TableName = "MKT_Services"
            .DeleteMsg(0, 0) = "2117"
            .DeleteMsg(0, 1) = "#Do you really want to delete this Services record?"
            .UpdateMsg(0, 0) = "2133"
            .UpdateMsg(0, 1) = "#You can not update this Services record."
            .CheckMsg(0, 0) = "2112"
            .CheckMsg(0, 1) = "#You can only have one Services per competitor, per country and per year. This record is already in the database."
            .CheckDelMsg(0, 0) = "2105"
            .CheckDelMsg(0, 1) = "#You cannot delete this record." & vbCrLf & "You have some attachments linked to this records." & vbCrLf & "You must delete it before being able to delete this record."
        End With
        
        With .ConfigDetail
            .ConfigGrid(0).Visible = True
            ReDim .ConfigGrid(0).Columns(7)
            .ConfigGrid(0).Columns(0) = Join(Array("Key", 0, 1, "Key", "#Key"), SEP)
            .ConfigGrid(0).Columns(1) = Join(Array("SERV_Year", 600, 0, "SERV_Year", "#Year"), SEP)
            .ConfigGrid(0).Columns(2) = Join(Array("SERV_WarrntyYN", 1100, 0, "SERV_WarrntyYN", "#Warranty", "string", "", "center"), SEP)
            .ConfigGrid(0).Columns(3) = Join(Array("SERV_TechSupYN", 1200, 0, "SERV_TechSupYN", "#Tech Support", "string", "", "center"), SEP)
            .ConfigGrid(0).Columns(4) = Join(Array("SERV_TechSupRtg_desc", 1500, 0, "SERV_TechSupRtg_desc", "#Tech Rating"), SEP)
            .ConfigGrid(0).Columns(5) = Join(Array("SERV_DelPol", 2175, 0, "SERV_DelPol", "#Delivery Policy"), SEP)
            .ConfigGrid(0).Columns(6) = Join(Array("SERV_ShpTime", 2175, 0, "SERV_ShpTime", "#Shipment Details"), SEP)
            .ConfigGrid(0).Columns(7) = Join(Array("Attachment", 1000, 0, "Attachment", "#Attachment", "string", "", "center"), SEP)
            
            .ConfigGrid(0).Request = "MKT_Services_Lst $MKT_Key$,'$Language_code$'"
            
            .ConfigGrid(1).Visible = False
            .ConfigGrid(1).Request = ""
            .FaceToolbar = "0"
        End With
    End With
    
'------- Products_C
    With mt_ClassInfoLst(10)
        With .ConfigRecord
            .IndexFrame = 6
            .NameFrame = "CD_Products_C"
            .Initialized = False
            .ExistAttach = True
            .IndexClassAtt = 4
            .RequestAdd = "exec MKT_GenProd_Ins $MKT_Key$," & _
                                                "$MKT_GP_Key$," & _
                                                "'$Language_code$'," & _
                                                "$GP_Year$," & _
                                                "$GP_Type_code$," & _
                                                "'$GP_Item$'," & _
                                                "$GP_Pricing$," & _
                                                "'$CURR_Code$'," & _
                                                "$GP_Posit_Type_code$," & _
                                                "$GP_Volume$," & _
                                                "'$UM_Code$'," & _
                                                "'$GP_Source$'," & _
                                                "'$GP_Comment$'," & _
                                                "$Z_Creator_User$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"
                                                
            .RequestUpd = "exec MKT_GenProd_Upd $MKT_GP_Key$," & _
                                                "$GP_Year$," & _
                                                "$GP_Type_code$," & _
                                                "'$GP_Item$'," & _
                                                "$GP_Pricing$," & _
                                                "'$CURR_Code$'," & _
                                                "$GP_Posit_Type_code$," & _
                                                "$GP_Volume$," & _
                                                "'$UM_Code$'," & _
                                                "'$GP_Source$'," & _
                                                "'$GP_Comment$'," & _
                                                "$Z_last_upd_user$," & _
                                                "$iConcurrency$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"
    
            .RequestDel = "exec MKT_GenProd_Del $MKT_GP_Key$," & _
                                            "$Z_last_upd_user$," & _
                                            "$iConcurrency$"
            
            .RequestView = "exec MKT_GenProd_Sel $Key$,'$Language_code$'"
            
            .RequestCheckDelete = "exec MKT_GenProd_CheckDelete $Key$,'$Language_code$'"
            
            ReDim .ListFieldsDefaultValue(5, 1)
            Set .ListFieldsDefaultValue(0, 0) = txt_Product_Volume
             .ListFieldsDefaultValue(0, 1) = "0"
            Set .ListFieldsDefaultValue(1, 0) = cbo_Product_Unit_of_Measure
             .ListFieldsDefaultValue(1, 1) = "M2" & SEP1 & "Square metre"
            Set .ListFieldsDefaultValue(2, 0) = txt_SalesEst_Value
             .ListFieldsDefaultValue(2, 1) = "0"
            Set .ListFieldsDefaultValue(3, 0) = cbo_Product_Currency
             .ListFieldsDefaultValue(3, 1) = "EUR" & SEP1 & "European Monetary Unit (EURO)"
            Set .ListFieldsDefaultValue(4, 0) = cbo_Product_GP_Type
             .ListFieldsDefaultValue(4, 1) = "1" & SEP1 & "New Product Introduction"
            Set .ListFieldsDefaultValue(5, 0) = txt_Product_Price
             .ListFieldsDefaultValue(5, 1) = "0"
            
            ReDim .ListFieldsMandatory(4, 1)
            Set .ListFieldsMandatory(0, 0) = cbo_Product_Year
             .ListFieldsMandatory(0, 1) = 165
            Set .ListFieldsMandatory(1, 0) = cbo_Product_GP_Type
             .ListFieldsMandatory(1, 1) = 167
            Set .ListFieldsMandatory(2, 0) = txt_Product_Item
             .ListFieldsMandatory(2, 1) = 163
            Set .ListFieldsMandatory(3, 0) = cbo_Product_Price_Positioning
             .ListFieldsMandatory(3, 1) = 161
            Set .ListFieldsMandatory(4, 0) = txt_Product_Source
             .ListFieldsMandatory(4, 1) = 166
            
            ReDim .ListFieldsToDisable(0)
            Set .ListFieldsToDisable(0) = cbo_Product_GP_Type
            
            .TableName = "MKT_GenProd"
            .DeleteMsg(0, 0) = "2117"
            .DeleteMsg(0, 1) = "#Do you really want to delete this Product record?"
            .UpdateMsg(0, 0) = "2133"
            .UpdateMsg(0, 1) = "#You can not update this Product record."
            .CheckDelMsg(0, 0) = "2105"
            .CheckDelMsg(0, 1) = "#You cannot delete this record." & vbCrLf & "You have some attachments linked to this records." & vbCrLf & "You must delete it before being able to delete this record."
            
        End With
        
        With .ConfigDetail
            .ConfigGrid(0).Visible = True
            ReDim .ConfigGrid(0).Columns(9)
            .ConfigGrid(0).Columns(0) = Join(Array("Key", 0, 1, "Key", "#Key"), SEP)
            .ConfigGrid(0).Columns(1) = Join(Array("GP_Year", 600, 0, "GP_Year", "#Year"), SEP)
            .ConfigGrid(0).Columns(2) = Join(Array("GP_Type_Desc", 1600, 0, "GP_Type_Desc", "#Type"), SEP)
            .ConfigGrid(0).Columns(3) = Join(Array("GP_Item", 1000, 0, "GP_Item", "#Item"), SEP)
            .ConfigGrid(0).Columns(4) = Join(Array("GP_Pricing", 800, 0, "GP_Pricing", "#Price", "Float", "0.00"), SEP)
            .ConfigGrid(0).Columns(5) = Join(Array("CURR_desc", 1000, 0, "CURR_desc", "#Currency"), SEP)
            .ConfigGrid(0).Columns(6) = Join(Array("GP_Volume", 1000, 0, "GP_Volume", "#Quantity", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(7) = Join(Array("UM_desc", 1000, 0, "UM_desc", "#Unit of Measure"), SEP)
            .ConfigGrid(0).Columns(8) = Join(Array("GP_Posit_Type_desc", 1000, 0, "GP_Posit_Type_desc", "#Positioning"), SEP)
            .ConfigGrid(0).Columns(9) = Join(Array("Attachment", 1000, 0, "Attachment", "#Attachment", "string", "", "center"), SEP)
            
            
            .ConfigGrid(0).Request = "exec MKT_GenProd_Lst_C $MKT_Key$,'$Language_code$'"
            
            .ConfigGrid(1).Visible = False
            .ConfigGrid(1).Request = ""
            
            .FaceToolbar = "0"
        End With
    End With
    
 '------- Products_S
    With mt_ClassInfoLst(11)
        With .ConfigRecord
            .IndexFrame = 6
            .NameFrame = "CD_Products_S"
            .Initialized = False
            .ExistAttach = True
            .IndexClassAtt = 4
            .RequestAdd = ""
                                                
            .RequestUpd = "exec MKT_GenProd_Upd $MKT_GP_Key$," & _
                                                "$GP_Year$," & _
                                                "$GP_Type_code$," & _
                                                "'$GP_Item$'," & _
                                                "$GP_Pricing$," & _
                                                "'$CURR_Code$'," & _
                                                "$GP_Posit_Type_code$," & _
                                                "$GP_Volume$," & _
                                                "'$UM_Code$'," & _
                                                "'$GP_Source$'," & _
                                                "'$GP_Comment$'," & _
                                                "$Z_last_upd_user$," & _
                                                "$iConcurrency$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"
    
            .RequestView = "exec MKT_GenProd_Sel $Key$,'$Language_code$'"
            
            ReDim .ListFieldsDefaultValue(5, 1)
            Set .ListFieldsDefaultValue(0, 0) = txt_Product_Volume
             .ListFieldsDefaultValue(0, 1) = "0"
            Set .ListFieldsDefaultValue(1, 0) = cbo_Product_Unit_of_Measure
             .ListFieldsDefaultValue(1, 1) = "M2" & SEP1 & "Square metre"
            Set .ListFieldsDefaultValue(2, 0) = txt_SalesEst_Value
             .ListFieldsDefaultValue(2, 1) = "0"
            Set .ListFieldsDefaultValue(3, 0) = cbo_Product_Currency
             .ListFieldsDefaultValue(3, 1) = "EUR" & SEP1 & "European Monetary Unit (EURO)"
            Set .ListFieldsDefaultValue(4, 0) = cbo_Product_GP_Type
             .ListFieldsDefaultValue(4, 1) = "1" & SEP1 & "New Product Introduction"
            Set .ListFieldsDefaultValue(5, 0) = txt_Product_Price
             .ListFieldsDefaultValue(5, 1) = "0"
            
            ReDim .ListFieldsMandatory(4, 1)
            Set .ListFieldsMandatory(0, 0) = cbo_Product_Year
             .ListFieldsMandatory(0, 1) = 165
            Set .ListFieldsMandatory(1, 0) = cbo_Product_GP_Type
             .ListFieldsMandatory(1, 1) = 167
            Set .ListFieldsMandatory(2, 0) = txt_Product_Item
             .ListFieldsMandatory(2, 1) = 163
            Set .ListFieldsMandatory(3, 0) = cbo_Product_Price_Positioning
             .ListFieldsMandatory(3, 1) = 161
            Set .ListFieldsMandatory(4, 0) = txt_Product_Source
             .ListFieldsMandatory(4, 1) = 166
            
            ReDim .ListFieldsToDisable(0)
            Set .ListFieldsToDisable(0) = cbo_Product_GP_Type
            
            .TableName = "MKT_GenProd"
            .UpdateMsg(0, 0) = "2133"
            .UpdateMsg(0, 1) = "#You cannot update this Product record."
            
        End With
        
        With .ConfigDetail
            .ConfigGrid(0).Visible = True
            ReDim .ConfigGrid(0).Columns(10)
            .ConfigGrid(0).Columns(0) = Join(Array("Key", 0, 1, "Key", "#Key"), SEP)
            .ConfigGrid(0).Columns(1) = Join(Array("GP_Year", 600, 0, "GP_Year", "#Year"), SEP)
            .ConfigGrid(0).Columns(2) = Join(Array("CT_Desc", 1000, 0, "CT_Desc", "#Country"), SEP)
            .ConfigGrid(0).Columns(3) = Join(Array("GP_Type_Desc", 1600, 0, "GP_Type_Desc", "#Type"), SEP)
            .ConfigGrid(0).Columns(4) = Join(Array("GP_Item", 1000, 0, "GP_Item", "#Item"), SEP)
            .ConfigGrid(0).Columns(5) = Join(Array("GP_Pricing", 800, 0, "GP_Pricing", "#Price", "Float", "0.00"), SEP)
            .ConfigGrid(0).Columns(6) = Join(Array("CURR_desc", 1000, 0, "CURR_desc", "#Currency"), SEP)
            .ConfigGrid(0).Columns(7) = Join(Array("GP_Volume", 1000, 0, "GP_Volume", "#Quantity", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(8) = Join(Array("UM_desc", 1000, 0, "UM_desc", "#Unit of Measure"), SEP)
            .ConfigGrid(0).Columns(9) = Join(Array("GP_Posit_Type_desc", 1000, 0, "GP_Posit_Type_desc", "#Positioning"), SEP)
            .ConfigGrid(0).Columns(10) = Join(Array("Attachment", 1000, 0, "Attachment", "#Attachment", "string", "", "center"), SEP)
            
            
            .ConfigGrid(0).Request = "exec MKT_GenProd_Lst_S $MKT_Key$,'$Language_code$'"
            
            .ConfigGrid(1).Visible = False
            .ConfigGrid(1).Request = ""
            
            .FaceToolbar = "5"
        End With
    End With
    
'------- Sales Reps
    With mt_ClassInfoLst(12)
        With .ConfigRecord
            .IndexFrame = 2
            .NameFrame = "CD_SalesReps"
            .Initialized = False
            .RequestAdd = "exec MKT_SO_People_Ins $MKT_SO_Key$," & _
                                                        "'$Language_Code$'," & _
                                                        "$MKT_SOPeople_key$," & _
                                                        "'$SOP_name$'," & _
                                                        "$SOP_BeginYR_Comp$," & _
                                                        "$SOP_BeginYR_Ind$," & _
                                                        "'$SOP_LeftFlag$'," & _
                                                        "'$SOP_Source$'," & _
                                                        "'$SOP_Comment$'," & _
                                                        "$Z_Creator_User$," & _
                                                        "'$Spare1_varchar$'," & _
                                                        "'$Spare2_varchar$'," & _
                                                        "$Spare3_real$," & _
                                                        "$Spare4_real$"

            .RequestUpd = "exec MKT_SO_People_Upd $MKT_SOPeople_key$," & _
                                                        "'$SOP_name$'," & _
                                                        "$SOP_BeginYR_Comp$," & _
                                                        "$SOP_BeginYR_Ind$," & _
                                                        "'$SOP_LeftFlag$'," & _
                                                        "'$SOP_Source$'," & _
                                                        "'$SOP_Comment$'," & _
                                                        "$Z_last_upd_user$," & _
                                                        "$iConcurrency$," & _
                                                        "'$Spare1_varchar$'," & _
                                                        "'$Spare2_varchar$'," & _
                                                        "$Spare3_real$," & _
                                                        "$Spare4_real$"

            .RequestDel = "exec MKT_SO_People_Del $MKT_SOPeople_Key$," & _
                                                        "$Z_Last_Upd_User$," & _
                                                        "$iConcurrency$"

            
            .RequestView = "exec MKT_SO_People_sel $Key$, '$Language_code$'"
            
            ReDim .ListFieldsDefaultValue(0, 1)
            Set .ListFieldsDefaultValue(0, 0) = chk_SalesReps_HasLeftComp
             .ListFieldsDefaultValue(0, 1) = vbUnchecked
             
             
            ReDim .ListFieldsMandatory(1, 1)
            Set .ListFieldsMandatory(0, 0) = txt_SalesReps_Name
             .ListFieldsMandatory(0, 1) = 16
            Set .ListFieldsMandatory(1, 0) = txt_SalesReps_Source
             .ListFieldsMandatory(1, 1) = 52
            
            ReDim .ListFieldsToDisable(-1 To -1)
            
            .TableName = "MKT_SO_People"
            .DeleteMsg(0, 0) = "2118"
            .DeleteMsg(0, 1) = "#Do you really want to delete this Sales Rep record?"
            .UpdateMsg(0, 0) = "2119"
            .UpdateMsg(0, 1) = "#You cannot update this Sales Rep record."
        End With
    End With
    
'------- Location
    With mt_ClassInfoLst(13)
        With .ConfigRecord
            .IndexFrame = 10
            .NameFrame = "CD_Location"
            .Initialized = False
            .ExistAttach = True
            .IndexClassAtt = 3
            .RequestAdd = "exec MKT_Location_Ins $MKT_Key$," & _
                                                "'$Language_code$'," & _
                                                "$MKT_LOC_Key$," & _
                                                "$MKT_LOC_Year$," & _
                                                "'$MKT_Owner$'," & _
                                                "'$MKT_Location$'," & _
                                                "'$ML_Source$'," & _
                                                "'$ML_Comment$'," & _
                                                "$Z_Creator_User$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"
                                                
                                                
            .RequestUpd = "exec MKT_Location_Upd $MKT_LOC_Key$," & _
                                                "$MKT_LOC_Year$," & _
                                                "'$MKT_Owner$'," & _
                                                "'$MKT_Location$'," & _
                                                "'$ML_Source$'," & _
                                                "'$ML_Comment$'," & _
                                                "$Z_last_upd_user$," & _
                                                "$iConcurrency$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"

  
                                                
            .RequestDel = "exec MKT_Location_Del $MKT_LOC_Key$," & _
                                            "$Z_last_upd_user$," & _
                                            "$iConcurrency$"
            
            .RequestView = "exec MKT_Location_Sel $Key$,'$Language_code$'"
            
            .RequestCheckDelete = "exec MKT_Location_CheckDelete $Key$,'$Language_code$'"
            
            ReDim .ListFieldsDefaultValue(-1 To -1)
            
            ReDim .ListFieldsMandatory(1, 1)
            Set .ListFieldsMandatory(0, 0) = cbo_Location_Year
             .ListFieldsMandatory(0, 1) = 361
            Set .ListFieldsMandatory(1, 0) = txt_Location_Source
             .ListFieldsMandatory(1, 1) = 362
             
            ReDim .ListFieldsToDisable(-1 To -1)
            
            .TableName = "MKT_Location"
            .DeleteMsg(0, 0) = "2117"
            .DeleteMsg(0, 1) = "#Do you really want to delete this Location record?"
            .UpdateMsg(0, 0) = "2133"
            .UpdateMsg(0, 1) = "#You can not update this Location record."
            .CheckDelMsg(0, 0) = "2105"
            .CheckDelMsg(0, 1) = "#You cannot delete this record." & vbCrLf & "You have some attachments linked to this records." & vbCrLf & "You must delete it before being able to delete this record."
        End With
        
        With .ConfigDetail
            .ConfigGrid(0).Visible = True
            ReDim .ConfigGrid(0).Columns(5)
            .ConfigGrid(0).Columns(0) = Join(Array("Key", 0, 1, "Key", "#Key"), SEP)
            .ConfigGrid(0).Columns(1) = Join(Array("MKT_LOC_Year", 600, 0, "MKT_LOC_Year", "#Year"), SEP)
            .ConfigGrid(0).Columns(2) = Join(Array("MKT_Owner", 2650, 0, "MKT_Owner", "#Owner"), SEP)
            .ConfigGrid(0).Columns(3) = Join(Array("MKT_Location", 2650, 0, "MKT_Location", "#HQ"), SEP)
            .ConfigGrid(0).Columns(4) = Join(Array("ML_Comment", 2650, 0, "ML_Comment", "#Comment"), SEP)
            .ConfigGrid(0).Columns(5) = Join(Array("Attachment", 1000, 0, "Attachment", "#Attachment", "string", "", "center"), SEP)
            
            .ConfigGrid(0).Request = "exec MKT_Location_lst $MKT_Key$,'$Language_code$'"
            
            .ConfigGrid(1).Visible = False
            .ConfigGrid(1).Request = ""
            .FaceToolbar = "0"
        End With
        
    End With
    
'------- Business Model
    With mt_ClassInfoLst(14)
        With .ConfigRecord
            .IndexFrame = 11
            .NameFrame = "CD_BusinessModel"
            .Initialized = False
            .ExistAttach = True
            .IndexClassAtt = 1
            .RequestAdd = "exec MKT_BusMod_Ins $MKT_Key$," & _
                                                "'$Language_code$'," & _
                                                "$MKT_BM_Key$," & _
                                                "$MKT_BM_Year$," & _
                                                "$BM_Type_code$," & _
                                                "'$MKT_BM_Comments$'," & _
                                                "'$MKT_BM_Source$'," & _
                                                "$Z_Creator_User$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"
                                                
                                                
            .RequestUpd = "exec MKT_BusMod_Upd $MKT_BM_Key$," & _
                                                "$MKT_BM_Year$," & _
                                                "$BM_Type_code$," & _
                                                "'$MKT_BM_Comments$'," & _
                                                "'$MKT_BM_Source$'," & _
                                                "$Z_last_upd_user$," & _
                                                "$iConcurrency$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"

  
                                                
            .RequestDel = "exec MKT_BusMod_Del $MKT_BM_Key$," & _
                                            "$Z_last_upd_user$," & _
                                            "$iConcurrency$"
            
            .RequestView = "exec MKT_BusMod_Sel $Key$,'$Language_code$'"
            
            '.RequestCheck = ""
            .RequestCheckDelete = "exec MKT_BusMod_CheckDelete $Key$,'$Language_code$'"
            
            ReDim .ListFieldsDefaultValue(-1 To -1)
            
            ReDim .ListFieldsMandatory(2, 1)
            Set .ListFieldsMandatory(0, 0) = cbo_BusMod_Year
             .ListFieldsMandatory(0, 1) = 410
            Set .ListFieldsMandatory(1, 0) = cbo_BusMod_Type
             .ListFieldsMandatory(1, 1) = 411
            Set .ListFieldsMandatory(2, 0) = txt_BusMod_Source
             .ListFieldsMandatory(2, 1) = 412
             
            ReDim .ListFieldsToDisable(0)
            Set .ListFieldsToDisable(0) = cbo_BusMod_Type
            
            .TableName = "MKT_BusMod"
            .DeleteMsg(0, 0) = "2117"
            .DeleteMsg(0, 1) = "#Do you really want to delete this Business Model record?"
            .UpdateMsg(0, 0) = "2133"
            .UpdateMsg(0, 1) = "#You can not update this Business Model record."
            .CheckDelMsg(0, 0) = "2105"
            .CheckDelMsg(0, 1) = "#You cannot delete this record." & vbCrLf & "You have some attachments linked to this records." & vbCrLf & "You must delete it before being able to delete this record."
           
        End With
        
        With .ConfigDetail
            .ConfigGrid(0).Visible = True
            ReDim .ConfigGrid(0).Columns(4)
            .ConfigGrid(0).Columns(0) = Join(Array("Key", 0, 1, "Key", "#Key"), SEP)
            .ConfigGrid(0).Columns(1) = Join(Array("MKT_BM_Year", 600, 0, "MKT_BM_Year", "#Year"), SEP)
            .ConfigGrid(0).Columns(2) = Join(Array("BM_Type_desc", 2000, 0, "BM_Type_desc", "#Type"), SEP)
            .ConfigGrid(0).Columns(3) = Join(Array("MKT_BM_Comments", 6000, 0, "MKT_BM_Comments", "#Comment"), SEP)
            .ConfigGrid(0).Columns(4) = Join(Array("Attachment", 1000, 0, "Attachment", "#Attachment", "string", "", "center"), SEP)
            
            .ConfigGrid(0).Request = "exec MKT_BusMod_lst $MKT_Key$,'$Language_code$'"
            
            .ConfigGrid(1).Visible = False
            .ConfigGrid(1).Request = ""
            .FaceToolbar = "0"
        End With
        
    End With
    
'------>>>>>>>>> Production
    With mt_ClassInfoLst(15)
        With .ConfigRecord
            .IndexFrame = 12
            .NameFrame = "CD_Production"
            .Initialized = False
            .ExistAttach = False
            .RequestAdd = "exec MKT_Production_Ins $MKT_Key$," & _
                                                "'$Language_code$'," & _
                                                "$MKT_PRD_Key$," & _
                                                "$PRD_Type_code$," & _
                                                "$PRD_Year$," & _
                                                "'$PRD_Location$'," & _
                                                "'$CT_Code$'," & _
                                                "$PRD_Cap$," & _
                                                "'$UM_Code$'," & _
                                                "'$PRD_Tech$'," & _
                                                "'$PRD_Source$'," & _
                                                "'$PRD_Comments$'," & _
                                                "$Z_Creator_User$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"

                                                
            .RequestUpd = "exec MKT_Production_Upd $MKT_PRD_Key$," & _
                                                "$PRD_Type_code$," & _
                                                "$PRD_Year$," & _
                                                "'$PRD_Location$'," & _
                                                "'$CT_Code$'," & _
                                                "$PRD_Cap$," & _
                                                "'$UM_Code$'," & _
                                                "'$PRD_Tech$'," & _
                                                "'$PRD_Source$'," & _
                                                "'$PRD_Comments$'," & _
                                                "$Z_last_upd_user$," & _
                                                "$iConcurrency$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"

  
                                                
            .RequestDel = "exec MKT_Production_Del $MKT_PRD_Key$," & _
                                            "$Z_last_upd_user$," & _
                                            "$iConcurrency$"
            
            .RequestView = "exec MKT_Production_Sel $Key$,'$Language_code$'"
            
            .RequestCheck = ""
            
            ReDim .ListFieldsDefaultValue(2, 1)
            Set .ListFieldsDefaultValue(0, 0) = txt_Production_Capacity
             .ListFieldsDefaultValue(0, 1) = "0"
            Set .ListFieldsDefaultValue(1, 0) = cbo_Production_Unit_of_Measure
             .ListFieldsDefaultValue(1, 1) = "M2" & SEP1 & "Square metre"
            Set .ListFieldsDefaultValue(2, 0) = cbo_Production_Type
             .ListFieldsDefaultValue(2, 1) = "1" & SEP1 & "Plant"
            
            ReDim .ListFieldsMandatory(2, 1)
            Set .ListFieldsMandatory(0, 0) = cbo_Production_Type
             .ListFieldsMandatory(0, 1) = 429
            Set .ListFieldsMandatory(1, 0) = cbo_Production_Year
             .ListFieldsMandatory(1, 1) = 430
            Set .ListFieldsMandatory(2, 0) = txt_Production_Source
             .ListFieldsMandatory(2, 1) = 436
             
            ReDim .ListFieldsToDisable(0)
            Set .ListFieldsToDisable(0) = cbo_Production_Type
            
            .TableName = "MKT_Production"
            .DeleteMsg(0, 0) = "2117"
            .DeleteMsg(0, 1) = "#Do you really want to delete this Production record?"
            .UpdateMsg(0, 0) = "2133"
            .UpdateMsg(0, 1) = "#You cannot update this Production record."
            '.CheckMsg = "#You must .............................................................."
            
        End With
        
        With .ConfigDetail
            .ConfigGrid(0).Visible = True
            ReDim .ConfigGrid(0).Columns(8)
            .ConfigGrid(0).Columns(0) = Join(Array("Key", 0, 1, "Key", "#Key"), SEP)
            .ConfigGrid(0).Columns(1) = Join(Array("PRD_Year", 800, 0, "PRD_Year", "#Year"), SEP)
            .ConfigGrid(0).Columns(2) = Join(Array("PRD_Type_desc", 1000, 0, "PRD_Type_desc", "#Type"), SEP)
            .ConfigGrid(0).Columns(3) = Join(Array("PRD_Location", 1000, 0, "PRD_Location", "#Location"), SEP)
            .ConfigGrid(0).Columns(4) = Join(Array("CT_desc", 1000, 0, "CT_desc", "#Country"), SEP)
            .ConfigGrid(0).Columns(5) = Join(Array("PRD_Comments", 1000, 0, "PRD_Comments", "#Comments"), SEP)
            .ConfigGrid(0).Columns(6) = Join(Array("PRD_Cap", 1000, 0, "PRD_Cap", "#Capacity", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(7) = Join(Array("UM_desc", 1000, 0, "UM_desc", "#Unit of Measure"), SEP)
            .ConfigGrid(0).Columns(8) = Join(Array("PRD_Tech", 1000, 0, "PRD_Tech", "#Technology"), SEP)
            
            .ConfigGrid(0).Request = "exec MKT_Production_lst $MKT_Key$,'$Language_code$'"
            
            .ConfigGrid(1).Visible = False
            .ConfigGrid(1).Request = ""
            
            ReDim .ConfigGrid(2).Columns(2) 'For the aggregate function
            .ConfigGrid(2).Columns(0) = Join(Array("PRD_Year", 800, 0, "PRD_Year", "#Year"), SEP)
            .ConfigGrid(2).Columns(1) = Join(Array("PRD_Cap", 1000, 0, "PRD_Cap", "#Capacity"), SEP)
            .ConfigGrid(2).Columns(2) = Join(Array("UM_desc", 1000, 0, "UM_desc", "#Unit of Measure"), SEP)
            
            .ConfigGrid(2).Request = "exec MKT_Production_Lst_Agg $MKT_Key$,'$Language_code$'"
            
            .FaceToolbar = "1"
        End With
        
    End With
    
'------>>>>>>>>> Financial_C
    With mt_ClassInfoLst(16)
        With .ConfigRecord
            .IndexFrame = 7
            .NameFrame = "CD_Financial_C"
            .Initialized = False
            .ExistAttach = True
            .IndexClassAtt = 7
            .RequestAdd = "exec MKT_Financial_Ins $MKT_Key$," & _
                                                "$MKT_Fin_Key$," & _
                                                "'$Language_code$'," & _
                                                "$FIN_Year$," & _
                                                "$FIN_TO$," & _
                                                "'$FIN_To_CURR_code$'," & _
                                                "$FIN_TO_EURO$," & _
                                                "$FIN_PL$," & _
                                                "'$FIN_PL_CURR_code$'," & _
                                                "$FIN_PL_EURO$," & _
                                                "$FIN_PM$," & _
                                                "$FIN_NumberEmpl$," & _
                                                "'$FIN_Source$'," & _
                                                "'$FIN_Comment$'," & _
                                                "$Z_Creator_User$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"
            
            .RequestUpd = "exec MKT_Financial_Upd $MKT_Fin_Key$," & _
                                                "$FIN_Year$," & _
                                                "$FIN_TO$," & _
                                                "'$FIN_To_CURR_code$'," & _
                                                "$FIN_TO_EURO$," & _
                                                "$FIN_PL$," & _
                                                "'$FIN_PL_CURR_code$'," & _
                                                "$FIN_PL_EURO$," & _
                                                "$FIN_PM$," & _
                                                "$FIN_NumberEmpl$," & _
                                                "'$FIN_Source$'," & _
                                                "'$FIN_Comment$'," & _
                                                "$Z_last_upd_user$," & _
                                                "$iConcurrency$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"



            .RequestDel = "exec MKT_Financial_Del $MKT_Fin_Key$," & _
                                            "$Z_last_upd_user$," & _
                                            "$iConcurrency$"

            .RequestView = "exec MKT_Financial_Sel $Key$,'$Language_code$'"

            .RequestCheck = "exec MKT_Financial_CheckUnicity '$Language_Code$'," & _
                                                            "$MKT_Key$," & _
                                                            "$FIN_Year$"
                                                            
            .RequestCheckDelete = "exec MKT_Financial_CheckDelete $Key$,'$Language_code$'"

            ReDim .ListFieldsDefaultValue(7, 1)
            Set .ListFieldsDefaultValue(0, 0) = cbo_Financial_Fin_Currency
             .ListFieldsDefaultValue(0, 1) = "EUR" & SEP1 & "European Monetary Unit (EURO)"
            Set .ListFieldsDefaultValue(1, 0) = cbo_Financial_Fin_PL_Currency
             .ListFieldsDefaultValue(1, 1) = "EUR" & SEP1 & "European Monetary Unit (EURO)"
            Set .ListFieldsDefaultValue(2, 0) = txt_Financial_Profit_Loss
             .ListFieldsDefaultValue(2, 1) = "0"
            Set .ListFieldsDefaultValue(3, 0) = txt_Financial_Number_of_Employees
             .ListFieldsDefaultValue(3, 1) = "0"
            Set .ListFieldsDefaultValue(4, 0) = txt_Financial_Profit_Margin
             .ListFieldsDefaultValue(4, 1) = "0"
            Set .ListFieldsDefaultValue(5, 0) = txt_Financial_Profit_Loss_Euro
             .ListFieldsDefaultValue(5, 1) = "0"
            Set .ListFieldsDefaultValue(6, 0) = txt_Financial_TurnOver
             .ListFieldsDefaultValue(6, 1) = "0"
            Set .ListFieldsDefaultValue(7, 0) = txt_Financial_Turnover_Euro
             .ListFieldsDefaultValue(7, 1) = "0"
            
            ReDim .ListFieldsMandatory(1, 1)
            Set .ListFieldsMandatory(0, 0) = cbo_Financial_Year
             .ListFieldsMandatory(0, 1) = 216
            Set .ListFieldsMandatory(1, 0) = txt_Financial_Source
             .ListFieldsMandatory(1, 1) = 215

            ReDim .ListFieldsToDisable(-1 To -1)
            
            .TableName = "MKT_Financial"
            .DeleteMsg(0, 0) = "2117"
            .DeleteMsg(0, 1) = "#Do you really want to delete this Financial record?"
            .UpdateMsg(0, 0) = "2133"
            .UpdateMsg(0, 1) = "#You can not update this Financial record."
            .CheckMsg(0, 0) = "2113"
            .CheckMsg(0, 1) = "#You can only have one Financial per competitor, per country and per year. This record is already in the database."
            .CheckDelMsg(0, 0) = "2105"
            .CheckDelMsg(0, 1) = "#You cannot delete this record." & vbCrLf & "You have some attachments linked to this records." & vbCrLf & "You must delete it before being able to delete this record."
        
        End With

        With .ConfigDetail
            .ConfigGrid(0).Visible = True
            ReDim .ConfigGrid(0).Columns(6)
            .ConfigGrid(0).Columns(0) = Join(Array("Key", 0, 1, "Key", "#Key"), SEP)
            .ConfigGrid(0).Columns(1) = Join(Array("FIN_Year", 600, 0, "FIN_Year", "#Year"), SEP)
            .ConfigGrid(0).Columns(2) = Join(Array("FIN_TO_EURO", 2000, 0, "FIN_TO_EURO", "#Turnover (Euro)", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(3) = Join(Array("FIN_PL_EURO", 2000, 0, "FIN_PL_EURO", "#Profil/Loss (Euro)", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(4) = Join(Array("FIN_PM", 1300, 0, "FIN_PM", "#Margin", "Float", "0.00"), SEP)
            .ConfigGrid(0).Columns(5) = Join(Array("FIN_NumberEmpl", 1300, 0, "FIN_NumberEmpl", "#No Employees", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(6) = Join(Array("Attachment", 1000, 0, "Attachment", "#Attachment", "string", "", "center"), SEP)

            .ConfigGrid(0).Request = "exec MKT_Financial_lst_C $MKT_Key$,'$Language_code$'"

            .ConfigGrid(1).Visible = False
            .ConfigGrid(1).Request = ""


            .FaceToolbar = "0"
        End With
    End With
'------>>>>>>>>> Financial_S
    With mt_ClassInfoLst(17)
        With .ConfigRecord
            .IndexFrame = 7
            .NameFrame = "CD_Financial_S"
            .Initialized = False
            .ExistAttach = True
            .IndexClassAtt = 7
            .RequestAdd = "exec MKT_Financial_Ins $MKT_Key$," & _
                                                "$MKT_Fin_Key$," & _
                                                "'$Language_code$'," & _
                                                "$FIN_Year$," & _
                                                "$FIN_TO$," & _
                                                "'$FIN_To_CURR_code$'," & _
                                                "$FIN_TO_EURO$," & _
                                                "$FIN_PL$," & _
                                                "'$FIN_PL_CURR_code$'," & _
                                                "$FIN_PL_EURO$," & _
                                                "$FIN_PM$," & _
                                                "$FIN_NumberEmpl$," & _
                                                "'$FIN_Source$'," & _
                                                "'$FIN_Comment$'," & _
                                                "$Z_Creator_User$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"
            
            .RequestUpd = "exec MKT_Financial_Upd $MKT_Fin_Key$," & _
                                                "$FIN_Year$," & _
                                                "$FIN_TO$," & _
                                                "'$FIN_To_CURR_code$'," & _
                                                "$FIN_TO_EURO$," & _
                                                "$FIN_PL$," & _
                                                "'$FIN_PL_CURR_code$'," & _
                                                "$FIN_PL_EURO$," & _
                                                "$FIN_PM$," & _
                                                "$FIN_NumberEmpl$," & _
                                                "'$FIN_Source$'," & _
                                                "'$FIN_Comment$'," & _
                                                "$Z_last_upd_user$," & _
                                                "$iConcurrency$," & _
                                                "'$Spare1_varchar$'," & _
                                                "'$Spare2_varchar$'," & _
                                                "$Spare3_real$," & _
                                                "$Spare4_real$"



            .RequestDel = "exec MKT_Financial_Del $MKT_Fin_Key$," & _
                                            "$Z_last_upd_user$," & _
                                            "$iConcurrency$"

            .RequestView = "exec MKT_Financial_Sel $Key$,'$Language_code$'"

            .RequestCheck = "exec MKT_Financial_CheckUnicity '$Language_Code$'," & _
                                                            "$MKT_Key$," & _
                                                            "$FIN_Year$"
            
            .RequestCheckDelete = "exec MKT_Financial_CheckDelete $Key$,'$Language_code$'"

            ReDim .ListFieldsDefaultValue(7, 1)
            Set .ListFieldsDefaultValue(0, 0) = cbo_Financial_Fin_Currency
             .ListFieldsDefaultValue(0, 1) = "EUR" & SEP1 & "European Monetary Unit (EURO)"
            Set .ListFieldsDefaultValue(1, 0) = cbo_Financial_Fin_PL_Currency
             .ListFieldsDefaultValue(1, 1) = "EUR" & SEP1 & "European Monetary Unit (EURO)"
            Set .ListFieldsDefaultValue(2, 0) = txt_Financial_Profit_Loss
             .ListFieldsDefaultValue(2, 1) = "0"
            Set .ListFieldsDefaultValue(3, 0) = txt_Financial_Number_of_Employees
             .ListFieldsDefaultValue(3, 1) = "0"
            Set .ListFieldsDefaultValue(4, 0) = txt_Financial_Profit_Margin
             .ListFieldsDefaultValue(4, 1) = "0"
            Set .ListFieldsDefaultValue(5, 0) = txt_Financial_Profit_Loss_Euro
             .ListFieldsDefaultValue(5, 1) = "0"
            Set .ListFieldsDefaultValue(6, 0) = txt_Financial_TurnOver
             .ListFieldsDefaultValue(6, 1) = "0"
            Set .ListFieldsDefaultValue(7, 0) = txt_Financial_Turnover_Euro
             .ListFieldsDefaultValue(7, 1) = "0"
            
            ReDim .ListFieldsMandatory(1, 1)
            Set .ListFieldsMandatory(0, 0) = cbo_Financial_Year
             .ListFieldsMandatory(0, 1) = 216
            Set .ListFieldsMandatory(1, 0) = txt_Financial_Source
             .ListFieldsMandatory(1, 1) = 215
            
            ReDim .ListFieldsToDisable(-1 To -1)
            
            .TableName = "MKT_Financial"
            
            .DeleteMsg(0, 0) = "2117"
            .DeleteMsg(0, 1) = "#Do you really want to delete this Financial record?"
            .UpdateMsg(0, 0) = "2133"
            .UpdateMsg(0, 1) = "#You can not update this Financial record."
            .CheckMsg(0, 0) = "2114"
            .CheckMsg(0, 1) = "#You can only have one Financial strategic per competitor and per year. This record is already in the database."
            .CheckDelMsg(0, 0) = "2105"
            .CheckDelMsg(0, 1) = "#You cannot delete this record." & vbCrLf & "You have some attachments linked to this records." & vbCrLf & "You must delete it before being able to delete this record."
        End With

        With .ConfigDetail
            .ConfigGrid(0).Visible = True
            ReDim .ConfigGrid(0).Columns(7)
            .ConfigGrid(0).Columns(0) = Join(Array("Key", 0, 1, "Key", "#Key"), SEP)
            .ConfigGrid(0).Columns(1) = Join(Array("FIN_Year", 600, 0, "FIN_Year", "#Year"), SEP)
            .ConfigGrid(0).Columns(2) = Join(Array("Level", 800, 0, "Level", ""), SEP)
            .ConfigGrid(0).Columns(3) = Join(Array("FIN_TO_EURO", 2000, 0, "FIN_TO_EURO", "#Turnover (Euro)", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(4) = Join(Array("FIN_PL_EURO", 2000, 0, "FIN_PL_EURO", "#Profil/Loss (Euro)", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(5) = Join(Array("FIN_PM", 1300, 0, "FIN_PM", "#Margin", "Float", "0.00"), SEP)
            .ConfigGrid(0).Columns(6) = Join(Array("FIN_NumberEmpl", 1300, 0, "FIN_NumberEmpl", "#No Employees", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(7) = Join(Array("Attachment", 1000, 0, "Attachment", "#Attachment", "string", "", "center"), SEP)

            .ConfigGrid(0).Request = "exec MKT_Financial_lst_S_G1 $MKT_Key$,'$Language_code$'"


            .ConfigGrid(1).Visible = True
            ReDim .ConfigGrid(1).Columns(8)
            .ConfigGrid(1).Columns(0) = Join(Array("Key", 0, 1, "Key", "#Key"), SEP)
            .ConfigGrid(1).Columns(1) = Join(Array("MKT_Key", 0, 1, "MKT_Key", "#Master_Key"), SEP)
            .ConfigGrid(1).Columns(2) = Join(Array("FIN_Year", 600, 0, "FIN_Year", "#Year"), SEP)
            .ConfigGrid(1).Columns(3) = Join(Array("CT_desc", 1000, 0, "CT_desc", "#Country"), SEP)
            .ConfigGrid(1).Columns(4) = Join(Array("FIN_TO_EURO", 2000, 0, "FIN_TO_EURO", "#Turnover (Euro)", "Float", "0"), SEP)
            .ConfigGrid(1).Columns(5) = Join(Array("FIN_PL_EURO", 2000, 0, "FIN_PL_EURO", "#Profil/Loss (Euro)", "Float", "0"), SEP)
            .ConfigGrid(1).Columns(6) = Join(Array("FIN_PM", 1300, 0, "FIN_PM", "#Margin", "Float", "0.00"), SEP)
            .ConfigGrid(1).Columns(7) = Join(Array("FIN_NumberEmpl", 1300, 0, "FIN_NumberEmpl", "#No Employees", "Float", "0"), SEP)
            .ConfigGrid(1).Columns(8) = Join(Array("Attachment", 1000, 0, "Attachment", "#Attachment", "string", "", "center"), SEP)

            .ConfigGrid(1).Request = "exec MKT_Financial_lst_S_G2 $MKT_Key$,'$Language_code$',$FIN_Year$"

            .ConfigGrid(2).Visible = True
            ReDim .ConfigGrid(2).Columns(3)
            .ConfigGrid(2).Columns(0) = Join(Array("FIN_Year", 600, 0, "FIN_Year", "#Year"), SEP)
            .ConfigGrid(2).Columns(1) = Join(Array("FIN_TO_EURO", 2000, 0, "FIN_TO_EURO", "#Turnover (Euro)", "Float", "0"), SEP)
            .ConfigGrid(2).Columns(2) = Join(Array("FIN_PL_EURO", 2000, 0, "FIN_PL_EURO", "#Profil/Loss (Euro)", "Float", "0"), SEP)
            .ConfigGrid(2).Columns(3) = Join(Array("FIN_NumberEmpl", 1300, 0, "FIN_NumberEmpl", "#No Employees", "Float", "0"), SEP)

            .ConfigGrid(2).Request = "exec MKT_Financial_lst_S_G1_Agg $MKT_Key$,'$Language_code$'"

            .ConfigGrid(3).Visible = True
            ReDim .ConfigGrid(3).Columns(3)
            .ConfigGrid(3).Columns(0) = Join(Array("FIN_Year", 600, 0, "FIN_Year", "#Year"), SEP)
            .ConfigGrid(3).Columns(1) = Join(Array("FIN_TO_EURO", 2000, 0, "FIN_TO_EURO", "#Turnover (Euro)", "Float", "0"), SEP)
            .ConfigGrid(3).Columns(2) = Join(Array("FIN_PL_EURO", 2000, 0, "FIN_PL_EURO", "#Profil/Loss (Euro)", "Float", "0"), SEP)
            .ConfigGrid(3).Columns(3) = Join(Array("FIN_NumberEmpl", 1300, 0, "FIN_NumberEmpl", "#No Employees", "Float", "0"), SEP)

            .ConfigGrid(3).Request = "exec MKT_Financial_lst_S_G2_Agg $MKT_Key$,'$Language_code$',$FIN_Year$"

            .FaceToolbar = "1"
        End With
    End With

'------- Channel_PE
    With mt_ClassInfoLst(18)
        With .ConfigRecord
            .IndexFrame = 51
            .NameFrame = "CD_Channel_PE"
            .Initialized = False
            .RequestAdd = "exec MKT_Channel_PE_ins $MKT_CHNL_PE_Key$," & _
                                                        "$MKT_CHNL_Key$," & _
                                                        "'$Language_Code$'," & _
                                                        "$SC_Code$," & _
                                                        "$BM_code$," & _
                                                        "$PE_Value$," & _
                                                        "'$CURR_Code$'," & _
                                                        "$PE_Volume$," & _
                                                        "'$UM_Code$'," & _
                                                        "'$PE_Comment$'," & _
                                                        "'$PE_Source$'," & _
                                                        "$Z_Last_Upd_User$," & _
                                                        "'$Spare1_varchar$'," & _
                                                        "'$Spare2_varchar$'," & _
                                                        "$Spare3_real$," & _
                                                        "$Spare4_real$"

                                                
            .RequestUpd = "exec MKT_Channel_PE_upd $MKT_CHNL_PE_Key$," & _
                                                        "$SC_Code$," & _
                                                        "$BM_code$," & _
                                                        "$PE_Value$," & _
                                                        "'$CURR_Code$'," & _
                                                        "$PE_Volume$," & _
                                                        "'$UM_Code$'," & _
                                                        "'$PE_Comment$'," & _
                                                        "'$PE_Source$'," & _
                                                        "$Z_Last_Upd_User$," & _
                                                        "$iConcurrency$," & _
                                                        "'$Spare1_varchar$'," & _
                                                        "'$Spare2_varchar$'," & _
                                                        "$Spare3_real$," & _
                                                        "$Spare4_real$"

            .RequestDel = "exec MKT_Channel_PE_del $MKT_CHNL_PE_Key$," & _
                                                        "$Z_Last_Upd_User$," & _
                                                        "$iConcurrency$"
            
            .RequestView = "exec MKT_Channel_PE_sel $Key$,'$Language_Code$'"
            
            .RequestCheck = "exec MKT_Channel_PE_CheckUnicity '$Language_Code$'," & _
                                                        "$MKT_CHNL_Key$," & _
                                                        "$CHNL_Year$," & _
                                                        "$SC_Code$," & _
                                                        "$BM_code$"

            ReDim .ListFieldsDefaultValue(3, 1)
            Set .ListFieldsDefaultValue(0, 0) = txt_Channel_PE_Quantity
             .ListFieldsDefaultValue(0, 1) = "0"
            Set .ListFieldsDefaultValue(1, 0) = cbo_Channel_PE_UM
             .ListFieldsDefaultValue(1, 1) = "M2" & SEP1 & "Square metre"
            Set .ListFieldsDefaultValue(2, 0) = txt_Channel_PE_Value
             .ListFieldsDefaultValue(2, 1) = "0"
            Set .ListFieldsDefaultValue(3, 0) = cbo_Channel_PE_Curr
             .ListFieldsDefaultValue(3, 1) = "EUR" & SEP1 & "European Monetary Unit (EURO)"
            
            
            ReDim .ListFieldsMandatory(6, 1)
            Set .ListFieldsMandatory(0, 0) = cbo_Channel_PE_Category
             .ListFieldsMandatory(0, 1) = 470
            Set .ListFieldsMandatory(1, 0) = cbo_Channel_PE_BM
             .ListFieldsMandatory(1, 1) = 471
            Set .ListFieldsMandatory(2, 0) = txt_Channel_PE_Source
             .ListFieldsMandatory(2, 1) = 472
            Set .ListFieldsMandatory(3, 0) = txt_Channel_PE_Quantity
             .ListFieldsMandatory(3, 1) = 473
            Set .ListFieldsMandatory(4, 0) = cbo_Channel_PE_UM
             .ListFieldsMandatory(4, 1) = 485
            Set .ListFieldsMandatory(5, 0) = txt_Channel_PE_Value
             .ListFieldsMandatory(5, 1) = 474
            Set .ListFieldsMandatory(6, 0) = cbo_Channel_PE_Curr
             .ListFieldsMandatory(6, 1) = 486
             
            
            ReDim .ListFieldsToDisable(-1 To -1)
            
            .TableName = "MKT_Channel_PE"
            .DeleteMsg(0, 0) = "2139"
            .DeleteMsg(0, 1) = "#Do you really want to delete this Product record?"
            .UpdateMsg(0, 0) = "2140"
            .UpdateMsg(0, 1) = "#You cannot update this Product record."
            .CheckMsg(0, 0) = "2115"
            .CheckMsg(0, 1) = "#You can only have one Product per category and base item for a year. This record is already in the database."
        End With
        
        With .ConfigDetail
            .ConfigGrid(0).Visible = True
            ReDim .ConfigGrid(0).Columns(8)
            .ConfigGrid(0).Columns(0) = Join(Array("MKT_CHNL_PE_Key", 0, 1, "MKT_CHNL_PE_Key", "#MKT_CHNL_PE_Key"), SEP)
            .ConfigGrid(0).Columns(1) = Join(Array("SC_Desc", 1400, 0, "SC_Desc", "#Category"), SEP)
            .ConfigGrid(0).Columns(2) = Join(Array("SBM_Desc", 1400, 0, "SBM_Desc", "#SBM"), SEP)
            .ConfigGrid(0).Columns(3) = Join(Array("BM_Desc", 1400, 0, "BM_Desc", "#Base material"), SEP)
            .ConfigGrid(0).Columns(4) = Join(Array("PE_Volume", 1000, 0, "PE_Volume", "#Volume", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(5) = Join(Array("UM_Desc", 900, 0, "UM_Desc", "#UoM"), SEP)
            .ConfigGrid(0).Columns(6) = Join(Array("PE_Value", 1000, 0, "PE_Value", "#Value", "Float", "0"), SEP)
            .ConfigGrid(0).Columns(7) = Join(Array("CURR_Desc", 900, 0, "CURR_Desc", "#Currency"), SEP)
            .ConfigGrid(0).Columns(8) = Join(Array("PE_Comment", 2000, 0, "PE_Comment", "#Comment"), SEP)
            .ConfigGrid(0).Request = "exec MKT_Channel_PE_Lst $Key$, '$Language_Code$'"

            .ConfigGrid(1).Visible = True
            
            ReDim .ConfigGrid(1).Columns(4)
            .ConfigGrid(1).Columns(0) = Join(Array("SC_Desc", 1900, 0, "SC_Desc", "#Category"), SEP)
            .ConfigGrid(1).Columns(1) = Join(Array("PE_Volume", 1400, 0, "PE_Volume", "#Volume", "Float", "0"), SEP)
            .ConfigGrid(1).Columns(2) = Join(Array("UM_Desc", 1400, 0, "UM_Desc", "#UoM"), SEP)
            .ConfigGrid(1).Columns(3) = Join(Array("PE_Value", 1500, 0, "PE_Value", "#Value", "Float", "0"), SEP)
            .ConfigGrid(1).Columns(4) = Join(Array("CURR_Desc", 2300, 0, "CURR_Desc", "#Currency"), SEP)
            
            .ConfigGrid(1).Request = "exec MKT_Channel_PE_Lst_Agg $Key$, '$Language_Code$'"
            
        End With
        
        
    End With
    
    Exit Sub
    
errHandler:
    Call ErrorHandler("Load_ClassInfo")
    
End Sub

Private Sub InitCtrlSize()
On Error GoTo errHandler
    Const HSPACE As Long = 120
    Const VSPACE As Long = 120
    
    Call fra_filter.Move(HSPACE, VSPACE, 3975, UserControl.Height - (VSPACE * 2))
    tv_filter.Height = fra_filter.Height - tv_filter.top - VSPACE
    
    Dim lBuffer As Long
    lBuffer = fra_filter.left + fra_filter.Width + HSPACE
    Call fra_list.Move(lBuffer, VSPACE, UserControl.Width - lBuffer - HSPACE, UserControl.Height - (VSPACE * 2))
    Call fra_detail.Move(lBuffer, VSPACE, UserControl.Width - lBuffer - HSPACE, UserControl.Height - (VSPACE * 2))
    Call fra_item.Move(lBuffer, VSPACE, UserControl.Width - lBuffer - HSPACE, UserControl.Height - (VSPACE * 2))
    
    tlb_list.top = VSPACE * 2
    tlb_list.left = HSPACE
    tlb_list.Width = fra_list.Width - HSPACE * 2
    
    grd_List.top = fra_list.top + tlb_list.top + tlb_list.Height
    grd_List.left = HSPACE
    grd_List.Height = fra_list.Height - grd_List.top - VSPACE
    grd_List.Width = fra_list.Width - grd_List.left - HSPACE
    
    Exit Sub

errHandler:
    Call ErrorHandler("InitCtrlSize")

End Sub



Public Function Unload_A_Com() As Boolean

On Error GoTo errHandler

    If Not mb_Initialized Then Exit Function
    
    Dim lo_Control As Control
    
    For Each lo_Control In UserControl.Controls
        Select Case UCase(TypeName(lo_Control))
            Case "TOOLBARCONTROL", "ARMCOMBOBOX", "ARMGRID"
                lo_Control.Unload_A_Com
        End Select
    Next
    
        
    Set mo_FSO = Nothing
    
    Set mo_Db = Nothing
    
    mb_Initialized = False
    
    Unload_A_Com = True
    
    Exit Function
    
errHandler:
    Call ErrorHandler("Unload_A_Com")

End Function

Private Sub LoadDataToForm(ByVal ac_Cursor As Long, ByRef aControls As Variant, ByRef aContainer As Object)
On Error GoTo errHandler
   
    Dim lIdx As Long, lCount As Long
    Dim lControl As Control
    Dim lValues As Variant
    Dim ls_temptag As String
    
        lCount = aControls.Count - 1
    
        For lIdx = 0 To lCount
            Set lControl = aControls.Item(lIdx)
            If HasContainer(lControl, aContainer) Then
                Select Case UCase(TypeName(lControl))
                    Case "TEXTBOX"
                        If me_Mode = emUpdate And (UCase(lControl.Name) Like "TXT_FINANCIAL_TURNOVER_EURO" Or UCase(lControl.Name) Like "TXT_FINANCIAL_PROFIT_LOSS_EURO") Then
                            lControl.Text = ""
                        Else
                            ls_temptag = lControl.Tag & SEP
                            lValues = Split(ls_temptag, SEP)
                            If mo_Db.GetFieldIndex(ac_Cursor, lValues(0)) >= 0 Then
                                Select Case lValues(1)
                                    Case "Text"
                                        lControl.Text = mo_Db.GetFields(ac_Cursor, lValues(0))
                                    Case "Num"
                                        If (me_Mode = emView Or me_Mode = emDelete) And mb_ChangeSubItemNbFromat = False Then
                                            lControl.Text = FormatNumber(mo_Db.GetFields(ac_Cursor, lValues(0)), lValues(2))
                                        Else
                                            lControl.Text = Replace(mo_Db.GetFields(ac_Cursor, lValues(0)), ms_DecimalSeparator, ".", , , vbTextCompare)
                                        End If
                                End Select
                            End If
                        End If
                    
                    Case "ARMCOMBOBOX"
                        mb_internal = True
                        If mo_Db.GetFieldIndex(ac_Cursor, lControl.Tag) >= 0 Then
                            If mo_Db.GetFields(ac_Cursor, lControl.Tag) = 0 Or mo_Db.GetFields(ac_Cursor, lControl.Tag) = "" Then
                                Set lControl.SelectedItem = Nothing
                            Else
                                If lControl.SearchItem(mo_Db.GetFields(ac_Cursor, lControl.Tag), 0, 0, True) = False Then
                                    If Not lControl.AddItem(Array(mo_Db.GetFields(ac_Cursor, lControl.Tag), mo_Db.GetFields(ac_Cursor, Replace(lControl.Tag, "_code", "_desc", , , vbTextCompare)), mo_Db.GetFields(ac_Cursor, "BMK_code"), mo_Db.GetFields(ac_Cursor, "BMK_desc")), True) Is Nothing Then
                                        Select Case UCase(lControl.Name)
                                            Case "CBO_COMMUNICATION_TYPE"
                                                Call cbo_Communication_Type_ComboItemSelected
                                            Case "CBO_CHANNEL_TYPE"
                                                Call cbo_Channel_Type_ComboItemSelected
                                            Case "CBO_PRODUCTION_TYPE"
                                                Call cbo_Production_Type_ComboItemSelected
                                            Case "CBO_CHANNEL_PE_CATEGORY"
                                                Call cbo_Channel_PE_Category_Job(False)
                                            Case "CBO_SALESEST_CATEGORY"
                                                Call cbo_SalesEst_Category_Job(False)
                                            Case "CBO_PRODUCT_GP_TYPE"
                                                Call cbo_Product_GP_Type_ComboItemSelected
                                        End Select
                                    End If
                                End If
                            End If
                        End If
                        mb_internal = False
                    Case "OPTIONBUTTON"
                        lValues = Split(lControl.Tag, SEP)
                        If mo_Db.GetFieldIndex(ac_Cursor, lValues(0)) >= 0 Then
                            If UCase(lValues(2)) Like UCase(mo_Db.GetFields(ac_Cursor, lValues(0))) Then
                                lControl.value = True
                            End If
                        End If
                    Case "CHECKBOX"
                        If mo_Db.GetFieldIndex(ac_Cursor, lControl.Tag) >= 0 Then
                            If UCase(mo_Db.GetFields(ac_Cursor, lControl.Tag)) Like "X" Then
                                lControl.value = vbChecked
                            Else
                                lControl.value = vbUnchecked
                            End If
                        End If
                    Case "LABEL", "FRAME", "DIRLISTBOX", "FILELISTBOX", "DRIVELISTBOX", "TOOLBARCONTROL"
                        'Do Nothing
                    
                    Case "ARMGRID"
                    
                    Case Else
                        Debug.Print "LoadDataToForm  -> " & UCase(TypeName(lControl))
                End Select
            End If
            Set lControl = Nothing
        Next

    Exit Sub

errHandler:
    If Not lControl Is Nothing Then Set lControl = Nothing
    Call ErrorHandler("LoadDataToForm")

End Sub
'  ONLY FOR TEST
Private Sub Command2_Click()
'Dim lRequest As String
'Dim ll_Curs As Long
'Dim i As Long

'lRequest = "Select File_ID, File_NameWithExt From MKT_TemplateFiles"
'         ll_Curs = mo_Db.OpenSQL(lRequest)
'         For i = 0 To mo_Db.RowCount(ll_Curs)
'            Call mo_Db.BlobToFileSQL("exec MKT_TemplatesFiles_Sel '" & mo_Db.GetFields(ll_Curs, "File_NameWithExt") & "'", App.Path & "\Download\" & mo_Db.GetFields(ll_Curs, "File_NameWithExt"), 9)
'            mo_Db.Next (ll_Curs)
'         Next i
'    mo_Db.Close (ll_Curs)
    

    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_BUSINESSMODEL.dot'", App.Path & "\Download\CD_BUSINESSMODEL.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_CHANNEL1.dot'", App.Path & "\Download\CD_CHANNEL1.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_CHANNEL2.dot'", App.Path & "\Download\CD_CHANNEL2.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_CHANNEL3.dot'", App.Path & "\Download\CD_CHANNEL3.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_CHANNEL_PE.dot'", App.Path & "\Download\CD_CHANNEL_PE.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_COMMUNICATION1.dot'", App.Path & "\Download\CD_COMMUNICATION1.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_COMMUNICATION2.dot'", App.Path & "\Download\CD_COMMUNICATION2.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_FINANCIAL1.dot'", App.Path & "\Download\CD_FINANCIAL1.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_FINANCIAL2.dot'", App.Path & "\Download\CD_FINANCIAL2.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_GENERAL.dot'", App.Path & "\Download\CD_GENERAL.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_LOCATION.dot'", App.Path & "\Download\CD_LOCATION.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_PRODUCTION1.dot'", App.Path & "\Download\CD_PRODUCTION1.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_PRODUCTION2.dot'", App.Path & "\Download\CD_PRODUCTION2.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_PRODUCTS1.dot'", App.Path & "\Download\CD_PRODUCTS1.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_PRODUCTS2.dot'", App.Path & "\Download\CD_PRODUCTS2.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_SALESEST.dot'", App.Path & "\Download\CD_SALESEST.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_SALESORG.dot'", App.Path & "\Download\CD_SALESORG.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_SALESREPS.dot'", App.Path & "\Download\CD_SALESREPS.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_SERVICES.dot'", App.Path & "\Download\CD_SERVICES.dot", 9)
    Call mo_Db.FileToBlobSQL("UPDATE MKT_TemplateFiles set File_Data = ?, z_creation=getdate(), z_last_upd=getdate(),compressionlevel=9 where File_NameWithExt = 'CD_SWOT.dot'", App.Path & "\Download\CD_SWOT.dot", 9)
    
End Sub

Private Sub ExportToWord(ByVal ac_Cursor As Long, ByVal al_InfoArrayIndex As Long)
    
On Error GoTo errHandler
    Const DB_REQUEST As String = "exec MKT_TemplatesFiles_Sel '$File_NameWithExt$'"
    
    Dim ls_TemplateFileName As String
    Dim lRequest As String

    Dim ls_ToFind As String
    Dim ls_ReplaceBy As String
    Dim li_Num As Integer
    
    Dim ls_filenamepart As String
        
    If al_InfoArrayIndex = 0 Then
        ls_filenamepart = "CD_GENERAL"
    Else
        ls_filenamepart = UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame)
        If ls_filenamepart Like "*_S" Or ls_filenamepart Like "*_C" Then
            ls_filenamepart = Mid(ls_filenamepart, 1, Len(ls_filenamepart) - 2)
        End If
    End If
    
    Select Case ls_filenamepart
        Case "CD_CHANNEL"
            li_Num = mo_Db.GetFields(ac_Cursor, "CHNL_Type_Code")
       Case "CD_COMMUNICATION"
            li_Num = mo_Db.GetFields(ac_Cursor, "COM_Type_Code")
            If li_Num = 3 Then li_Num = 2
        Case "CD_PRODUCTS"
            li_Num = mo_Db.GetFields(ac_Cursor, "GP_Type_Code")
        Case "CD_PRODUCTION"
            li_Num = mo_Db.GetFields(ac_Cursor, "PRD_Type_Code")
        Case "CD_FINANCIAL"
            li_Num = ml_tbsidx + 1
    End Select
    
    If li_Num <> 0 Then ls_filenamepart = ls_filenamepart & li_Num
    
    ls_TemplateFileName = ms_TempPath & ls_filenamepart & ".dot"
    
               
    If Not mo_FSO.FileExists(ls_TemplateFileName) Then
         lRequest = Replace(DB_REQUEST, "$File_NameWithExt$", ls_filenamepart & ".dot", , , vbTextCompare)
         If Not mo_Db.BlobToFileSQL(lRequest, ls_TemplateFileName, 9) Then
            Err.Raise C_ERRORRAISE + 2145, "ExportToWord", "#Unable to load the template from the database. Printing process was cancelled."
         End If
    End If
    
 '   #If LIVE Then
        Dim lo_WordApp As Object
        Set lo_WordApp = CreateObject("Word.Application")
 '   #Else
 '       Dim lo_WordApp As Word.Application
 '       Set lo_WordApp = New Word.Application
        'lo_WordApp.ScreenUpdating = True
        'lo_WordApp.Visible = True
 '   #End If
    
    lo_WordApp.Documents.Add ls_TemplateFileName
    
    lo_WordApp.selection.Find.ClearFormatting
    lo_WordApp.selection.Find.Replacement.ClearFormatting
            
        
    Call WordFindReplace(lo_WordApp, "<CompetitorName>", Trim(Mid(lbl_ItemTitle.Caption, InStr(1, lbl_ItemTitle.Caption, "//") + 2)), False, True)
    
    Call WordFindReplace(lo_WordApp, "<Master_Comment>", grd_List.SelectedLine(0, "Master_comment"), False, False)
            
    Dim li_Count As Long
       
    For li_Count = 0 To mo_Db.FieldCount(ac_Cursor)
        Debug.Print mo_Db.GetFieldName(ac_Cursor, li_Count)
        Call WordFindReplace(lo_WordApp, "<" & mo_Db.GetFieldName(ac_Cursor, li_Count) & ">", Trim(mo_Db.GetFields(ac_Cursor, li_Count)), False, True)
    Next li_Count
    
    ls_ToFind = ""
    ls_ReplaceBy = ""
    
    Select Case UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame)
        Case "CD_CHANNEL"
            Dim ll_NbChnl As Long
            ll_NbChnl = grd_Products.Rows
            
            If ll_NbChnl <> 0 Then
                lo_WordApp.selection.GoTo What:=-1, Name:="SubItem"
                
                For li_Count = 0 To ll_NbChnl - 1
                    lo_WordApp.selection.TypeText Trim(grd_Products.Data(li_Count, "SC_Desc")) 'mo_Db.GetFields(ll_Cur, "SC_Desc")
                    lo_WordApp.selection.MoveRight Unit:=12
                    lo_WordApp.selection.TypeText Trim(grd_Products.Data(li_Count, "SBM_Desc")) 'mo_Db.GetFields(ll_Cur, "BM_Desc")
                    lo_WordApp.selection.MoveRight Unit:=12
                    lo_WordApp.selection.TypeText Trim(grd_Products.Data(li_Count, "BM_Desc")) 'mo_Db.GetFields(ll_Cur, "BM_Desc")
                    lo_WordApp.selection.MoveRight Unit:=12
                    lo_WordApp.selection.TypeText FormatNumber(grd_Products.Data(li_Count, "PE_Volume"), 0) 'mo_Db.GetFields(ll_Cur, "PE_Volume"), 0)
                    lo_WordApp.selection.MoveRight Unit:=12
                    lo_WordApp.selection.TypeText Trim(grd_Products.Data(li_Count, "UM_Desc")) 'mo_Db.GetFields(ll_Cur, "UM_Desc")
                    lo_WordApp.selection.MoveRight Unit:=12
                    lo_WordApp.selection.TypeText FormatNumber(grd_Products.Data(li_Count, "PE_Value"), 0) 'mo_Db.GetFields(ll_Cur, "PE_Value"), 0)
                    lo_WordApp.selection.MoveRight Unit:=12
                    lo_WordApp.selection.TypeText Trim(grd_Products.Data(li_Count, "CURR_Desc")) 'mo_Db.GetFields(ll_Cur, "CURR_Desc")
                    If li_Count < ll_NbChnl - 1 Then
                        lo_WordApp.selection.MoveRight Unit:=12
                    End If
                Next li_Count
            End If
            
        Case "CD_SALESORG_C", "CD_SALESORG_S"
            Dim ll_NbSales As Long
            ll_NbSales = grd_SalesOrg_SalesReps.Rows
            If ll_NbSales <> 0 Then
                lo_WordApp.selection.GoTo What:=-1, Name:="SubItem"
                
                For li_Count = 0 To ll_NbSales - 1
                    lo_WordApp.selection.TypeText Trim(grd_SalesOrg_SalesReps.Data(li_Count, "SOP_name")) 'mo_Db.GetFields(ll_Cur, "SOP_name"))
                    lo_WordApp.selection.MoveRight Unit:=12
                    lo_WordApp.selection.TypeText Trim(grd_SalesOrg_SalesReps.Data(li_Count, "SOP_BeginYR_Comp")) 'mo_Db.GetFields(ll_Cur, "SOP_BeginYR_Comp"))
                    lo_WordApp.selection.MoveRight Unit:=12
                    lo_WordApp.selection.TypeText Trim(grd_SalesOrg_SalesReps.Data(li_Count, "SOP_BeginYR_Ind")) 'mo_Db.GetFields(ll_Cur, "SOP_BeginYR_Ind"))
                    lo_WordApp.selection.MoveRight Unit:=12
                    lo_WordApp.selection.TypeText Trim(grd_SalesOrg_SalesReps.Data(li_Count, "SOP_Comment"))  'mo_Db.GetFields(ll_Cur, "SOP_Comment"))
                    If li_Count < ll_NbSales - 1 Then
                        lo_WordApp.selection.MoveRight Unit:=12
                    End If
                Next li_Count
            End If
            
        Case "CD_FINANCIAL_S"
            ls_ToFind = "<FIN_Country>"
            ls_ReplaceBy = ""
            If grd_detail2.Visible And grd_detail2.SelectedCount <> 0 Then
                ls_ReplaceBy = grd_detail2.SelectedLine(0, 3)
            Else
                ls_ReplaceBy = grd_detail1.SelectedLine(0, 2)
            End If
        
        Case "CD_FINANCIAL_C"
            ls_ToFind = "<FIN_Country>"
            ls_ReplaceBy = ""
            
        Case "CD_SALESREPS"
            ls_ToFind = "<SO_Year>"
            ls_ReplaceBy = mo_Db.GetFields(ml_Cursor, "SO_Year")
            
        Case "CD_CHANNEL_PE"
            ls_ToFind = "<CHNL_Year>"
            ls_ReplaceBy = mo_Db.GetFields(ml_Cursor, "CHNL_Year")
        Case Else
        
    End Select
    
    Dim ll_NbAtt As Long
    ll_NbAtt = grd_Attachments.Rows
    
    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ExistAttach And ll_NbAtt <> 0 Then
        lo_WordApp.selection.GoTo What:=-1, Name:="Attach"
        For li_Count = 0 To ll_NbAtt - 1
            lo_WordApp.selection.TypeText grd_Attachments.Data(li_Count, "ATT_Language_Desc")
            lo_WordApp.selection.MoveRight Unit:=12
            lo_WordApp.selection.TypeText grd_Attachments.Data(li_Count, "ATT_Title")
            If li_Count < ll_NbAtt - 1 Then
                lo_WordApp.selection.MoveRight Unit:=12
            End If
        Next li_Count
    End If
    
    If ls_ToFind <> "" Then
        Call WordFindReplace(lo_WordApp, ls_ToFind, ls_ReplaceBy, False, True)
    End If

    lo_WordApp.ActiveWindow.ActivePane.View.SeekView = 10 'wdSeekCurrentPageFooter
    lo_WordApp.selection.EndKey Unit:=6 'wdStory
    lo_WordApp.selection.InsertDateTime DateTimeFormat:="dd/MM/yyyy HH:mm", InsertAsField _
        :=False, DateLanguage:=2057, CalendarType:=0, InsertAsFullWidth:=False
        
    lo_WordApp.ActiveWindow.ActivePane.View.SeekView = 0 'wdSeekMainDocument
        
    lo_WordApp.selection.HomeKey Unit:=6
        
'    #If LIVE Then
        lo_WordApp.PrintOut False
        lo_WordApp.Documents.Close False
        lo_WordApp.quit
    '#End If
    
    Set lo_WordApp = Nothing
    
        
    Exit Sub

errHandler:
    If Not lo_WordApp Is Nothing Then
        If lo_WordApp.Documents.Count <> 0 Then
            lo_WordApp.Documents.Close False
        End If
        lo_WordApp.quit
        Set lo_WordApp = Nothing
    End If
    Call ErrorHandler("ExportToWord")
End Sub
'#If LIVE Then
Private Sub WordFindReplace(ByVal ao_WordApp As Object, ByVal as_findText As String, ByVal as_ReplaceText As String, ByVal ab_ReplaceInHeader As Boolean, ByVal ab_ReplaceInFooter As Boolean)
'#Else
'Private Sub WordFindReplace(ByVal ao_WordApp As Word.Application, ByVal as_findText As String, ByVal as_ReplaceText As String, ByVal ab_ReplaceInHeader As Boolean, ByVal ab_ReplaceInFooter As Boolean)
'#End If
On Error GoTo errHandler
    
    If as_ReplaceText = "" Then as_ReplaceText = " "
    
    ao_WordApp.ActiveWindow.ActivePane.View.SeekView = 0 'wdSeekMainDocument
    
    ao_WordApp.selection.HomeKey Unit:=6   'wdStory
    
    With ao_WordApp.selection.Find
        .ClearFormatting
        .Text = as_findText
        .forward = True
        Call .Replacement.ClearFormatting
        '.Replacement.Text = as_ReplaceText
    End With
    
    While ao_WordApp.selection.Find.Execute 'Replace:=2  'wdReplaceAll
        ao_WordApp.selection.TypeText Text:=as_ReplaceText
    Wend
    
    If ab_ReplaceInHeader Then
        ao_WordApp.ActiveWindow.ActivePane.View.SeekView = 9 'wdSeekCurrentPageHeader
        While ao_WordApp.selection.Find.Execute 'Replace:=2 'wdReplaceAll
            ao_WordApp.selection.TypeText Text:=as_ReplaceText
        Wend
    End If
    
    If ab_ReplaceInFooter Then
        ao_WordApp.ActiveWindow.ActivePane.View.SeekView = 10 'wdSeekCurrentPageFooter
        While ao_WordApp.selection.Find.Execute 'Replace:=2 'wdReplaceAll
            ao_WordApp.selection.TypeText Text:=as_ReplaceText
        Wend
    End If
    
    ao_WordApp.ActiveWindow.ActivePane.View.SeekView = 0 'wdSeekMainDocument
    
    Exit Sub
    
errHandler:
    Call ErrorHandler("WordFindReplace")
End Sub



Private Sub Item_Print_SubItem(ByVal al_InfoArrayIndex As Long, ByVal ao_grid As ArmGrid)

On Error GoTo errHandler

   
    ml_MasterKey = grd_List.SelectedLine(0, "MKT_Key")
    If ao_grid.Visible Then ml_CurrentKey = ao_grid.SelectedLine(0, 0)
           
    'load data
    Call Item_LoadDB_SubItem(al_InfoArrayIndex, ml_CurrentKey)
    
    If mo_Db.RowCount(ml_Cursor_SubItem) = 0 Then
        Err.Raise C_ERRORRAISE + 2138, "Item_Print_SubItem", "#The record you try to open has been deleted by an other user. Please refresh the grid."
    End If
        
    
    Call ExportToWord(ml_Cursor_SubItem, al_InfoArrayIndex)
       
    mb_internalFin = False
    Exit Sub
    
errHandler:
    mb_internalFin = False
    Call ErrorHandler("Item_Print_SubItem")

End Sub

    

Private Sub Item_Print(ByVal al_InfoArrayIndex As Long, ByVal ao_grid As ArmGrid)

On Error GoTo errHandler
    
    mb_internalFin = True

    If ao_grid.SelectedCount <= 0 Then Exit Sub
    
    ml_MasterKey = grd_List.SelectedLine(0, "MKT_Key")
    If ao_grid.Visible Then ml_CurrentKey = ao_grid.SelectedLine(0, "Key")
        
    Call OpenCursor(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.RequestView)
    
    If mo_Db.RowCount(ml_Cursor) = 0 Then
        Err.Raise C_ERRORRAISE + 2138, "Item_Print", "#The record you try to open has been deleted by an other user. Please refresh the grid."
    End If
    
    Call ExportToWord(ml_Cursor, al_InfoArrayIndex)
       
    mb_internalFin = False
    Exit Sub
    
errHandler:
    mb_internalFin = False
    Call ErrorHandler("Item_Print")

End Sub



Private Sub cal_filtersMax_datechangee()
On Error GoTo errHandler

    Call LockScreen(True)
    If cal_filtersMax.date_courte <> "" And cal_FiltersMin.date_courte <> "" Then
        If CDate(cal_filtersMax.date_courte) < CDate(cal_FiltersMin.date_courte) Then
            
''*-----------check if in the correct order
            cal_filtersMax.SetFocus
            cal_filtersMax.reinit_cal
'--------------------------------------------------
            Call MsgBox(MsgText(969, ms_Language_Code, "#End date cannot be less than Start date"), vbInformation)
        End If
    End If
    Call OnFilterChange
    
CleanUp:
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "cal_filtersMax_datechangee"
    Call LockScreen(False)
    MsgBox MsgText(31, ms_Language_Code, "#Invalid Date."), vbInformation


End Sub

Private Sub cal_FiltersMin_datechangee()
On Error GoTo errHandler

    Call LockScreen(True)
    If cal_FiltersMin.date_courte <> "" And cal_filtersMax.date_courte <> "" Then
         If CDate(cal_FiltersMin.date_courte) > CDate(cal_filtersMax.date_courte) Then
             cal_FiltersMin.SetFocus
             cal_FiltersMin.reinit_cal
             'Call SendMessage(968, "Start date cannot be greater than End date", ms_Language_Code)
             Call MsgBox(MsgText(968, ms_Language_Code, "#Start date cannot be greater than End date"), vbInformation)
         End If
    End If
    
    Call OnFilterChange
    
CleanUp:
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "cal_FiltersMin_datechangee"
    Call LockScreen(False)
    MsgBox MsgText(31, ms_Language_Code, "#Invalid Date."), vbInformation
    
End Sub

Private Sub cbo_Channel_PE_Category_Job(ByVal ab_CallerIsItemSelected As Boolean)
On Error GoTo errHandler

    
    Dim ls_Value As String
    
    If cbo_Channel_PE_Category.SelectedItem Is Nothing Then Exit Sub
    Call LockScreen(True)
    If Not ab_CallerIsItemSelected And Not cbo_Channel_PE_BM.SelectedItem Is Nothing Then ls_Value = cbo_Channel_PE_BM.SelectedItem.GetData(0)
    cbo_Channel_PE_BM.Clear
    
    cbo_Channel_PE_BM.Request = "exec MKT_Base_Material_CompDB_lst '" & ms_Language_Code & "'," & cbo_Channel_PE_Category.SelectedItem.GetData(0)
    
    If Not ab_CallerIsItemSelected And ls_Value <> "" Then
        cbo_Channel_PE_BM.Load
        If Not cbo_Channel_PE_BM.SearchItem(ls_Value, 0, 0, True) Then
            Err.Raise C_ERRORRAISE + 2116, "cbo_Channel_PE_Category_Job", "#Enable to load the combo "
        End If
    End If
    Call LockScreen(False)
    Exit Sub
    
errHandler:
     Call LockScreen(False)
    Call ErrorHandler("cbo_Channel_PE_Category_Job")

End Sub




Private Sub cbo_BusMod_Type_ComboDropDown()
    cbo_BusMod_Type.Load
End Sub


Private Sub cbo_Channel_PE_Category_ComboDropDown()
    cbo_Channel_PE_Category.Load
End Sub

Private Sub cbo_Channel_PE_Category_ComboItemSelected()

On Error GoTo errHandler

    If mb_internal Then Exit Sub
    
    Call LockScreen(True)
    Call cbo_Channel_PE_Category_Job(True)

CleanUp:
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "cbo_Channel_PE_Category_ComboItemSelected"
    Call LockScreen(False)
    Dim lv_MsgReplaceInfo(0, 1) As String
    lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
    lv_MsgReplaceInfo(0, 1) = lbl_label(470).Caption
    MsgBox MsgText(2116, ms_Language_Code, "#Unable to load the combo " & lv_MsgReplaceInfo(0, 1) & ".", lv_MsgReplaceInfo), vbInformation + vbOKOnly
End Sub



Private Sub cbo_Channel_Type_ComboDropDown()
    cbo_Channel_Type.Load
End Sub

Private Sub cbo_Channel_Type_ComboItemSelected()
On Error GoTo errHandler
    If cbo_Channel_Type.SelectedItem Is Nothing Then Exit Sub
    
    Call LockScreen(True)
    
    txt_Channel_percent_Distributor.Text = "0"
    txt_Channel_percent_Contractor.Text = "0"
    txt_Channel_percent_Strat_Accounts.Text = "0"
    txt_Channel_percent_Main_Contractor.Text = "0"
    txt_Channel_percent_End_User.Text = "0"
                
    lbl_label(312).Visible = False
    cbo_Channel_Category.Visible = False
    Set cbo_Channel_Category.SelectedItem = Nothing
    
    Fra_ChannelInfo.Visible = False

    lbl_label(311).Visible = False
    txt_Channel_percent_of_Turnover.Visible = False
    
    lbl_label(313).Visible = False
    cbo_Channel_Year_began.Visible = False
    
    If me_Mode = emAdd Then
        txt_Channel_percent_of_Turnover.Text = "0"
        If me_Mode = emAdd Then txt_Channel_Name.Text = ""
        txt_Channel_Name.Locked = False
        txt_Channel_Name.BackColor = CL_COLOR_ENABLED
        Set cbo_Channel_Year_began.SelectedItem = Nothing
    End If
    
    Fra_Products.Visible = False
    tlb_Products.Visible = False
    
    Select Case cbo_Channel_Type.SelectedItem.GetData(0)
        Case 1 'Local Alliance
            
            lbl_label(313).Visible = True
            cbo_Channel_Year_began.Visible = True

            If me_Mode = emAdd Then
                Call HandleToolbar(tlb_item, "0", True)
            End If

        Case 2 'Channel Split
            
            Fra_ChannelInfo.Visible = True
            Fra_ChannelInfo.ZOrder
            If me_Mode = emAdd Or me_Mode = emUpdate Then
                txt_Channel_Name.Text = ""
                txt_Channel_Name.Locked = True
                txt_Channel_Name.BackColor = CL_COLOR_LOCKED
            End If
            
            lbl_label(312).Visible = True
            lbl_label(312).ZOrder
            cbo_Channel_Category.Visible = True
            cbo_Channel_Category.ZOrder

            If me_Mode = emAdd Then
                Call HandleToolbar(tlb_item, "0", True)
            End If

        Case 3 'Key Customer
            Fra_Products.Visible = True
            Fra_Products.ZOrder
            
            Call InitializedSubItemGrid(grd_Products, 0, GetInfoArrayIndex("CD_CHANNEL_PE"))
            Call LoadLabels(UserControl.Controls, Fra_Products, SCREEN_NAME & "_" & Fra_Products.Tag, ms_Language_Code)
            Call HandleToolbar(tlb_Products, "0", mb_IsUpdater)

            lbl_label(311).Visible = True
            lbl_label(311).ZOrder
            txt_Channel_percent_of_Turnover.Visible = True
            txt_Channel_percent_of_Turnover.ZOrder
            
            lbl_label(313).Visible = True
            lbl_label(313).ZOrder
            cbo_Channel_Year_began.Visible = True
            cbo_Channel_Year_began.ZOrder

            If me_Mode = emAdd Then
                Call HandleToolbar(tlb_item, "1", True)
                grd_Products.Requests = ""
                grd_Products.ClearGrid
                tlb_Products.Visible = False
            End If

    End Select
    
CleanUp:
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "cbo_Channel_Type_ComboItemSelected"
    Call LockScreen(False)
    MsgBox MsgText(2116, ms_Language_Code, "#Enable to load the combo " & lbl_label(321).Caption), vbInformation

End Sub


Private Sub cbo_Communication_Type_ComboDropDown()
    cbo_Communication_Type.Load
End Sub

Private Sub cbo_Communication_Type_ComboItemSelected()
On Error GoTo errHandler
    
    If cbo_Communication_Type.SelectedItem Is Nothing Then Exit Sub
    Call LockScreen(True)
    
    If cbo_Communication_Type.SelectedItem.GetData(0) = 1 Then 'WEB
        lbl_label(260).Visible = True
        txt_Communication_Web_Address.Visible = True
    Else
        lbl_label(260).Visible = False
        txt_Communication_Web_Address.Visible = False
        txt_Communication_Web_Address.Text = ""
    End If
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "cbo_Channel_Type_ComboItemSelected"
    Call LockScreen(False)
    MsgBox MsgText(2116, ms_Language_Code, "#Enable to load the combo " & lbl_label(321).Caption), vbInformation
End Sub


Private Sub cbo_FiltersDate_ComboItemSelected()
On Error GoTo errHandler
    
    Call LockScreen(True)
    
    Call OnFilterChange
    
CleanUp:
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "cbo_Channel_Type_ComboItemSelected"
    Call LockScreen(False)
    MsgBox MsgText(2116, ms_Language_Code, "#Enable to load the combo " & "filter date"), vbInformation

End Sub






Private Sub cbo_General_Competitor_ComboDropDown()
    cbo_General_Competitor.Load
End Sub


Private Sub cbo_Product_GP_Type_ComboDropDown()
    cbo_Product_GP_Type.Load
End Sub

Private Sub cbo_Product_GP_Type_ComboItemSelected()
On Error GoTo errHandler
    If cbo_Product_GP_Type.SelectedItem Is Nothing Then Exit Sub
       
    Call LockScreen(True)
    
    Select Case UCase(cbo_Product_GP_Type.SelectedItem.GetData(0))
        Case 1 '"NEW PRODUCT INTRODUCTION"
            lbl_label(162).Visible = False
            txt_Product_Volume.Text = 0
            txt_Product_Volume.Visible = False
            
            lbl_label(168).Visible = False
            Set cbo_Product_Unit_of_Measure.SelectedItem = Nothing
            cbo_Product_Unit_of_Measure.Visible = False
                                     
        Case 2 '"TOP SELLING PRODUCT"
            lbl_label(162).Visible = True
            txt_Product_Volume.Visible = True
            
            lbl_label(168).Visible = True
            Set cbo_Product_Unit_of_Measure.SelectedItem = Nothing
            cbo_Product_Unit_of_Measure.Visible = True
            
            
            If cbo_Product_Unit_of_Measure.SearchItem("M2", 0, 0, True) = False Then
                If cbo_Product_Unit_of_Measure.AddItem(Array("M2", "Square meter"), True) Is Nothing Then
                    Debug.Print "cbo_Product_Unit_of_Measure_ComboItemSelected additem combo"
                End If
            End If
    
    End Select
    
CleanUp:
    Call LockScreen(False)
    Exit Sub

errHandler:
    DBLog "cbo_Product_GP_Type"
    Call LockScreen(False)
    MsgBox MsgText(2116, ms_Language_Code, "#Enable to load the combo " & lbl_label(162).Caption), vbInformation

End Sub


Private Sub cbo_Product_Price_Positioning_ComboDropDown()
    cbo_Product_Price_Positioning.Load
End Sub


Private Sub cbo_Production_Type_ComboDropDown()
    cbo_Production_Type.Load
End Sub

Private Sub cbo_Production_Type_ComboItemSelected()
On Error GoTo errHandler
    If cbo_Production_Type.SelectedItem Is Nothing Then Exit Sub
       
    Call LockScreen(True)
    
    Select Case UCase(cbo_Production_Type.SelectedItem.GetData(0))
        Case 1 '"PLANT"
            lbl_label(433).Visible = True
            txt_Production_Capacity.Visible = True
            If cbo_Production_Unit_of_Measure.SearchItem("M2", 0, 0, True) = False Then
                If cbo_Production_Unit_of_Measure.AddItem(Array("M2", "Square meter"), True) Is Nothing Then
                    Debug.Print "cbo_Production_Type_ComboItemSelected additem combo"
                End If
            End If
            
            cbo_Production_Unit_of_Measure.Visible = True
        
            lbl_label(434).Visible = True
            txt_Production_Technology.Visible = True
                         
        Case 2 '"RESEARCH AND DEVELOPMENT"
            lbl_label(433).Visible = False
            txt_Production_Capacity.Visible = False
            txt_Production_Capacity.Text = "0"
            Set cbo_Production_Unit_of_Measure.SelectedItem = Nothing
            cbo_Production_Unit_of_Measure.Visible = False
            
            lbl_label(434).Visible = False
            txt_Production_Technology.Visible = False
            txt_Production_Technology.Text = ""
    End Select
    
CleanUp:
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "cbo_Production_Type_ComboItemSelected"
    Call LockScreen(False)
    MsgBox MsgText(2116, ms_Language_Code, "#Enable to load the combo " & lbl_label(433).Caption), vbInformation
End Sub

Private Sub cbo_SalesEst_Category_Job(ByVal ab_CallerIsItemSelected As Boolean)
On Error GoTo errHandler
    Dim ls_Value As String
    
    If cbo_SalesEst_Category.SelectedItem Is Nothing Then Exit Sub
    Call LockScreen(True)
    If Not ab_CallerIsItemSelected And Not cbo_SalesEst_Material.SelectedItem Is Nothing Then ls_Value = cbo_SalesEst_Material.SelectedItem.GetData(0)
    
    cbo_SalesEst_Material.Clear
    cbo_SalesEst_Material.Request = "exec MKT_Base_Material_CompDB_lst '" & ms_Language_Code & "'," & cbo_SalesEst_Category.SelectedItem.GetData(0)
    
    If Not ab_CallerIsItemSelected And ls_Value <> "" Then
        cbo_SalesEst_Material.Load
        If Not cbo_SalesEst_Material.SearchItem(ls_Value, 0, 0, True) Then
            Err.Raise C_ERRORRAISE + 2116, "cbo_SalesEst_Category_Job", "#Enable to load the combo "
        End If
    End If
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    Call LockScreen(False)
    Call ErrorHandler("cbo_SalesEst_Category_Job")

End Sub



Private Sub cbo_SalesEst_Category_ComboDropDown()
    cbo_SalesEst_Category.Load
End Sub

Private Sub cbo_SalesEst_Category_ComboItemSelected()
On Error GoTo errHandler
    If mb_internal Then Exit Sub
    
    Call LockScreen(True)
    
    Call cbo_SalesEst_Category_Job(True)
    
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "cbo_SalesEst_Category_ComboItemSelected"
    Call LockScreen(False)
    Dim lv_MsgReplaceInfo(0, 1) As String
    lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
    lv_MsgReplaceInfo(0, 1) = lbl_label(109).Caption
    MsgBox MsgText(2116, ms_Language_Code, "#Enable to load the combo " & lv_MsgReplaceInfo(0, 1) & ".", lv_MsgReplaceInfo), vbInformation + vbOKOnly
End Sub

Private Sub cbo_SalesEst_Material_ComboDropDown()
    cbo_SalesEst_Material.Load
End Sub



Private Sub cbo_SalesOrg_TypeofOffice_ComboDropDown()
    cbo_SalesOrg_TypeofOffice.Load
End Sub



Private Sub cbo_Services_Compliance_Ranking_ComboDropDown()
    cbo_Services_Compliance_Ranking.Load
End Sub


Private Sub cbo_Services_TechSupportRating_ComboDropDown()
    cbo_Services_TechSupportRating.Load
End Sub

Private Sub cbo_Views_ComboItemSelected()
On Error GoTo errHandler

    Call LockScreen(True)
    
     If Not cbo_Views.SelectedItem Is Nothing Then
        Call LoadTreeView(tv_filter, GetTreeViewInfo(mTreeViewInfos, SCREEN_NAME, cbo_Views.SelectedItem.Key), grd_List)
        If mb_TVCmdReloadShow = True Then
            cmd_TVReLoad.Visible = False
            mb_TVCmdReloadShow = False
        End If
    End If
    
CleanUp:
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "cbo_Views_ComboItemSelected"
    Call LockScreen(False)
    MsgBox MsgText(2116, ms_Language_Code, "#Enable to load the combo " & " type of view."), vbInformation + vbOKOnly

End Sub


Private Sub cmd_DisclaimerNo_Click()
    RaiseEvent quit
End Sub


Private Sub cmd_DisclaimerYes_Click()
    fra_Disclaimer.Visible = False
End Sub

Private Sub cmd_TVReLoad_Click()

On Error GoTo errHandler
    
    Call LockScreen(True)
    
    Call LoadTreeView(tv_filter, GetTreeViewInfo(mTreeViewInfos, SCREEN_NAME, cbo_Views.SelectedItem.Key), grd_List)
    cmd_TVReLoad.Visible = False
    mb_TVCmdReloadShow = False
    tv_filter.Visible = True
    
CleanUp:
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "cmd_TVReLoad_Click"
    Call LockScreen(False)
    MsgBox MsgText(2142, ms_Language_Code, "#There is a problem while loading treeview data."), vbInformation + vbOKOnly

End Sub


'************************************************************************************************************************
' ATTACHMENT DETAIL BEGIN
Private Sub cbo_Attachment_Type_ComboItemSelected()
On Error GoTo errHandler
    
    Call LockScreen(True)
    
    fil_Full.Pattern = "*." & cbo_Attachment_Type.Text
    
    txt_Attachment_File.Text = ""
    
    Call EnableFrame(UserControl.Controls, fra_FileSelector, True)
    
CleanUp:
    Call LockScreen(False)
    Exit Sub

errHandler:
    DBLog "cbo_Attachment_Type_ComboItemSelected"
    Call LockScreen(False)
    MsgBox MsgText(2116, ms_Language_Code, "#Enable to load the combo " & lbl_label(452).Caption), vbInformation + vbOKOnly
    
End Sub


Private Sub dir_Full_Change()
On Error GoTo errHandler

    Call LockScreen(True)

    fil_Full.Path = dir_Full.Path
    txt_Attachment_File.Text = ""
    
CleanUp:
    Call LockScreen(False)
    Exit Sub

errHandler:
    Select Case Err.Number
        Case 68
            MsgBox MsgText(162, ms_Language_Code, "#Impossible to get info about this media."), vbInformation
        Case Else
            DBLog "dir_Full_Change"
    End Select
    Call LockScreen(False)


End Sub

Private Sub drv_Full_Change()
On Error GoTo errHandler

    Call LockScreen(True)
    
    dir_Full.Path = drv_Full.Drive
    txt_Attachment_File.Text = ""
    
CleanUp:
    Call LockScreen(False)
    Exit Sub

errHandler:
    Select Case Err.Number
        Case 68
            MsgBox MsgText(162, ms_Language_Code, "#Impossible to get info about this media."), vbInformation
        Case Else
            DBLog "drv_Full_Change"
    End Select
    Call LockScreen(False)

End Sub

Private Sub fil_Full_Click()
On Error GoTo errHandler
   
    Call LockScreen(True)
    
  txt_Attachment_File.Text = dir_Full.Path & IIf(right(dir_Full.Path, 1) = "\", "", "\") & fil_Full.FileName
  
CleanUp:
    Call LockScreen(False)
  Exit Sub

errHandler:
    Select Case Err.Number
        Case 68
            MsgBox MsgText(162, ms_Language_Code, "#Impossible to get info about this media."), vbInformation
        Case Else
            DBLog "fil_Full_Click"
    End Select
    Call LockScreen(False)

End Sub
Private Sub Item_Add_Attachment(ByVal al_InfoArrayIndex As Long, ByVal al_MKT_IndexClass As Long, ByVal al_MKT_Link_Key As String)
On Error GoTo errHandler
    If Not Item_CheckMandatory(al_InfoArrayIndex) Then Exit Sub
    
    If Not Item_Check(al_InfoArrayIndex) Then Exit Sub
    'add data on the db ->
    Call Item_AddDB_Attachment(al_InfoArrayIndex, al_MKT_IndexClass, al_MKT_Link_Key)
    
    ' if success then Add the data locally ->
    If Not Item_AddLocal(UserControl.Controls, fra_record(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), grd_Attachments, al_InfoArrayIndex) Then Exit Sub
    
    'go back to the detail screen
    Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)
  
  Exit Sub

errHandler:
    Call ErrorHandler("Item_Add_Attachment")

End Sub

Private Sub Item_Update_Attachment(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler
    If Not Item_CheckMandatory(al_InfoArrayIndex) Then Exit Sub
    
    'update data on the db ->
    Call Item_UpdateDB(al_InfoArrayIndex)
    
    'if success then update the data locally ->
    If Not Item_UpdateLocal(UserControl.Controls, fra_record(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), grd_Attachments) Then Exit Sub
    
    'go back to the detail screen
    Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)
        
  Exit Sub
  
errHandler:
    Call ErrorHandler("Item_Update_Attachment")
  
End Sub

Private Sub Item_Delete_Attachment(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler

    'ask confirmation for delete
'    If MsgBox(MsgText(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.DeleteMsg(0, 0), ms_Language_Code, mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.DeleteMsg(0, 1)), vbExclamation + vbDefaultButton2 + vbYesNo) <> vbYes Then Exit Sub
    
    'delete data on the db
    Call Item_DeleteDB(al_InfoArrayIndex)
    
    'if success then delete the data locally ->
    If Not Item_DeleteLocal(grd_Attachments, txt_key(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame).Text, False) Then Exit Sub
    'go back to the detail screen
    Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)

  Exit Sub
  
errHandler:
    Call ErrorHandler("Item_Delete_Attachment")

End Sub



Private Sub Item_AddDB_Attachment(ByVal al_InfoArrayIndex As Long, ByVal al_MKT_IndexClass As Long, ByVal al_MKT_Link_Key As String)
On Error GoTo errHandler

Dim ls_Req As String
Dim ls_ID_Blob As String
Dim ll_IndexFrame As Long
Dim lb_TranOpenned As Boolean
    
    ls_ID_Blob = Item_AttachmentsFile_Upload(txt_Attachment_File.Text)
    If ls_ID_Blob = "" Then
      Err.Raise C_ERRORRAISE, "Item_AddDB_Attachment", "Item_AttachmentsFile_Upload for MKT_Attachemnts failed"
    End If
    
    txt_Attachment_IDblob.Text = ls_ID_Blob
    
    ls_Req = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.RequestAdd
    
    ll_IndexFrame = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    txt_key(ll_IndexFrame).Text = mo_Db.SQLNextID("MKT_Attachments")
    
    If txt_key(ll_IndexFrame).Text = "" Then
      Err.Raise C_ERRORRAISE, "Item_AddDB_Attachment", "SQLNextID for MKT_Attachemnts failed"
    End If
    
    'replace the holders (from the frame record)
    ls_Req = Replace(ls_Req, "$Language_Code$", "E", , , vbTextCompare)
    ls_Req = Replace(ls_Req, "$ID_Blob$", ls_ID_Blob, , , vbTextCompare)
    ls_Req = Replace(ls_Req, "$iConcurrency$", mo_Db.GetFields(ml_Cursor_SubItem, "iConcurrency"), , , vbTextCompare)
    ls_Req = Replace(ls_Req, "$MKT_IndexClass$", al_MKT_IndexClass, , , vbTextCompare)
    ls_Req = ReplaceHolders(UserControl.Controls, fra_record(ll_IndexFrame), ls_Req)
    
    Dim ls_MaintRequest As String
    
    Select Case al_MKT_IndexClass
    Case 1
      ls_Req = Replace(ls_Req, "$MKT_BM_Key$", al_MKT_Link_Key, , , vbTextCompare)
      ls_MaintRequest = "exec MKT_BusMod_Maintenance_Upd $Key$, $Z_last_upd_user$"
    Case 2
      ls_Req = Replace(ls_Req, "$MKT_COM_Key$", al_MKT_Link_Key, , , vbTextCompare)
                            ls_MaintRequest = "exec MKT_Communication_Maintenance_Upd $Key$, $Z_last_upd_user$"
    Case 3
      ls_Req = Replace(ls_Req, "$MKT_LOC_Key$", al_MKT_Link_Key, , , vbTextCompare)
      ls_MaintRequest = "exec MKT_Location_Maintenance_Upd $Key$, $Z_last_upd_user$"
    Case 4
      ls_Req = Replace(ls_Req, "$MKT_GP_Key$", al_MKT_Link_Key, , , vbTextCompare)
      ls_MaintRequest = "exec MKT_GenProd_Maintenance_Upd $Key$, $Z_last_upd_user$"
    Case 5
      ls_Req = Replace(ls_Req, "$MKT_SO_Key$", al_MKT_Link_Key, , , vbTextCompare)
      ls_MaintRequest = "exec MKT_Sales_Organisation_Maintenance_Upd $Key$, $Z_last_upd_user$"
    Case 6
      ls_Req = Replace(ls_Req, "$MKT_SERV_KEY$", al_MKT_Link_Key, , , vbTextCompare)
      ls_MaintRequest = "exec MKT_Services_Maintenance_Upd $Key$, $Z_last_upd_user$"
    Case 7
      ls_Req = Replace(ls_Req, "$MKT_Fin_Key$", al_MKT_Link_Key, , , vbTextCompare)
      ls_MaintRequest = "exec MKT_Financial_Maintenance_Upd $Key$, $Z_last_upd_user$"
    Case Else
      Err.Raise C_ERRORRAISE, "Item_AddDB_Attachment", "Invalid MKT_IndexClass value"
    End Select
    
    ls_Req = Replace(ls_Req, "$MKT_BM_Key$", "NULL", , , vbTextCompare)
    ls_Req = Replace(ls_Req, "$MKT_COM_Key$", "NULL", , , vbTextCompare)
    ls_Req = Replace(ls_Req, "$MKT_LOC_Key$", "NULL", , , vbTextCompare)
    ls_Req = Replace(ls_Req, "$MKT_GP_Key$", "NULL", , , vbTextCompare)
    ls_Req = Replace(ls_Req, "$MKT_SO_Key$", "NULL", , , vbTextCompare)
    ls_Req = Replace(ls_Req, "$MKT_SERV_KEY$", "NULL", , , vbTextCompare)
    ls_Req = Replace(ls_Req, "$MKT_Fin_Key$", "NULL", , , vbTextCompare)
    
    
    ls_MaintRequest = Replace(ls_MaintRequest, "$Key$", al_MKT_Link_Key, , , vbTextCompare)
    ls_MaintRequest = Replace(ls_MaintRequest, "$Z_last_upd_user$", ml_UCode, , , vbTextCompare)

    Dim ls_MasterMaintRequest As String
    
    ls_MasterMaintRequest = "exec MKT_Master_Maintenance_Upd $MKT_Key$, $Z_last_upd_user$"
    If grd_detail2.Visible And grd_detail2.SelectedCount <> 0 Then
        ls_MasterMaintRequest = Replace(ls_MasterMaintRequest, "$MKT_Key$", grd_detail2.SelectedLine(0, 1), , , vbTextCompare)
    Else
        ls_MasterMaintRequest = Replace(ls_MasterMaintRequest, "$MKT_Key$", ml_MasterKey, , , vbTextCompare)
    End If
    ls_MasterMaintRequest = Replace(ls_MasterMaintRequest, "$Z_last_upd_user$", ml_UCode, , , vbTextCompare)
    
    Call BeginTran("Item_AddDB_Attachment")
    lb_TranOpenned = True
    ExecuteSQLSafe mo_Db, ls_Req, 1
    ExecuteSQLSafe mo_Db, ls_MaintRequest, 1
    ExecuteSQLSafe mo_Db, ls_MasterMaintRequest, 1

    Call CommitTran("Item_AddDB_Attachment")

    lb_TranOpenned = False

  Exit Sub
  
errHandler:
    If lb_TranOpenned Then
        Call RollbackTran("Item_AddDB_Attachment")
    End If
    Call ErrorHandler("Item_addDB_Attachment")
  
End Sub

Private Sub Item_AddInit_Attachment(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler
    
    Dim li_FrameIndex As Integer
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    
    'clear the frame record
    Call ClearForm(UserControl.Controls, fra_record(li_FrameIndex))
    
    Call EnableFrame(UserControl.Controls, fra_record(li_FrameIndex), True)
    Call EnableFrame(UserControl.Controls, fra_ModifInfo(li_FrameIndex), False)
    Call EnableFrame(UserControl.Controls, fra_FileSelector, False)
        
    fra_FileSelector.Visible = True
    
    Call InitializedFraRecord(al_InfoArrayIndex)
    
    Call Item_LoadDefaultValue(al_InfoArrayIndex)
    
    txt_CreationDate(li_FrameIndex).Text = Format(Date, "dd\/mm\/yyyy")
    Txt_Creator(li_FrameIndex).Text = ms_LoginName
    txt_LastUpdDate(li_FrameIndex).Text = Format(Date, "dd\/mm\/yyyy")
    txt_UpdUser(li_FrameIndex).Text = ms_LoginName
    
    Call HandleToolbar(tlb_item, "5", True)
    
    'Resize the frame
    Call fra_item.Move(120, 120, UserControl.Width - 120 * 2, UserControl.Height - 120 * 2)
    Call tlb_item.Move(fra_item.Width - tlb_item.Width - 120, 120 * 2, tlb_item.Width - 120, fra_item.Height - 120 * 3)
    Call fra_record(li_FrameIndex).Move(120, 120 + lbl_ItemTitle.Height, fra_item.Width - tlb_item.Width - 120 * 3, fra_item.Height - 120 * 2 - lbl_ItemTitle.Height)
    
    'display frame item ady_index
    fra_record(li_FrameIndex).Visible = True
    fra_record(li_FrameIndex).ZOrder
  
    fra_item.Visible = True
    fra_item.ZOrder
  
  Exit Sub
  
errHandler:
    fra_item.Visible = True
    fra_item.ZOrder
    Call ErrorHandler("Item_AddInit_Attachment")

End Sub

Private Sub Item_UpdateInit_Attachment(ByVal al_InfoArrayIndex As Long, ByVal al_ATT_Key As Long)
On Error GoTo errHandler
    
    Dim li_FrameIndex As Integer
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame

    'clear the frame record
    Call ClearForm(UserControl.Controls, fra_record(li_FrameIndex))
    
    Call EnableFrame(UserControl.Controls, fra_record(li_FrameIndex), True)
    Call EnableFrame(UserControl.Controls, fra_ModifInfo(li_FrameIndex), False)
    
    Call DisableFrameParts(al_InfoArrayIndex)

    
    fra_FileSelector.Visible = False
    
    Call InitializedFraRecord(al_InfoArrayIndex)
    
    
    Call Item_LoadDB_SubItem(al_InfoArrayIndex, al_ATT_Key)
    
    If mo_Db.RowCount(ml_Cursor_SubItem) = 0 Then
'        Call MsgBox(MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation)
'        Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)
'        Exit Sub
        Err.Raise C_ERRORRAISE + 2138, "Item_UpdateInit_Attachment", "#The record you try to open has been deleted by an other user. Please refresh the grid."
    End If
    
    Call LoadDataToForm(ml_Cursor_SubItem, UserControl.Controls, fra_record(li_FrameIndex))
    
    'Resize the frame
    Call fra_item.Move(120, 120, UserControl.Width - 120 * 2, UserControl.Height - 120 * 2)
    Call tlb_item.Move(fra_item.Width - tlb_item.Width - 120, 120 * 2, tlb_item.Width - 120, fra_item.Height - 120 * 3)
    Call fra_record(li_FrameIndex).Move(120, 120 + lbl_ItemTitle.Height, fra_item.Width - tlb_item.Width - 120 * 3, fra_item.Height - 120 * 2 - lbl_ItemTitle.Height)

    
    Call HandleToolbar(tlb_item, "6", True)
    
    'display frame item ady_index
    fra_record(li_FrameIndex).Visible = True
    fra_record(li_FrameIndex).ZOrder
    
    fra_item.Visible = True
    fra_item.ZOrder
    
  Exit Sub
  
errHandler:
    fra_item.Visible = True
    fra_item.ZOrder
     fra_record(li_FrameIndex).Visible = False
    Call ErrorHandler("Item_UpdateInit_Attachment")
    
End Sub

Private Sub Item_ViewInit_Attachment(ByVal al_InfoArrayIndex As Long, ByVal al_ATT_Key As Long)
On Error GoTo errHandler

    Call Item_LoadDB_SubItem(al_InfoArrayIndex, al_ATT_Key)
    
    If mo_Db.RowCount(ml_Cursor_SubItem) = 0 Then
'        Call MsgBox(MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation)
'        Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)
'        Exit Sub
        Err.Raise C_ERRORRAISE + 2138, "Item_ViewInit_Attachment", "#The record you try to open has been deleted by an other user. Please refresh the grid."
    End If
  
    Call DisplayZip(mo_Db, mo_Db.GetFields(ml_Cursor_SubItem, "ID_Blob") & "." & mo_Db.GetFields(ml_Cursor_SubItem, "ATT_Type_Desc"), mo_Db.GetFields(ml_Cursor_SubItem, "ID_Blob"))
    Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)
    
    Exit Sub

errHandler:
    Call ErrorHandler("Item_ViewInit_Attachment")

End Sub

Private Sub Item_ViewInit_SubItem(ByVal al_InfoArrayIndex As Long, ByVal al_Key As Long)
On Error GoTo errHandler
    Dim li_FrameIndex As Integer
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    fra_item.Visible = True
    fra_item.ZOrder
    
    fra_record(li_FrameIndex).Visible = True
    fra_record(li_FrameIndex).ZOrder
    
    Call ClearForm(UserControl.Controls, fra_record(li_FrameIndex))
    
    Call EnableFrame(UserControl.Controls, fra_record(li_FrameIndex), False)
    
    Call InitializedFraRecord(al_InfoArrayIndex)
    
    Call fra_record(li_FrameIndex).Move(120, 120 + lbl_ItemTitle.Height, fra_item.Width - tlb_item.Width - 120 * 3, fra_item.Height - 120 * 2 - lbl_ItemTitle.Height)
    
    Call Item_LoadDB_SubItem(al_InfoArrayIndex, al_Key)
    
    If mo_Db.RowCount(ml_Cursor_SubItem) = 0 Then
'        Call MsgBox(MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation)
'        Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)
'        Exit Sub
        Err.Raise C_ERRORRAISE + 2138, "Item_ViewInit_SubItem", "#The record you try to open has been deleted by an other user. Please refresh the grid."
    End If
    
    mb_ChangeSubItemNbFromat = False
    Call LoadDataToForm(ml_Cursor_SubItem, UserControl.Controls, fra_record(li_FrameIndex))

    If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_CHANNEL_PE" Then
        Call HandleToolbar(tlb_item, "E", mb_IsUpdater)
    End If
    If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_SALESREPS" Then
        Call HandleToolbar(tlb_item, "G", mb_IsUpdater)
    End If
    
    'display frame item ady_index
    fra_record(li_FrameIndex).Visible = True
    fra_record(li_FrameIndex).ZOrder

    fra_item.Visible = True
    fra_item.ZOrder

  Exit Sub
  
errHandler:
    fra_item.Visible = True
    fra_item.ZOrder
    fra_record(li_FrameIndex).Visible = False
    

    Call ErrorHandler("Item_ViewInit_SubItem")

End Sub

Private Sub Item_DeleteInit_Attachment(ByVal al_InfoArrayIndex As Long, ByVal al_ATT_Key As Long)
On Error GoTo errHandler
    Dim li_FrameIndex As Integer
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    Call ClearForm(UserControl.Controls, fra_record(li_FrameIndex))
    
    Call EnableFrame(UserControl.Controls, fra_record(li_FrameIndex), False)
    fra_FileSelector.Visible = False
    
    Call InitializedFraRecord(al_InfoArrayIndex)
    
    Call Item_LoadDB_SubItem(al_InfoArrayIndex, al_ATT_Key)
    
    If mo_Db.RowCount(ml_Cursor_SubItem) = 0 Then
'        Call MsgBox(MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation)
'        Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)
'        Exit Sub
        Err.Raise C_ERRORRAISE + 2138, "Item_DeleteInit_Attachment", "#The record you try to open has been deleted by an other user. Please refresh the grid."
    End If
    
    Call LoadDataToForm(ml_Cursor_SubItem, UserControl.Controls, fra_record(li_FrameIndex))

    'Resize the frame
    Call fra_record(li_FrameIndex).Move(120, 120 + lbl_ItemTitle.Height, fra_item.Width - tlb_item.Width - 120 * 3, fra_item.Height - 120 * 2 - lbl_ItemTitle.Height)
    
    Call HandleToolbar(tlb_item, "7", True)
    
    'display frame item ady_index
    fra_record(li_FrameIndex).Visible = True
    fra_record(li_FrameIndex).ZOrder
    
    fra_item.Visible = True
    fra_item.ZOrder

  Exit Sub
  
errHandler:
    Call ErrorHandler("Item_DeleteInit_Attachment")

End Sub

Private Sub Item_ExitToGrid_SubItem(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler
    Dim li_FrameIndex As Integer
    Dim ls_FrameName As String
    
    If me_Mode = emCopy Then Exit Sub
    
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    ls_FrameName = UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame)

    fra_record(li_FrameIndex).Visible = False
    
    If me_Mode = emView Then
        Call HandleToolbar(tlb_item, "2", mb_IsUpdater)
    Else
        Call HandleToolbar(tlb_item, "3", True)
    End If
    
    If me_Mode = emView Then
    'Resize the frame
        Call fra_item.Move(fra_list.left, fra_list.top, fra_list.Width, fra_list.Height)
        Call tlb_item.Move(fra_item.Width - tlb_item.Width - 120, 120 * 2, tlb_item.Width, fra_item.Height - 120 * 3)
        Call fra_record(li_FrameIndex).Move(120, 120 + lbl_ItemTitle.Height, fra_item.Width - tlb_item.Width - 120 * 3, fra_item.Height - lbl_DetailTitle.Height - 120 * 2)
        fra_item.Visible = True
        fra_item.ZOrder
        fra_filter.Visible = True
        fra_filter.ZOrder
        
    End If
    
  'do the navigation and positioning
    If ml_Cursor_SubItem <> 0 Then
        Call mo_Db.Close(ml_Cursor_SubItem)
        ml_Cursor_SubItem = 0
    End If
    
    
    
    If ls_FrameName Like "CD_ATTACHMENTS" Then
        If grd_Attachments.Rows > 0 Then
            If grd_detail2.Visible Then
                If grd_detail2.SelectedCount = 0 Then
                    grd_detail1.SelectedLine(0, "Attachment") = "X"
                Else
                    grd_detail2.SelectedLine(0, "Attachment") = "X"
                End If
            Else
            grd_detail1.SelectedLine(0, "Attachment") = "X"
            End If
            
        Else
            If grd_detail2.Visible Then
                If grd_detail2.SelectedCount = 0 Then
                     grd_detail1.SelectedLine(0, "Attachment") = ""
                Else
                    grd_detail2.SelectedLine(0, "Attachment") = ""
                End If
            Else
                grd_detail1.SelectedLine(0, "Attachment") = ""
            End If
        End If
    End If
  
    If ls_FrameName Like "CD_SALESREPS" Then
        If grd_SalesOrg_SalesReps.Rows > 0 Then
          grd_detail1.SelectedLine(0, "Rep Detail") = "X"
        Else
          grd_detail1.SelectedLine(0, "Rep Detail") = ""
        End If
    End If
  
    If grd_detail2.Visible Then
        ml_CurrentKey = IIf(grd_detail2.SelectedCount = 0, grd_detail1.SelectedLine(0, "Key"), grd_detail2.SelectedLine(0, "Key"))
    Else
    ml_CurrentKey = grd_detail1.SelectedLine(0, "Key")
    End If
    
    mb_ChangeSubItemNbFromat = False
    
    Exit Sub
    
errHandler:
    Call ErrorHandler("Item_ExitToGrid_SubItem")

End Sub


Private Function Item_AttachmentsFile_Upload(ByVal as_file As String) As String
On Error GoTo errHandler

Const REQUEST_UPLOAD_FILE = "exec MKT_AttachmentsFile_ins $ID_Blob$,?"

Dim ls_Req As String
Dim as_ID_Blob As String

  as_ID_Blob = mo_Db.SQLNextID("MKT_AttachmentsFile")
  If as_ID_Blob = "" Then
    Err.Raise C_ERRORRAISE, "Item_AttachmentsFile_Upload", "SQLNextID for MKT_AttachemntsFile failed"
  End If
  ls_Req = Replace(REQUEST_UPLOAD_FILE, "$ID_Blob$", as_ID_Blob, , , vbTextCompare)
  If Not mo_Db.FileToBlobSQL(ls_Req, as_file, 9) Then
     Err.Raise C_ERRORRAISE, "BlobToFileSQL failed", GetDbError(mo_Db)
 End If
 Item_AttachmentsFile_Upload = as_ID_Blob
 
Exit Function

errHandler:
    Call ErrorHandler("Item_AttachmentsFile_Upload")
    
End Function



Private Sub Item_AttachmentsFile_Download(ByVal as_ID As String, ByVal as_file As String)
On Error GoTo errHandler
    
Const REQUEST_DOWNLOAD_FILE = "exec MKT_AttachmentsFile_Sel $KEY$"

    Dim ls_Req As String
    
    ls_Req = Replace(REQUEST_DOWNLOAD_FILE, "$KEY$", as_ID)

    If Not mo_Db.BlobToFileSQL(ls_Req, as_file, True, False) Then
        Call Err.Raise(C_ERRORRAISE, "BlobToFileSQL", GetDbError(mo_Db))
    End If
    Exit Sub
errHandler:
    Call ErrorHandler("Item_AttachmentsFile_Download")
    
End Sub

'*********************************** BEGIN SalesReps

Private Sub Item_AddInit_SalesReps(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler
    Dim li_FrameIndex As Integer
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    
    'clear the frame record
    Call ClearForm(UserControl.Controls, fra_record(li_FrameIndex))
    
    Call EnableFrame(UserControl.Controls, fra_record(li_FrameIndex), True)
    Call EnableFrame(UserControl.Controls, fra_ModifInfo(li_FrameIndex), False)
    
    Call InitializedFraRecord(al_InfoArrayIndex)
    Call Item_LoadDefaultValue(al_InfoArrayIndex)
    
    txt_CreationDate(li_FrameIndex).Text = Format(Date, "dd\/mm\/yyyy")
    Txt_Creator(li_FrameIndex).Text = ms_LoginName
    txt_LastUpdDate(li_FrameIndex).Text = Format(Date, "dd\/mm\/yyyy")
    txt_UpdUser(li_FrameIndex).Text = ms_LoginName
    
    Call HandleToolbar(tlb_item, "8", True)
    
    'Resize the frame
    Call fra_item.Move(120, 120, UserControl.Width - 120 * 2, UserControl.Height - 120 * 2)
    Call tlb_item.Move(fra_item.Width - tlb_item.Width - 120, 120 * 2, tlb_item.Width - 120, fra_item.Height - 120 * 3)
    Call fra_record(li_FrameIndex).Move(120, 120 + lbl_ItemTitle.Height, fra_item.Width - tlb_item.Width - 120 * 3, fra_item.Height - 120 * 2 - lbl_ItemTitle.Height)
    
    'display frame item ady_index
    fra_record(li_FrameIndex).Visible = True
    fra_record(li_FrameIndex).ZOrder
    
    fra_item.Visible = True
    fra_item.ZOrder
    
  Exit Sub
errHandler:
    Call ErrorHandler("Item_AddInit_SalesReps")

End Sub

Private Sub Item_UpdateInit_SalesReps(ByVal al_InfoArrayIndex As Long, ByVal al_MKT_SOPeople_Key As Long)
On Error GoTo errHandler
    
    Dim li_FrameIndex As Integer
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    
    'clear the frame record
    Call ClearForm(UserControl.Controls, fra_record(li_FrameIndex))
    
    Call EnableFrame(UserControl.Controls, fra_record(li_FrameIndex), True)
    Call EnableFrame(UserControl.Controls, fra_ModifInfo(li_FrameIndex), False)
    
    Call InitializedFraRecord(al_InfoArrayIndex)
    
    'Resize the frame
    
    Call Item_LoadDB_SubItem(al_InfoArrayIndex, al_MKT_SOPeople_Key)
    
    If mo_Db.RowCount(ml_Cursor_SubItem) = 0 Then
'        Call MsgBox(MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation)
'        Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)
'        Exit Sub
        Err.Raise C_ERRORRAISE + 2138, "Item_UpdateInit_Attachment", "#The record you try to open has been deleted by an other user. Please refresh the grid."
    End If
    
    Call fra_item.Move(120, 120, UserControl.Width - 120 * 2, UserControl.Height - 120 * 2)
    Call tlb_item.Move(fra_item.Width - tlb_item.Width - 120, 120 * 2, tlb_item.Width - 120, fra_item.Height - 120 * 3)
    Call fra_record(li_FrameIndex).Move(120, 120 + lbl_ItemTitle.Height, fra_item.Width - tlb_item.Width - 120 * 3, fra_item.Height - 120 * 2 - lbl_ItemTitle.Height)
    
    Call LoadDataToForm(ml_Cursor_SubItem, UserControl.Controls, fra_record(li_FrameIndex))
    
    Call HandleToolbar(tlb_item, "9", True)
    
    'display frame item ady_index
    fra_record(li_FrameIndex).Visible = True
    fra_record(li_FrameIndex).ZOrder
    
    fra_item.Visible = True
    fra_item.ZOrder
  
  Exit Sub
errHandler:
    fra_item.Visible = True
    fra_item.ZOrder
    Call ErrorHandler("Item_UpdateInit_SalesReps")

End Sub

Private Sub Item_DeleteInit_SalesReps(ByVal al_InfoArrayIndex As Long, ByVal al_MKT_SOPeople_Key As Long)
On Error GoTo errHandler
    Dim li_FrameIndex As Integer
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    
    Call ClearForm(UserControl.Controls, fra_record(li_FrameIndex))
    
    Call EnableFrame(UserControl.Controls, fra_record(li_FrameIndex), False)
    
    Call InitializedFraRecord(al_InfoArrayIndex)
    
    Call fra_record(li_FrameIndex).Move(120, 120 + lbl_ItemTitle.Height, fra_item.Width - tlb_item.Width - 120 * 3, fra_item.Height - 120 * 2 - lbl_ItemTitle.Height)
    
    Call Item_LoadDB_SubItem(al_InfoArrayIndex, al_MKT_SOPeople_Key)
    
    If mo_Db.RowCount(ml_Cursor_SubItem) = 0 Then
'        Call MsgBox(MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation)
'        Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)
'        Exit Sub
        Err.Raise C_ERRORRAISE + 2138, "Item_DeleteInit_SalesReps", "#The record you try to open has been deleted by an other user. Please refresh the grid."
    End If
    
    Call LoadDataToForm(ml_Cursor_SubItem, UserControl.Controls, fra_record(li_FrameIndex))

    Call HandleToolbar(tlb_item, "A", True)
    
    'display frame item ady_index
    fra_record(li_FrameIndex).Visible = True
    fra_record(li_FrameIndex).ZOrder

    fra_item.Visible = True
    fra_item.ZOrder

  Exit Sub
errHandler:
    fra_item.Visible = True
    fra_item.ZOrder
    Call ErrorHandler("Item_DeleteInit_SalesReps")

End Sub

Private Sub Item_LoadDB_SubItem(ByVal al_InfoArrayIndex As Long, ByVal al_Key As Long)
On Error GoTo errHandler

    Dim ls_Req As String
    
    ls_Req = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.RequestView
    ls_Req = Replace(ls_Req, "$Key$", al_Key, , , vbTextCompare)
    ls_Req = Replace(ls_Req, "$Language_Code$", "E", , , vbTextCompare)
    
    If ml_Cursor_SubItem > 0 Then
        mo_Db.Close (ml_Cursor_SubItem)
        ml_Cursor_SubItem = 0
    End If
    
    'TODO call OpenQLSafe with check one record has been selected
'    ml_Cursor_SubItem = mo_Db.OpenSQL(ls_Req)
    ml_Cursor_SubItem = OpenSQLSafe(mo_Db, ls_Req)
    
  Exit Sub
  
errHandler:
    mo_Db.Close (ml_Cursor_SubItem)
    Call ErrorHandler("Item_LoadDB_SubItem")
End Sub



Private Sub Item_Add_SalesReps(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler
    'check the data validity -> Item_Check
    If Not Item_CheckMandatory(al_InfoArrayIndex) Then Exit Sub
    
    'add data on the db ->
    Call Item_AddDB(al_InfoArrayIndex)
    
    ' if success then Add the data locally ->
    If Not Item_AddLocal(UserControl.Controls, fra_record(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), grd_SalesOrg_SalesReps, al_InfoArrayIndex) Then Exit Sub
    'go back to the detail screen
    Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)
        
  Exit Sub
errHandler:
    Call ErrorHandler("Item_Add_SalesReps")

End Sub

Private Sub Item_Update_SalesReps(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler
    'check the data validity -> Item_Check
    If Not Item_CheckMandatory(al_InfoArrayIndex) Then Exit Sub
    
    'update data on the db ->
    Call Item_UpdateDB(al_InfoArrayIndex)
    
    'if success then update the data locally ->
    If Not Item_UpdateLocal(UserControl.Controls, fra_record(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), grd_SalesOrg_SalesReps) Then Exit Sub
    
    'go back to the detail screen
    Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)
        
  Exit Sub
errHandler:
    Call ErrorHandler("Item_Update_SalesReps")

End Sub

Private Sub Item_Delete_SalesReps(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler

    'ask confirmation for delete
'    If MsgBox(MsgText(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.DeleteMsg(0, 0), ms_Language_Code, mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.DeleteMsg(0, 1)), vbExclamation + vbDefaultButton2 + vbYesNo) <> vbYes Then Exit Sub
    
    'delete data on the db
    Call Item_DeleteDB(al_InfoArrayIndex)
    
    'if success then delete the data locally ->
    If Not Item_DeleteLocal(grd_SalesOrg_SalesReps, txt_key(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame).Text, False) Then Exit Sub
    'go back to the detail screen
    Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)

  Exit Sub
errHandler:
    Call ErrorHandler("Item_Delete_SalesReps")
    
End Sub

'*********************************** END SalesReps

'*********************************** Start Channel_PE
Private Sub Item_Add_Channel_PE(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler
    'check the data validity -> Item_Check
    If Not Item_CheckMandatory(al_InfoArrayIndex) Then Exit Sub
    
    If Not Item_Check(al_InfoArrayIndex) Then Exit Sub
    
    'add data on the db ->
    'Call Item_AddDB_Channel_PE(al_InfoArrayIndex)
    If Not Item_AddDB(al_InfoArrayIndex) Then Exit Sub
    
    ' if success then Add the data locally ->
    If Not Item_AddLocal(UserControl.Controls, fra_record(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), grd_Products, al_InfoArrayIndex) Then Exit Sub
    'go back to the detail screen
    Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)
        
  Exit Sub
errHandler:
    Call ErrorHandler("Item_Add_Channel_PE")

End Sub

Private Sub Item_Update_Channel_PE(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler
    'check the data validity -> Item_Check
    If Not Item_CheckMandatory(al_InfoArrayIndex) Then Exit Sub
    
    If Not Item_Check(al_InfoArrayIndex) Then Exit Sub
    
    'update data on the db ->
    If Not Item_UpdateDB(al_InfoArrayIndex) Then Exit Sub
    
    'if success then update the data locally ->
    If Not Item_UpdateLocal(UserControl.Controls, fra_record(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), grd_Products) Then Exit Sub
    
    'go back to the detail screen
    Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)
        
  Exit Sub
errHandler:
    Call ErrorHandler("Item_Update_Channel_PE")

End Sub

Private Sub Item_Delete_Channel_PE(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler

    'ask confirmation for delete
'    If MsgBox(MsgText(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.DeleteMsg(0, 0), ms_Language_Code, mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.DeleteMsg(0, 1)), vbExclamation + vbDefaultButton2 + vbYesNo) <> vbYes Then Exit Sub
    
    'delete data on the db
    If Not Item_DeleteDB(al_InfoArrayIndex) Then Exit Sub
    
    'if success then delete the data locally ->
    If Not Item_DeleteLocal(grd_Products, txt_key(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame).Text, False) Then Exit Sub
    'go back to the detail screen
    Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)

  Exit Sub
errHandler:
    Call ErrorHandler("Item_Delete_Channel_PE")

End Sub



'*********************************** End Channel_PE

Private Function CreateDirStruct(ByVal strPath As String, ByVal ao_FSO As Object) As Boolean

On Error GoTo Create_Dir_Struct_Errors
    Dim intIndex    As Integer
    Dim strTmpPath  As String
    
    If Len(Trim$(strPath)) = 0 Then
        ' if we specify wrong path it is error
        CreateDirStruct = False
        Exit Function
    End If
    
    If right$(strPath, 1) <> "\" Then strPath = strPath & "\"
    intIndex = 0
    
    Do
        ' get the next path chunk
        intIndex = InStr(intIndex + 1, strPath, "\")
        
        If intIndex > 0 Then
            strTmpPath = left$(strPath, intIndex - 1)
        Else
            Exit Do
        End If
        
        ' see if this folder exists
        If Not ao_FSO.FolderExists(strTmpPath) Then
            ' Create this folder.
            ' If there is an error, it will be trapped bellow
            ao_FSO.CreateFolder strTmpPath
            intIndex = 1
        End If
    Loop
    
    CreateDirStruct = True
    Exit Function

Create_Dir_Struct_Errors:
    CreateDirStruct = False
    'TODO
    Debug.Print "CreateDirStruct -> " & Err.Description
    Call ErrorHandler("CreateDirStruct")
    
End Function

#If LIVE Then
Private Function DownloadZipFile(ByVal ao_Armdb As Object, ByVal al_ID_Blob As Long, ByVal as_fileName As String) As String
#Else
Private Function DownloadZipFile(ByVal ao_Armdb As ARMSYSCOMLib.ArmDb, ByVal al_ID_Blob As Long, ByVal as_fileName As String) As String
#End If
On Error GoTo errHandler
    
    Const C_TEMPDIR As String = "\Download\"     ' temporary directory relative to executable
    Dim ls_path As String
    
    ls_path = App.Path & C_TEMPDIR & "\"
    
    ' check if file exists in local temporary directory
    If mo_FSO.FileExists(ls_path & as_fileName) Then
        DownloadZipFile = ls_path & as_fileName
        Exit Function
    End If
    
    If Not mo_FSO.FolderExists(ls_path) Then
        Call CreateDirStruct(ls_path, mo_FSO)
        Debug.Assert (mo_FSO.FolderExists(ls_path))     ' folder Download must exists
    End If
    
    ' download media from SQL server and decompress
    Call Item_AttachmentsFile_Download(al_ID_Blob, ls_path & as_fileName)
    
    Debug.Assert (mo_FSO.FileExists(ls_path & as_fileName))
    DownloadZipFile = ls_path & as_fileName
    
Exit Function
errHandler:

    'Call Err.Raise(Err.Number, "DownloadZipFile" & SEP1 & Err.Source, Err.Description, Err.HelpFile, Err.HelpContext)
    Call ErrorHandler("DownloadZipFile")
    
End Function

' return command to be executed to open file with specific extension
Private Function GetCommand(ByVal as_ext As String, ByRef as_DDEExec As String, ByRef as_Application As String, ByRef as_Topic As String, ByVal ao_shell As Object) As String

Dim ls_defValue As String

    GetCommand = ""

    On Error GoTo exitFnc
    ls_defValue = ao_shell.RegRead("HKCR\." & as_ext & "\")
    If ls_defValue = "" Then
        Call Err.Raise(C_ERRORRAISE, "GetCommand", "File extension is not supported.")
    End If
    
    Dim ls_cmd As String
    
    ls_cmd = ao_shell.RegRead("HKCR\" & ls_defValue & "\shell\Open\command\")
    If ls_cmd = "" Then
        Call Err.Raise(C_ERRORRAISE, "GetCommand", "Open command not defined.")
    End If
    GetCommand = ls_cmd
    
    ' try to locate DDEExec, if not exception is rised
    as_DDEExec = ao_shell.RegRead("HKCR\" & ls_defValue & "\shell\Open\ddeexec\")
    as_Application = ao_shell.RegRead("HKCR\" & ls_defValue & "\shell\Open\ddeexec\application\")
    as_Topic = ao_shell.RegRead("HKCR\" & ls_defValue & "\shell\Open\ddeexec\topic\")

    Exit Function
exitFnc:
'    Debug.Print "GetCommand -> " & Err.Description
'    Call ErrorHandler("GetCommand")
    
End Function

' if ll_index is negative value string is indexed backward
Private Function GetString(ByVal as_string As String, ByVal ll_Index As Long, Optional ByVal as_delimiter As String = SEP1 + SEP2) As String
On Error GoTo errHandler
    Dim lsa_tmpArray() As String
    lsa_tmpArray = Split(as_string, as_delimiter)
    
    If ll_Index < 0 Then ll_Index = ll_Index + UBound(lsa_tmpArray) + 1    ' backward index
    
    If UBound(lsa_tmpArray) >= ll_Index And LBound(lsa_tmpArray) <= ll_Index Then GetString = lsa_tmpArray(ll_Index)
    
    Exit Function
    
errHandler:
    Call ErrorHandler("GetString")

End Function

#If LIVE Then
Private Sub DisplayZip(ByVal ao_Armdb As Object, ByVal as_extractFile As String, ByVal al_ID_Blob As Long)
#Else
Private Sub DisplayZip(ByVal ao_Armdb As ARMSYSCOMLib.ArmDb, ByVal as_extractFile As String, ByVal al_ID_Blob As Long)
#End If

Dim ls_fileName As String
Dim ls_Command As String


On Error GoTo ErrorHandler

    ' create shell object to access Registry and Runtime
    Dim lo_shell As Object
    Set lo_shell = CreateObject("WSCript.Shell")
    If lo_shell Is Nothing Then
        Call Err.Raise(C_ERRORRAISE, "CreateObject()", "Cannot create WSCript.Shell.")
    End If
    
    ' get command defined for extension
    Dim ls_DDEExec As String, ls_Application As String, ls_topic As String
    ls_Command = GetCommand(GetString(as_extractFile, -1, "."), ls_DDEExec, ls_Application, ls_topic, lo_shell)
    
    If ls_Command = "" Then
        ' TODO: Manage status: no associate application found
        ' TODO: here we can try explorer.exe to display media
        'Call Err.Raise(C_ERRORRAISE, "DisplayZip", "No Application associated with file.")
    End If
    
    ' now when we know how to run, we can download file and run
    ls_fileName = DownloadZipFile(ao_Armdb, al_ID_Blob, as_extractFile)
    
    ' anyway, to execute document we don't need ls_command
    Call lo_shell.Run("""" & ls_fileName & """")
    
    Set lo_shell = Nothing
    
Exit Sub

ErrorHandler:
    Debug.Print "DisplayZip -> " & Err.Description
    If Not lo_shell Is Nothing Then Set lo_shell = Nothing
'    Call Err.Raise(Err.Number, "DisplayZip" & SEP1 & Err.Source, Err.Description, Err.HelpFile, Err.HelpContext)
    Call ErrorHandler("DisplayZip")
    
End Sub

#If LIVE = 1 Then
Private Function GetDbError(ByVal lo_Db As Object) As String
#Else
Private Function GetDbError(ByVal lo_Db As ARMSYSCOMLib.ArmDb) As String
#End If
On Error GoTo errHandler
    If IsArray(lo_Db.SQLErrorMessages) Then
        Debug.Assert (IsArray(lo_Db.SQLErrorCodes))
        ' Display errors msgBox
        GetDbError = Join(lo_Db.SQLErrorCodes, ",") & vbCrLf & Join(lo_Db.SQLErrorMessages, vbCrLf)
    Else
        ' ExecuteSQL failed but no error message?
        GetDbError = "Unknown error"
    End If
    Exit Function
errHandler:
    Call ErrorHandler("GetDbError")
  
End Function

Private Sub grd_Attachments_ItemSelected()
On Error GoTo errHandler
    
  'If me_Mode = emCopy Then Exit Sub
    
    Call LockScreen(True)

  If grd_Attachments.SelectedCount = 1 Then
    Call Item_ViewInit_Attachment(GetInfoArrayIndex("CD_Attachments"), grd_Attachments.SelectedKey(0)(0))
  End If
    
    Call LockScreen(False)
  
  Exit Sub
  
errHandler:
    DBLog "grd_Attachments_ItemSelected"
    Call LockScreen(False)
    Select Case Err.Number
        Case 2138 + C_ERRORRAISE
            MsgBox MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation
        Case Else
            MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation
    End Select

End Sub

' ATTACHMENT DETAIL END
'************************************************************************************************************************


Private Sub Item_AddInit_Channel_PE(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler
    
    Dim li_FrameIndex As Integer
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    
    'clear the frame record
    Call ClearForm(UserControl.Controls, fra_record(li_FrameIndex))
    
    Call EnableFrame(UserControl.Controls, fra_record(li_FrameIndex), True)
    Call EnableFrame(UserControl.Controls, fra_ModifInfo(li_FrameIndex), False)
    
    Call InitializedFraRecord(al_InfoArrayIndex)
    Call Item_LoadDefaultValue(al_InfoArrayIndex)

    txt_CreationDate(li_FrameIndex).Text = Format(Date, "dd\/mm\/yyyy")
    Txt_Creator(li_FrameIndex).Text = ms_LoginName
    txt_LastUpdDate(li_FrameIndex).Text = Format(Date, "dd\/mm\/yyyy")
    txt_UpdUser(li_FrameIndex).Text = ms_LoginName
    
    Call HandleToolbar(tlb_item, "B", True)
                
    'Resize the frame
    Call fra_item.Move(120, 120, UserControl.Width - 120 * 2, UserControl.Height - 120 * 2)
    Call tlb_item.Move(fra_item.Width - tlb_item.Width - 120, 120 * 2, tlb_item.Width - 120, fra_item.Height - 120 * 3)
    Call fra_record(li_FrameIndex).Move(120, 120 + lbl_ItemTitle.Height, fra_item.Width - tlb_item.Width - 120 * 3, fra_item.Height - 120 * 2 - lbl_ItemTitle.Height)
    
    'display frame item ady_index
    fra_record(li_FrameIndex).Visible = True
    fra_record(li_FrameIndex).ZOrder
    
    fra_item.Visible = True
    fra_item.ZOrder

    
  Exit Sub
errHandler:
    Call ErrorHandler("Item_AddInit_Channel_PE")

End Sub

Private Sub Item_UpdateInit_Channel_PE(ByVal al_InfoArrayIndex As Long, ByVal al_MKT_CHNL_PE_Key As Long)
On Error GoTo errHandler
    
    Dim li_FrameIndex As Integer
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    
    'clear the frame record
    Call ClearForm(UserControl.Controls, fra_record(li_FrameIndex))
    
    Call EnableFrame(UserControl.Controls, fra_record(li_FrameIndex), True)
    Call EnableFrame(UserControl.Controls, fra_ModifInfo(li_FrameIndex), False)
    
    Call InitializedFraRecord(al_InfoArrayIndex)
    
    Call Item_LoadDB_SubItem(al_InfoArrayIndex, al_MKT_CHNL_PE_Key)
    
    If mo_Db.RowCount(ml_Cursor_SubItem) = 0 Then
'        Call MsgBox(MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation)
'        Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)
'        Exit Sub
        Err.Raise C_ERRORRAISE + 2138, "Item_UpdateInit_Attachment", "#The record you try to open has been deleted by an other user. Please refresh the grid."
    End If
    
        'Resize the frame
    Call fra_item.Move(120, 120, UserControl.Width - 120 * 2, UserControl.Height - 120 * 2)
    Call tlb_item.Move(fra_item.Width - tlb_item.Width - 120, 120 * 2, tlb_item.Width - 120, fra_item.Height - 120 * 3)
    Call fra_record(li_FrameIndex).Move(120, 120 + lbl_ItemTitle.Height, fra_item.Width - tlb_item.Width - 120 * 3, fra_item.Height - 120 * 2 - lbl_ItemTitle.Height)

    
    mb_ChangeSubItemNbFromat = True
    Call LoadDataToForm(ml_Cursor_SubItem, UserControl.Controls, fra_record(li_FrameIndex))
    
    Call HandleToolbar(tlb_item, "C", True)
    
    'display frame item ady_index
    fra_record(li_FrameIndex).Visible = True
    fra_record(li_FrameIndex).ZOrder
    
    fra_item.Visible = True
    fra_item.ZOrder

    
  Exit Sub
errHandler:
    fra_item.Visible = True
    fra_item.ZOrder
    fra_record(li_FrameIndex).Visible = False
    Call ErrorHandler("Item_UpdateInit_Channel_PE")

End Sub

Private Sub Item_DeleteInit_Channel_PE(ByVal al_InfoArrayIndex As Long, ByVal al_MKT_CHNL_PE_Key As Long)
On Error GoTo errHandler
    Dim li_FrameIndex As Integer
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    
    Call ClearForm(UserControl.Controls, fra_record(li_FrameIndex))
    
    Call EnableFrame(UserControl.Controls, fra_record(li_FrameIndex), False)
    
    Call InitializedFraRecord(al_InfoArrayIndex)
              
        
    Call fra_record(li_FrameIndex).Move(120, 120 + lbl_ItemTitle.Height, fra_item.Width - tlb_item.Width - 120 * 3, fra_item.Height - 120 * 2 - lbl_ItemTitle.Height)
    
    Call Item_LoadDB_SubItem(al_InfoArrayIndex, al_MKT_CHNL_PE_Key)
    
    If mo_Db.RowCount(ml_Cursor_SubItem) = 0 Then
'        Call MsgBox(MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation)
'        Call Item_ExitToGrid_SubItem(al_InfoArrayIndex)
'        Exit Sub
        Err.Raise C_ERRORRAISE + 2138, "Item_DeleteInit_Channel_PE", "#The record you try to open has been deleted by an other user. Please refresh the grid."
    End If
    
    Call LoadDataToForm(ml_Cursor_SubItem, UserControl.Controls, fra_record(li_FrameIndex))
    
    Call HandleToolbar(tlb_item, "D", True)
    
    'display frame item ady_index
    fra_record(li_FrameIndex).Visible = True
    fra_record(li_FrameIndex).ZOrder

    fra_item.Visible = True
    fra_item.ZOrder

  Exit Sub
errHandler:
    fra_item.Visible = True
    fra_item.ZOrder
    Call ErrorHandler("Item_DeleteInit_Channel_PE")

End Sub


Private Sub grd_detail1_GotFocus()
On Error GoTo errHandler
    
    Call LockScreen(True)

    Call grd_detail1_Click
    
CleanUp:
   Call LockScreen(False)
    Exit Sub
    
errHandler:
    Call LockScreen(False)
'    Call ErrorHandler("cbo_Attachment_Type_ComboItemSelected")

End Sub

Private Sub grd_detail1_ItemSelected()
On Error GoTo errHandler
    
    If me_Mode = emAgg Then Exit Sub
    
    Call LockScreen(True)
    
    Dim ll_InfoArrayIndex As Long
    ll_InfoArrayIndex = GetInfoArrayIndex(tbs_selector(ml_tbsidx).SelectedItem.Tag)
    Call Item_ViewInit(ll_InfoArrayIndex, grd_detail1)
CleanUp:
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "grd_detail1_ItemSelected"
    Call LockScreen(False)
    Select Case Err.Number
        Case 2138 + C_ERRORRAISE
            MsgBox MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation
        Case Else
            MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation
    End Select
End Sub


Private Sub grd_detail2_Click()
On Error GoTo errHandler
    
    Call LockScreen(True)
    
    If me_Mode <> emAgg Then Call HandleToolbar(tlb_detail, "4", mb_IsUpdater)
    If grd_detail1.SelectedCount <= 0 Then GoTo CleanUp
    grd_detail1.DeselectRow
    
CleanUp:
    Call LockScreen(False)
   Exit Sub
    
errHandler:
    DBLog "grd_detail2_Click"
    Call LockScreen(False)
   Select Case Err.Number
        Case 2138 + C_ERRORRAISE
            MsgBox MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation
        Case Else
            MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation
    End Select

End Sub

Private Sub grd_detail1_Click()
On Error GoTo errHandler
    
    If Not grd_detail2.Visible Then Exit Sub
    
    Call LockScreen(True)
    

    If me_Mode <> emAgg Then Call HandleToolbar(tlb_detail, "1", mb_IsUpdater)
    
    If grd_detail2.SelectedCount <= 0 Then GoTo CleanUp
    grd_detail2.DeselectRow
    
    
CleanUp:
    Call LockScreen(False)

   Exit Sub
errHandler:
    DBLog "grd_detail1_Click"
    Call LockScreen(False)
    
    MsgBox MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation

End Sub

Private Sub grd_detail2_ItemSelected()
On Error GoTo errHandler
    
    If me_Mode = emAgg Then Exit Sub
    
    Call LockScreen(True)
    
    Dim ll_InfoArrayIndex As Long
    ll_InfoArrayIndex = GetInfoArrayIndex(tbs_selector(ml_tbsidx).SelectedItem.Tag)
      
    Call Item_ViewInit(ll_InfoArrayIndex, grd_detail2)
    
    Call LockScreen(False)
            
   Exit Sub
errHandler:
    DBLog "grd_detail2_ItemSelected"
    Call LockScreen(False)
    MsgBox MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation

End Sub

Private Sub grd_list_ItemSelected()
On Error GoTo errHandler
    
    Call LockScreen(True)
    
    Call ClearForm(UserControl.Controls, fra_detail)
    
    
    ml_MasterKey = grd_List.SelectedLine(0, "MKT_Key")
    If me_Mode = emList Then
        'select General tab selected on the selector
        tbs_selector(ml_tbsidx).Tabs(1).Selected = True
    Else
        Call tbs_selector_Click(CInt(ml_tbsidx))
    End If
    
    Dim ll_InfoArrayIndex As Long
    ll_InfoArrayIndex = GetInfoArrayIndex(tbs_selector(ml_tbsidx).SelectedItem.Tag)
    
    
    'Change screen mode
    If me_Mode <> emAgg Then SetMode (emDetail)
    
    'Disable fra_filter
    Call EnableFrame(UserControl.Controls, fra_filter, False)
       
        
    'TODO : load default values
     
    'change title value (value is taken from the grid list)
    If ml_tbsidx = 0 Then
        lbl_DetailTitle.Caption = tbs_selector(ml_tbsidx).SelectedItem.Caption & " // " & grd_List.SelectedLine(0, "Comp_desc") & " - " & grd_List.SelectedLine(0, "CT_desc")
    Else
        lbl_DetailTitle.Caption = tbs_selector(ml_tbsidx).SelectedItem.Caption & " // " & grd_List.SelectedLine(0, "Comp_desc") & " - STRATEGIC"
    End If
    'change comment value (value is taken from the grid list)
     txt_DetailGeneral_comment = grd_List.SelectedLine(0, "Master_Comment")
     
    'Resize the frame
    Call fra_detail.Move(fra_filter.Width + 120 * 2, 120, UserControl.Width - fra_filter.Width - 120 * 3, UserControl.Height - 120 * 2)
    Call tlb_detail.Move(fra_detail.Width - tlb_detail.Width - 120, 120 * 2, tlb_detail.Width, fra_detail.Height - 120 * 3)
    
    'display frame detail
    tlb_detail.Visible = True
    fra_detail.Visible = True
    fra_detail.ZOrder
    
    Call LockScreen(False)
  
    
    Exit Sub
errHandler:
    DBLog "grd_list_ItemSelected"
     Call LockScreen(False)
    Select Case Err.Number
        Case 2138 + C_ERRORRAISE
            MsgBox MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation
        Case Else
            MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation
    End Select

End Sub

Private Sub grd_Products_ItemSelected()
On Error GoTo errHandler
    
    If Not UCase(grd_Products.Columns(0).Name) Like "MKT_CHNL_PE_KEY" Then Exit Sub
    
    If me_Mode = emCopy Then Exit Sub
    
    Call LockScreen(True)
    
    Dim ll_InfoArrayIndex As Long
    ll_InfoArrayIndex = GetInfoArrayIndex("CD_CHANNEL_PE")
    
    Call Item_ViewInit_SubItem(ll_InfoArrayIndex, grd_Products.SelectedLine(0, "MKT_CHNL_PE_Key"))
    
    Call LockScreen(False)
    
    Exit Sub
errHandler:
    DBLog "grd_Products_ItemSelected"
    Call LockScreen(False)
    Select Case Err.Number
        Case 2138 + C_ERRORRAISE
            MsgBox MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation
        Case Else
            MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation
    End Select

End Sub

Private Sub grd_SalesOrg_SalesReps_ItemSelected()
On Error GoTo errHandler
    
    If me_Mode = emCopy Then Exit Sub
    
    Call LockScreen(True)
    
    Dim ll_InfoArrayIndex As Long
    ll_InfoArrayIndex = GetInfoArrayIndex("CD_SALESREPS")
    
    Call Item_ViewInit_SubItem(ll_InfoArrayIndex, grd_SalesOrg_SalesReps.SelectedLine(0, "MKT_SOPeople_Key"))
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "grd_SalesOrg_SalesReps_ItemSelected"
    Call LockScreen(False)
    Select Case Err.Number
        Case 2138 + C_ERRORRAISE
            MsgBox MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation
        Case Else
            MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation
    End Select
End Sub



Private Sub opt_FiltersDate_Click(Index As Integer)
On Error GoTo errHandler
' TODO Manage Error and mouse
    
    If mb_internal Then Exit Sub
                           
    Call LockScreen(True)
    Call SelectDateFilters(Index)
    
CleanUp:
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "opt_FiltersDate_Click(" & Index & ")"
    Call LockScreen(False)
    MsgBox MsgText(131, ms_Language_Code, "#Invalid Date."), vbInformation
   
End Sub

Private Sub SelectDateFilters(ByVal aIndex As Long)
On Error GoTo errHandler
    ' Show/Hide the range
    Dim lShow As Boolean
    lShow = (aIndex = 1)
    cal_FiltersMin.Visible = lShow
    cal_filtersMax.Visible = lShow
    cbo_FiltersDate.Visible = lShow
    
    If Not lShow Then
        cal_FiltersMin.reinit_cal
        cal_filtersMax.reinit_cal
        cbo_FiltersDate.SearchItem "1", 2, 0
    End If
    
    Call OnFilterChange
    Exit Sub
    
errHandler:
    Call ErrorHandler("SelectDateFilters")
    
End Sub
Private Sub OnFilterChange()
On Error GoTo errHandler

    ' Treeview don't need to be clear because all things are displayed in the treeview
    
    Dim ls_Filters As String
    
    
    Dim ll_Idx As Long, ll_Count As Long
    ll_Count = Opt_FiltersType.Count - 1
    For ll_Idx = 0 To ll_Count
        If Opt_FiltersType.Item(ll_Idx).value Then
            ls_Filters = Opt_FiltersType.Item(ll_Idx).Caption
            Exit For
        End If
    Next
    
    
    If opt_FiltersDate(0).value Then
        ls_Filters = ls_Filters & ", " & opt_FiltersDate(0).Caption
    End If
    
    If opt_FiltersDate(1).value Then
        If Not cbo_FiltersDate.SelectedItem Is Nothing Then
            ls_Filters = ls_Filters & ", " & cbo_FiltersDate.SelectedItem.DisplayText & " " & opt_FiltersDate(1).Caption & " " & IIf(cal_FiltersMin.date_courte <> "", cal_FiltersMin.date_courte, "-") & " && " & IIf(cal_filtersMax.date_courte <> "", cal_filtersMax.date_courte, "-")
        Else
            ls_Filters = ls_Filters & ", -"
        End If
    End If
    grd_List.Title = ls_Filters
    
    If Not mb_Initialized Then Exit Sub
    
    tv_filter.Visible = False
    tv_filter.Clear
    cmd_TVReLoad.Visible = True
    mb_TVCmdReloadShow = True
        
    grd_List.Requests = ""
    grd_List.ClearGrid
    
    ' Clear the treeview sel
    'Set tv_filter.SelectedItem = Nothing
    Exit Sub
errHandler:

    Call ErrorHandler("OnFilterChange")
    
End Sub


Private Sub Opt_FiltersType_Click(Index As Integer)
On Error GoTo errHandler


    If mb_internal Then Exit Sub
    
    Call LockScreen(True)
    
    Call OnFilterChange

    
    mb_internal = True
    tbs_selector(Index).Tabs(1).Selected = True
    tbs_selector(Index).Visible = True
    tbs_selector(Index).ZOrder
    mb_internal = False
    ml_tbsidx = Index

CleanUp:
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "Opt_FiltersType_Click(" & Index & ")"
    Call LockScreen(False)
    MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation
    
End Sub

Private Sub opt_Services_TechSupport_Click(Index As Integer)
On Error GoTo errHandler
    
    Call LockScreen(True)
    
    If Index = 1 Then
        txt_Services_Tech_Support.Visible = False
        txt_Services_Tech_Support.Text = ""
        cbo_Services_TechSupportRating.Visible = False
        Set cbo_Services_TechSupportRating.SelectedItem = Nothing
        lbl_label(134).Visible = False
    Else
        txt_Services_Tech_Support.Visible = True
        cbo_Services_TechSupportRating.Visible = True
        lbl_label(134).Visible = True
    End If

CleanUp:
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "opt_Services_TechSupport_Click(" & Index & ")"
    Call LockScreen(False)
    MsgBox MsgText(929, ms_Language_Code, "#Invalid option."), vbInformation

    
End Sub

Private Sub opt_Services_Warranty_Click(Index As Integer)
On Error GoTo errHandler
    
    Call LockScreen(True)
    
    If Index = 1 Then
        txt_Services_Warranty.Visible = False
        txt_Services_Warranty.Text = ""
    Else
        txt_Services_Warranty.Visible = True
    End If
    
    Call LockScreen(False)
    
    Exit Sub
    
errHandler:
    DBLog "opt_Services_Warranty_Click(" & Index & ")"
    Call LockScreen(False)
    MsgBox MsgText(929, ms_Language_Code, "#Invalid option."), vbInformation
    
End Sub

Private Sub tbs_selector_Click(Index As Integer)
On Error GoTo errHandler
       
    Static l_PrevIndex As Long
    
    If mb_internal Then Exit Sub
    If l_PrevIndex = tbs_selector(Index).SelectedItem.Index And (me_Mode <> emList) Then Exit Sub
  
    
    Call LockScreen(True)
    
    l_PrevIndex = tbs_selector(Index).SelectedItem.Index
    
    SetMode (emDetail)
    
    Call LoadDetailFrame
    
    lbl_DetailTitle.Caption = tbs_selector(ml_tbsidx).SelectedItem.Caption & " // " & grd_List.SelectedLine(0, "Comp_desc") & " - " & IIf(ml_tbsidx = 0, grd_List.SelectedLine(0, "CT_desc"), "STRATEGIC")
     Call LockScreen(False)
    
    Exit Sub

errHandler:
    DBLog "tbs_selector_Click"
    Call LockScreen(False)
     MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation

End Sub

Private Sub LoadDetailFrame()
On Error GoTo errHandler

    Dim lc_Data As Long, ls_Request As String
    If me_Mode <> emDetail And me_Mode <> emAgg Then Exit Sub
    
    grd_detail1.Visible = False
    grd_detail2.Visible = False
    
    Zone_Client.top = fra_detail.top + txt_DetailGeneral_comment.top + txt_DetailGeneral_comment.Height + 120 * 2 'fra_detail.top + 3420 + 120 * 2
    Zone_Client.left = 120
    Zone_Client.Height = fra_detail.Height - (txt_DetailGeneral_comment.top + txt_DetailGeneral_comment.Height) - 120 * 2 ' lbl_DetailTitle.Height - -tbs_selector(0).Height - txt_DetailGeneral_comment.Height - txt_DetailGeneral_comment.top - 120     ' -  3420 - 120
    Zone_Client.Width = fra_detail.Width - tlb_detail.Width - 120 * 3
    
    
    'resize grid(s) and hide/unhide grid(s)
    Dim ll_InfoArrayIndex As Long
    ll_InfoArrayIndex = GetInfoArrayIndex(tbs_selector(IIf(Opt_FiltersType(0).value, 0, 1)).SelectedItem.Tag)
    
    If mt_ClassInfoLst(ll_InfoArrayIndex).ConfigDetail.ConfigGrid(0).Request <> "" And mt_ClassInfoLst(ll_InfoArrayIndex).ConfigDetail.ConfigGrid(1).Request = "" Then
            If me_Mode = emAgg Then
                Call InitializedDetailGrid(grd_detail1, 2, ll_InfoArrayIndex)
            Else
                Call InitializedDetailGrid(grd_detail1, 0, ll_InfoArrayIndex)
            End If
'ffffff
            grd_detail2.ClearGrid
            Call ResizeVisu_Grids(Zone_Client.left, Zone_Client.top, Zone_Client.Width, Zone_Client.Height, True, False)
    ElseIf mt_ClassInfoLst(ll_InfoArrayIndex).ConfigDetail.ConfigGrid(0).Request <> "" And mt_ClassInfoLst(ll_InfoArrayIndex).ConfigDetail.ConfigGrid(1).Request <> "" Then
            If me_Mode = emAgg Then
                Call InitializedDetailGrid(grd_detail1, 2, ll_InfoArrayIndex)
                Call InitializedDetailGrid(grd_detail2, 3, ll_InfoArrayIndex)
            Else
                Call InitializedDetailGrid(grd_detail1, 0, ll_InfoArrayIndex)
                Call InitializedDetailGrid(grd_detail2, 1, ll_InfoArrayIndex)
            End If
            Call ResizeVisu_Grids(Zone_Client.left, Zone_Client.top, Zone_Client.Width, Zone_Client.Height, True, True)
    End If
    
    If (StrComp(mt_ClassInfoLst(ll_InfoArrayIndex).ConfigRecord.NameFrame, "CD_General", vbTextCompare) = 0) Then
        Call txt_DetailGeneral_comment.Move(Zone_Client.left, txt_DetailGeneral_comment.top, Zone_Client.Width)
        Call fra_ModifInfo(13).Move(Zone_Client.left, fra_ModifInfo(13).top, Zone_Client.Width)
        If ml_MasterKey <> 0 Then
            ls_Request = mt_ClassInfoLst(GetInfoArrayIndex("CD_GENERAL")).ConfigRecord.RequestView
            ls_Request = Replace(ls_Request, "$MKT_Key$", ml_MasterKey, , , vbTextCompare)
            ls_Request = Replace(ls_Request, "$Language_code$", ms_Language_Code, , , vbTextCompare)
            lc_Data = OpenSQLSafe(mo_Db, ls_Request, 1)
            Call LoadDataToForm(lc_Data, UserControl.Controls, fra_ModifInfo(13))
            Call mo_Db.Close(lc_Data)
        End If
        fra_ModifInfo(13).Visible = True
    Else
        fra_ModifInfo(13).Visible = False
    End If
    
    'Change face toolbar
    If me_Mode <> emAgg Then
        Call HandleToolbar(tlb_detail, mt_ClassInfoLst(ll_InfoArrayIndex).ConfigDetail.FaceToolbar, mb_IsUpdater)
    End If
    
    Exit Sub
    'Change toolbar face
errHandler:
    Call mo_Db.Close(lc_Data)
    Call ErrorHandler("LoadDetailFrame")
   
End Sub


Private Sub InitializedDetailGrid(ByVal ao_grid As ArmGrid, ByVal ai_CongfigColIdx As Integer, ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler
    Dim ls_gridRequest As String
    
    
    ls_gridRequest = Replace(mt_ClassInfoLst(al_InfoArrayIndex).ConfigDetail.ConfigGrid(ai_CongfigColIdx).Request, "$MKT_Key$", ml_MasterKey, , , vbTextCompare)
    ls_gridRequest = Replace(ls_gridRequest, "$Language_Code$", ms_Language_Code, , , vbTextCompare)
    
    ao_grid.ClearGrid
    
    ls_gridRequest = Replace(ls_gridRequest, "$FIN_Year$", "Null", , , vbTextCompare)
    
    If Not ao_grid.SetColumns(mt_ClassInfoLst(al_InfoArrayIndex).ConfigDetail.ConfigGrid(ai_CongfigColIdx).Columns) Then
        Debug.Print " InitializedDetailGrid -> SetColumns error"
        Call Unload_A_Com
        End
    End If
    
    Call ao_grid.LoadConstants(ptStatic, mt_ClassInfoLst(al_InfoArrayIndex).ConfigDetail.ConfigGrid(ai_CongfigColIdx).Labels, ctColumns)
    
    ao_grid.Requests = ls_gridRequest
    If ao_grid.Execute = False Then
        Debug.Print " InitializedDetailGrid -> Execute request grid error"
    End If
     
    Exit Sub
errHandler:
    Call ErrorHandler("InitializedDetailGrid")
   
End Sub


Private Sub InitializedSubItemGrid(ByVal ao_grid As ArmGrid, ByVal ai_CongfigColIdx As Integer, ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler
    Dim ls_gridRequest As String
    
    ls_gridRequest = Replace(mt_ClassInfoLst(al_InfoArrayIndex).ConfigDetail.ConfigGrid(ai_CongfigColIdx).Request, "$Key$", ml_CurrentKey, , , vbTextCompare)
    ls_gridRequest = Replace(ls_gridRequest, "$Language_code$", ms_Language_Code, , , vbTextCompare)
    
    ao_grid.ClearGrid
    
    If Not ao_grid.SetColumns(mt_ClassInfoLst(al_InfoArrayIndex).ConfigDetail.ConfigGrid(ai_CongfigColIdx).Columns) Then
        Debug.Print " InitializedDetailGrid -> SetColumns error"
        Call Unload_A_Com
        End
    End If
    
    ao_grid.Requests = ls_gridRequest
    If ao_grid.Execute = False Then
        Debug.Print " InitializedSubItem -> Execute request grid error"
    End If
    
    Exit Sub
errHandler:
    Call ErrorHandler("InitializedSubItemGrid")
   
End Sub
Private Sub ResizeVisu_Grids(ByVal ai_left As Integer, ByVal ai_top As Integer, ByVal ai_Width As Integer, ByVal ai_height As Integer, ByVal ab_VisuGrd1 As Boolean, ByVal ab_VisuGrd2 As Boolean)
On Error GoTo errHandler
    Dim li_size As Integer
    
    If ab_VisuGrd1 And Not ab_VisuGrd2 Then
        li_size = ai_height - 120 * 2
    Else
        li_size = ai_height / 2 - 120 * 2
    End If
    
    Call grd_detail1.Move(ai_left, ai_top, ai_Width, li_size)
    Call grd_detail2.Move(ai_left, grd_detail1.top + grd_detail1.Height + 120 * 2, ai_Width, grd_detail1.Height)
    
    grd_detail1.Visible = ab_VisuGrd1
    grd_detail2.Visible = ab_VisuGrd2
    
    Exit Sub
    
errHandler:
    Call ErrorHandler("ResizeVisu_Grids")

End Sub

Private Sub tlb_Attachments_action(ByVal as_Role As String, as_Language As String)
On Error GoTo errHandler
   
    Call LockScreen(True)
    
    Dim ll_InfoArrayIndex As Long
    ll_InfoArrayIndex = GetInfoArrayIndex("CD_Attachments")
    
    Select Case as_Role
        
        Case "A"
            ' Want to add an item
            Call Item_AddInit_Attachment(ll_InfoArrayIndex)
            
        Case "B"
        ' Want to update the item
            'Call Item_UpdateInit(ll_InfoArrayIndex)
            If grd_Attachments.SelectedCount <= 0 Then GoTo CleanUp
'            fra_detail.Visible = False
'            fra_filter.Visible = False
'            fra_list.Visible = False
'            fra_item.Visible = False
            Call Item_UpdateInit_Attachment(ll_InfoArrayIndex, grd_Attachments.SelectedLine(0, "ATT_Key"))
        
        Case "C"
            ' Want to delete
            If grd_Attachments.SelectedCount <= 0 Then GoTo CleanUp
'            fra_detail.Visible = False
'            fra_list.Visible = False
'            fra_item.Visible = False
            Call Item_DeleteInit_Attachment(ll_InfoArrayIndex, grd_Attachments.SelectedLine(0, "ATT_Key"))
        
        Case "F" 'reload
            grd_Attachments.Refresh
    
        Case "l"
            'delete local from grid
            Call Item_DeleteLocal(grd_Attachments, grd_Attachments.SelectedLine(0, "ATT_Key"), False)
    
    End Select
    
CleanUp:
    
    Call LockScreen(False)
    
    Exit Sub
errHandler:
    DBLog "tlb_Attachments_action"
    Call LockScreen(False)
    Select Case Err.Number - C_ERRORRAISE
    Case "927":
        MsgBox MsgText(927, ms_Language_Code, "#No more previous item"), vbInformation
    Case "928":
        MsgBox MsgText(928, ms_Language_Code, "#No more next item"), vbInformation
    Case "2135":
        MsgBox MsgText(2135, ms_Language_Code, "Unable to update the record."), vbInformation
    Case "2136"
        MsgBox MsgText(2136, ms_Language_Code, "Unable to delete the record."), vbInformation
    Case "2137":
        MsgBox MsgText(2137, ms_Language_Code, "Unable to add the record."), vbInformation
    Case "2138":
        MsgBox MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation
    Case Else
        MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation
    End Select

End Sub

Private Sub tlb_detail_action(ByVal as_Role As String, as_Language As String)
On Error GoTo errHandler
    
    Call LockScreen(True)

    Dim ll_InfoArrayIndex As Long
    ll_InfoArrayIndex = GetInfoArrayIndex(tbs_selector(ml_tbsidx).SelectedItem.Tag)
    
    
    Select Case as_Role
        
        Case "A"
            ' Want to add an item
             Call Item_AddInit(ll_InfoArrayIndex)
            
        Case "B"
        ' Want to update the item
            If grd_detail1.SelectedCount > 0 Then
                Call Item_UpdateInit(ll_InfoArrayIndex, grd_detail1)
            Else
                Call Item_UpdateInit(ll_InfoArrayIndex, grd_detail2)
            End If
        
        Case "C"
            ' Want to delete
            Call Item_DeleteInit(ll_InfoArrayIndex)
        
        'Want to copy
            '-> Item_CopyInit
            
        Case "J"
        ' Jump to previous item
            Call GotoPreviousItem(grd_List)
        Case "K"
        ' Jump to next item
            Call GotoNextItem(grd_List)
        
            
        Case "F"
        ' Reload grid
            Call Reload_Detail(ll_InfoArrayIndex)
            
        Case "m"
        ' Want to aggregate
                Call SetMode(emAgg)
                If grd_detail2.Visible Then
                    grd_detail2.Visible = False
                    Call InitializedDetailGrid(grd_detail2, 3, ll_InfoArrayIndex)
                    grd_detail2.Visible = True
                End If
                Call InitializedDetailGrid(grd_detail1, 2, ll_InfoArrayIndex)
                
                Call HandleToolbar(tlb_detail, "3", True)
        Case "n"
            If grd_detail2.Visible Then Call InitializedDetailGrid(grd_detail2, 1, ll_InfoArrayIndex)
            Call HandleToolbar(tlb_detail, mt_ClassInfoLst(ll_InfoArrayIndex).ConfigDetail.FaceToolbar, mb_IsUpdater)
            
            Call InitializedDetailGrid(grd_detail1, 0, ll_InfoArrayIndex)
            Call SetMode(emDetail)
        ' Exit and return to grid
        Case "P" 'Print
            If ll_InfoArrayIndex = 0 Then
                Call ExportToWord(0, 0)
            Else
                If grd_detail1.SelectedCount > 0 Then
                    Call Item_Print(ll_InfoArrayIndex, grd_detail1)
                ElseIf grd_detail2.SelectedCount > 0 Then
                    Call Item_Print(ll_InfoArrayIndex, grd_detail2)
                End If
            End If
        Case "T"
            me_OldMode = emList
            Call Item_ExitToGrid(ll_InfoArrayIndex)
    End Select
    
    Call LockScreen(False)
    
    Exit Sub
errHandler:
    DBLog "tlb_detail_action"
    Call LockScreen(False)
    Select Case Err.Number
    Case 927:
        MsgBox MsgText(927, ms_Language_Code, "#No more previous item"), vbInformation
    Case 928:
        MsgBox MsgText(928, ms_Language_Code, "#No more next item"), vbInformation
    Case 2135:
        MsgBox MsgText(2135, ms_Language_Code, "#Unable to update the record."), vbInformation
    Case 2136
        MsgBox MsgText(2136, ms_Language_Code, "#Unable to delete the record."), vbInformation
    Case 2137:
        MsgBox MsgText(2137, ms_Language_Code, "#Unable to add the record."), vbInformation
    Case 2138 + C_ERRORRAISE:
        MsgBox MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation
    Case 2145 + C_ERRORRAISE
        MsgBox MsgText(2145, ms_Language_Code, "#Unable to load the template from the database. Printing process was cancelled."), vbInformation
    Case 2507
        MsgBox MsgText(2144, ms_Language_Code, "#This record has been, modified by an other.Please exit from this screen and refresh the grid."), vbInformation
    Case Else
        MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation
    End Select


End Sub



Private Sub Reload_Detail(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler
    grd_detail1.Visible = False
    grd_detail2.Visible = False
    
    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigDetail.ConfigGrid(0).Request <> "" Then
        grd_detail1.Refresh
        grd_detail1.Visible = True
    End If
    
    If me_Mode = emAgg Then
        If mt_ClassInfoLst(al_InfoArrayIndex).ConfigDetail.ConfigGrid(3).Request <> "" Then
            Call InitializedDetailGrid(grd_detail2, 3, al_InfoArrayIndex)
            grd_detail2.Visible = True
        End If
    Else
        If mt_ClassInfoLst(al_InfoArrayIndex).ConfigDetail.ConfigGrid(1).Request <> "" Then
            Call InitializedDetailGrid(grd_detail2, 1, al_InfoArrayIndex)
            grd_detail2.Visible = True
        End If
    End If
    Exit Sub
errHandler:
    Call ErrorHandler("Reload_Detail")
   
End Sub



Private Sub tlb_item_action(ByVal as_Role As String, as_Language As String)
On Error GoTo errHandler
    
    Call LockScreen(True)
    
    Dim ll_InfoArrayIndex As Long
    ll_InfoArrayIndex = GetInfoArrayIndex(tbs_selector(ml_tbsidx).SelectedItem.Tag)
    
    Dim lv_MsgReplaceInfo As Variant
    Select Case as_Role
            
        Case "B"
         
            If grd_detail1.SelectedCount > 0 Then
                Call Item_UpdateInit(ll_InfoArrayIndex, grd_detail1)
            Else
                Call Item_UpdateInit(ll_InfoArrayIndex, grd_detail2)
            End If
        
        Case "D"
            'reload subitem (Attachment)
            Call Item_UpdateReinit(ml_Cursor_SubItem, GetInfoArrayIndex("CD_Attachments"))
            
        
        Case "E"
            'Validate Add(SalesReps)
            Call Item_Add_SalesReps(GetInfoArrayIndex("CD_SalesReps"))
            
        Case "F"
            'Validate Update (SalesReps)
            Call Item_Update_SalesReps(GetInfoArrayIndex("CD_SalesReps"))
        
        Case "G"
            'Validate Delete (SalesReps)
            'ask confirmation for delete
            ReDim lv_MsgReplaceInfo(0, 1)
            lv_MsgReplaceInfo(0, 0) = "$TabSelectorCaption$"
            lv_MsgReplaceInfo(0, 1) = lbl_label(10).Caption
            If MsgBox(MsgText(mt_ClassInfoLst(ll_InfoArrayIndex).ConfigRecord.DeleteMsg(0, 0), ms_Language_Code, mt_ClassInfoLst(ll_InfoArrayIndex).ConfigRecord.DeleteMsg(0, 1), lv_MsgReplaceInfo), vbExclamation + vbDefaultButton2 + vbYesNo) = vbYes Then
            Call Item_Delete_SalesReps(GetInfoArrayIndex("CD_SalesReps"))
            End If
        
        Case "H"
            ' Validate the add
            Call Item_Add(ll_InfoArrayIndex)
        
        Case "I"
            'this is wrong - need to be diferentiate between CD_SalesReps, CD_Attachmenmt
            ' Reload (Add mode)
            Call Item_AddReinit(ll_InfoArrayIndex)
                        
        Case "J"
        ' Jump to previous item
            '-> GotoPreviousItem
            If grd_detail1.SelectedCount > 0 Then
                Call GotoPreviousItem(grd_detail1)
            Else
                Call GotoPreviousItem(grd_detail2)
            End If
            
        Case "K"
        ' Jump to next item
            '-> GotoNextItem
            If grd_detail1.SelectedCount > 0 Then
                Call GotoNextItem(grd_detail1)
            Else
                Call GotoNextItem(grd_detail2)
            End If
        
        Case "L"
            ' Validate the update
            If grd_detail1.SelectedCount > 0 Then
                Call Item_Update(ll_InfoArrayIndex, grd_detail1)
            Else
                
                Call Item_Update(ll_InfoArrayIndex, grd_detail2)
            End If
        
        Case "M"
            ' Reload (Update mode)
            Call Item_UpdateReinit(ml_Cursor, ll_InfoArrayIndex)

        Case "N"
            'ask confirmation for delete
            ReDim lv_MsgReplaceInfo(0, 1)
            lv_MsgReplaceInfo(0, 0) = "$TabSelectorCaption$"
            lv_MsgReplaceInfo(0, 1) = tbs_selector(ml_tbsidx).SelectedItem.Caption
            If MsgBox(MsgText(mt_ClassInfoLst(ll_InfoArrayIndex).ConfigRecord.DeleteMsg(0, 0), ms_Language_Code, mt_ClassInfoLst(ll_InfoArrayIndex).ConfigRecord.DeleteMsg(0, 1), lv_MsgReplaceInfo), vbExclamation + vbDefaultButton2 + vbYesNo) = vbYes Then
            Call Item_Delete(ll_InfoArrayIndex)
            End If
        
        Case "O" 'Validate Add (Attachment)
            Call Item_Add_Attachment(GetInfoArrayIndex("CD_Attachments"), mt_ClassInfoLst(ll_InfoArrayIndex).ConfigRecord.IndexClassAtt, ml_CurrentKey)
        
        Case "P" 'Validate Update (Attachment)
            Call Item_Update_Attachment(GetInfoArrayIndex("CD_Attachments"))
        
        Case "Q" 'Validate Delete (Attachment)
            'ask confirmation for delete
            ReDim lv_MsgReplaceInfo(0, 1)
            lv_MsgReplaceInfo(0, 0) = "$TabSelectorCaption$"
            lv_MsgReplaceInfo(0, 1) = lbl_label(11).Caption

            If MsgBox(MsgText(mt_ClassInfoLst(ll_InfoArrayIndex).ConfigRecord.DeleteMsg(0, 0), ms_Language_Code, mt_ClassInfoLst(ll_InfoArrayIndex).ConfigRecord.DeleteMsg(0, 1), lv_MsgReplaceInfo), vbExclamation + vbDefaultButton2 + vbYesNo) = vbYes Then
            Call Item_Delete_Attachment(GetInfoArrayIndex("CD_Attachments"))
            End If
                
        Case "R"
            If grd_detail1.SelectedCount > 0 Then
                Call Item_CopyInit(ll_InfoArrayIndex, grd_detail1)
            Else
                Call Item_CopyInit(ll_InfoArrayIndex, grd_detail2)
            End If
                
        Case "S" 'Exit to grid (Attachment)
            Call Item_ExitToGrid_SubItem(GetInfoArrayIndex("CD_Attachments"))
        
        Case "T"
        ' Exit without saving modification, return to grid
            me_Mode = me_OldMode
            Call SetMode(me_OldMode)
            Item_ExitToGrid (ll_InfoArrayIndex)
        
        Case "U" 'Exit to grid (SalesReps)
            Call Item_ExitToGrid_SubItem(GetInfoArrayIndex("CD_SalesReps"))
        
        Case "V"
            Call Item_UpdateReinit(ml_Cursor_SubItem, GetInfoArrayIndex("CD_SalesReps"))
        
        Case "W" ' Reload (Add mode) Attachments
            Call Item_AddReinit(GetInfoArrayIndex("CD_Attachments"))
        
        Case "X" ' Reload (Add mode) SalesReps
            Call Item_AddReinit(GetInfoArrayIndex("CD_SalesReps"))
            
        Case "Y" ' Reload (Add mode) Products
            Call Item_AddReinit(GetInfoArrayIndex("CD_Channel_PE"))
            
        Case "Z"
            'Copy validate
            Call Item_Copy(ll_InfoArrayIndex)
            
        Case "b"
            'CopyToUpdate
            Call Item_CopyToUpdate(ll_InfoArrayIndex)
        
        Case "d"
            'Validate Add (Products)
            Call Item_Add_Channel_PE(GetInfoArrayIndex("CD_Channel_PE"))
        
        Case "e"
            'Reload subitem (Products)
            Call Item_UpdateReinit(ml_Cursor_SubItem, GetInfoArrayIndex("CD_Channel_PE"))
        
        Case "f"
            'Exit to grid (Products)
            Call Item_ExitToGrid_SubItem(GetInfoArrayIndex("CD_Channel_PE"))
            
        Case "g"
            'Validate Update (Products)
            Call Item_Update_Channel_PE(GetInfoArrayIndex("CD_Channel_PE"))
        
        Case "h"
            'Validate Delete (Products)
            'ask confirmation for delete
            ReDim lv_MsgReplaceInfo(0, 1)
            lv_MsgReplaceInfo(0, 0) = "$TabSelectorCaption$"
            lv_MsgReplaceInfo(0, 1) = lbl_label(309).Caption
            If MsgBox(MsgText(mt_ClassInfoLst(ll_InfoArrayIndex).ConfigRecord.DeleteMsg(0, 0), ms_Language_Code, mt_ClassInfoLst(ll_InfoArrayIndex).ConfigRecord.DeleteMsg(0, 1), lv_MsgReplaceInfo), vbExclamation + vbDefaultButton2 + vbYesNo) = vbYes Then
            Call Item_Delete_Channel_PE(GetInfoArrayIndex("CD_Channel_PE"))
            End If
                        
        Case "i"
            If grd_Attachments.SelectedCount <= 0 Then GoTo CleanUp
            fra_detail.Visible = False
            fra_filter.Visible = False
            fra_list.Visible = False
            fra_item.Visible = False
            Call Item_UpdateInit_Attachment(GetInfoArrayIndex("CD_Attachments"), grd_Attachments.SelectedLine(0, "ATT_Key"))
            
        Case "j"
        ' Jump to previous item
            '-> GotoPreviousItem
            Call GotoPreviousItem(grd_SalesOrg_SalesReps)
            
        Case "k"
        ' Jump to next item
            '-> GotoNextItem
            Call GotoNextItem(grd_SalesOrg_SalesReps)
            
        Case "l"
            Call Item_UpdateInit_SalesReps(GetInfoArrayIndex("CD_SALESREPS"), grd_SalesOrg_SalesReps.SelectedLine(0, "MKT_SOPeople_Key"))
        Case "m"
        ' Jump to previous item
            '-> GotoPreviousItem
            Call GotoPreviousItem(grd_Products)
            
        Case "n"
            'Validate the add and go back to update mode for Attachment/SalesReps/Product
            Call Item_AddToUpdate(ll_InfoArrayIndex)
            
        Case "o"
        ' Jump to next item
            '-> GotoNextItem
            Call GotoNextItem(grd_Products)
        Case "p"
            Call Item_UpdateInit_Channel_PE(GetInfoArrayIndex("CD_Channel_PE"), grd_Products.SelectedLine(0, "MKT_CHNL_PE_Key"))
        
        Case "x"
            If grd_detail1.SelectedCount > 0 Then
                Call Item_Print(ll_InfoArrayIndex, grd_detail1)
            Else
                Call Item_Print(ll_InfoArrayIndex, grd_detail2)
            End If
            
        Case "y"
            Call Item_Print_SubItem(GetInfoArrayIndex("CD_SALESREPS"), grd_SalesOrg_SalesReps)
        
        Case "z"
            Call Item_Print_SubItem(GetInfoArrayIndex("CD_Channel_PE"), grd_Products)

    End Select
    
CleanUp:
     Call LockScreen(False)


    Exit Sub
errHandler:
    DBLog "tlb_item_action"
    Call LockScreen(False)

    Select Case Err.Number
    Case 202
        MsgBox MsgText(202, ms_Language_Code, "#The item you have added/updated couldn't be displayed with the current criteria set."), vbInformation + vbOKOnly
    Case 927:
        MsgBox MsgText(927, ms_Language_Code, "#No more previous item"), vbInformation
    Case 928:
        MsgBox MsgText(928, ms_Language_Code, "#No more next item"), vbInformation
    Case 2135:
        MsgBox MsgText(2135, ms_Language_Code, "Unable to update the record."), vbInformation
    Case 2136
        MsgBox MsgText(2136, ms_Language_Code, "Unable to delete the record."), vbInformation
    Case 2137:
        MsgBox MsgText(2137, ms_Language_Code, "Unable to add the record."), vbInformation
    Case 2138 + C_ERRORRAISE:
        MsgBox MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation
    Case 2507
        MsgBox MsgText(2144, ms_Language_Code, "This record has bee, modified by an other.Please exit from this screen and refresh the grid."), vbInformation
    Case Else
        MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation
    End Select
End Sub
Private Sub Item_AddToUpdate(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler

    'check the data validity -> Item_Check
    'check the data validity -> Item_Check
    If Not Item_CheckMandatory(al_InfoArrayIndex) Then Exit Sub
    
    If Not Item_Check(al_InfoArrayIndex) Then Exit Sub
    
    'update data on the db ->
    If Not Item_AddDB(al_InfoArrayIndex) Then Exit Sub

    
    'if success then Add the data locally ->
    If Not Item_AddLocal(UserControl.Controls, fra_record(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), grd_detail1, al_InfoArrayIndex) Then Exit Sub
    
    Call EnableFrame(UserControl.Controls, fra_record(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), True)
    Call EnableFrame(UserControl.Controls, fra_ModifInfo(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), False)
    
    Call DisableFrameParts(al_InfoArrayIndex)
    
    'Attachment
       
    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ExistAttach Then
        Call EnableFrame(UserControl.Controls, Fra_Attachments, True)
        Call grd_Attachments.Load("exec MKT_Attachments_lst " & ml_CurrentKey & ",'" & ms_Language_Code & "'," & mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexClassAtt, True)
    End If
    
    If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_SALESORG_*" Then
        Call grd_SalesOrg_SalesReps.Load("exec MKT_SO_People_lst " & ml_CurrentKey, True)
    End If
    
    If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_CHANNEL" Then
        Call grd_Products.Load("exec MKT_Channel_PE_lst " & ml_CurrentKey & ",'" & ms_Language_Code & "'", True)
    End If
    
    Call OpenCursor(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.RequestView)
        
    Call SetMode(emUpdate)
    
    me_OldMode = emDetail
    
    Call HandleToolbar(tlb_item, "3", True)
    
    Exit Sub
    
errHandler:
    Call ErrorHandler("Item_AddToUpdate")
   
End Sub

Private Sub Item_CopyToUpdate(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler

    If Not Item_Add(al_InfoArrayIndex) Then Exit Sub
    
    'Call Item_Copy_SubItems(al_InfoArrayIndex)
    
    Call EnableFrame(UserControl.Controls, fra_record(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), True)
    Call EnableFrame(UserControl.Controls, fra_ModifInfo(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), False)
    
    Call DisableFrameParts(al_InfoArrayIndex)
    
    'Attachment
       
    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ExistAttach Then
        Call EnableFrame(UserControl.Controls, Fra_Attachments, True)
        Call grd_Attachments.Load("exec MKT_Attachments_lst " & ml_CurrentKey & ",'" & ms_Language_Code & "'," & mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexClassAtt, True)
        Call HandleToolbar(tlb_Attachments, "0", True)
    End If
    
    If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_SALESORG_*" Then
        Call grd_SalesOrg_SalesReps.Load("exec MKT_SO_People_lst " & ml_CurrentKey, True)
        Call HandleToolbar(tlb_SalesReps, "0", True)
    End If
    
    If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_CHANNEL" Then
        Call grd_Products.Load("exec MKT_Channel_PE_lst " & ml_CurrentKey & ",'" & ms_Language_Code & "'", True)
        Call HandleToolbar(tlb_Products, "0", True)
    End If
    
    Call OpenCursor(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.RequestView)
        
    Call SetMode(emUpdate)
    
    me_OldMode = emDetail
    
    Call HandleToolbar(tlb_item, "3", True)
    
    Exit Sub
    
errHandler:
    Call ErrorHandler("Item_CopyToUpdate")
   
End Sub



Private Sub OpenCursor(ByVal as_Request As String)
On Error GoTo errHandler
    Dim ls_SelectRequest As String
    
    
    ls_SelectRequest = Replace(as_Request, "$MKT_Key$", ml_MasterKey, , , vbTextCompare)
    ls_SelectRequest = Replace(ls_SelectRequest, "$Key$", ml_CurrentKey, , , vbTextCompare)
    ls_SelectRequest = Replace(ls_SelectRequest, "$Language_code$", ms_Language_Code, , , vbTextCompare)
    
    If ml_Cursor > 0 Then
        mo_Db.Close (ml_Cursor)
        ml_Cursor = 0
    End If
    
    ml_Cursor = OpenSQLSafe(mo_Db, ls_SelectRequest)
    
    Exit Sub

errHandler:
    mo_Db.Close (ml_Cursor)
    Call ErrorHandler("OpenCursor")

End Sub


Private Sub Item_UpdateInit(ByVal al_InfoArrayIndex As Long, ByVal ao_grid As ArmGrid)
On Error GoTo errHandler

    mb_internalFin = True
    If grd_List.SelectedCount <= 0 Then Exit Sub
    
    If me_Mode <> emList And (ao_grid.SelectedCount <= 0 And mt_ClassInfoLst(al_InfoArrayIndex).ConfigDetail.ConfigGrid(0).Request <> "") Then Exit Sub
   
    
    ml_MasterKey = grd_List.SelectedLine(0, "MKT_Key")
    
    If me_Mode <> emList And mt_ClassInfoLst(al_InfoArrayIndex).ConfigDetail.ConfigGrid(0).Request <> "" Then
        ml_CurrentKey = ao_grid.SelectedLine(0, "Key")
    Else
        ml_CurrentKey = ml_MasterKey
    End If
    
    
    'change screen mode
    Call SetMode(emUpdate)
    Dim li_FrameIndex As Integer
    Dim ls_FrameName As String
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    ls_FrameName = UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame)
    
    
    
    Call EnableFrame(UserControl.Controls, fra_record(li_FrameIndex), True)
    
    Call EnableFrame(UserControl.Controls, fra_ModifInfo(li_FrameIndex), False)
    
    Call DisableFrameParts(al_InfoArrayIndex)
        
    If me_OldMode <> emView Then
        'clear the frame record and disable frames
        Call ClearForm(UserControl.Controls, fra_record(li_FrameIndex))
        
        Call InitializedFraRecord(al_InfoArrayIndex)
    'load data
    
        Call OpenCursor(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.RequestView)
        
        If mo_Db.RowCount(ml_Cursor) = 0 Then
'            Call MsgBox(MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation)
'            Call Item_ExitToGrid(al_InfoArrayIndex)
'            Exit Sub
            Err.Raise C_ERRORRAISE + 2138, "Item_UpdateInit", "#The record you try to open has been deleted by an other user. Please refresh the grid."
        End If
    
        Call LoadDataToForm(ml_Cursor, UserControl.Controls, fra_record(li_FrameIndex))
    
        txt_key(li_FrameIndex).Text = ml_CurrentKey
    Else
        me_OldMode = emDetail

        Call InitializedFraRecord(al_InfoArrayIndex)

        Call LoadDataToForm(ml_Cursor, UserControl.Controls, fra_record(li_FrameIndex))
    
        txt_key(li_FrameIndex).Text = ml_CurrentKey
        
    End If
    
    'change face toolbar
    Call HandleToolbar(tlb_item, "3", True)
    
    lbl_ItemTitle.Caption = tbs_selector(ml_tbsidx).SelectedItem.Caption & " // " & grd_List.SelectedLine(0, "Comp_desc") & " - " & IIf(ml_tbsidx = 0, grd_List.SelectedLine(0, "CT_desc"), "STRATEGIC")
    lbl_ItemTitle.Visible = True
    lbl_ItemTitle.ZOrder
    
    'Resize the frame
    Call fra_item.Move(120, 120, UserControl.Width - 120 * 2, UserControl.Height - 120 * 2)
    Call tlb_item.Move(fra_item.Width - tlb_item.Width - 120, 120 * 2, tlb_item.Width, fra_item.Height - 120 * 3)
    Call fra_record(li_FrameIndex).Move(120, 120 + lbl_ItemTitle.Height, fra_item.Width - tlb_item.Width - 120 * 3, fra_item.Height - 120 * 2 - lbl_ItemTitle.Height)
    
    'display frame item ady_index
    fra_record(li_FrameIndex).Visible = True
    fra_record(li_FrameIndex).ZOrder

    'Attachment
    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ExistAttach Then
        'disable frame list
        Call EnableFrame(UserControl.Controls, Fra_Attachments, True)
        Call HandleToolbar(tlb_Attachments, "0", mb_IsUpdater)

        tlb_Attachments.Visible = True
        Fra_Attachments.Visible = True
        Fra_Attachments.ZOrder
        Call grd_Attachments.Load("exec MKT_Attachments_lst " & ml_CurrentKey & ",'" & ms_Language_Code & "'," & mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexClassAtt, True)
    End If
    
    If ls_FrameName Like "CD_SALESORG*" Then
        'disable frame list
        Call EnableFrame(UserControl.Controls, Fra_SalesReps, True)
        Call HandleToolbar(tlb_SalesReps, "0", mb_IsUpdater)
        tlb_SalesReps.Visible = True
        Fra_SalesReps.left = Fra_Attachments.left - 120
        Fra_SalesReps.Visible = True
        Fra_SalesReps.ZOrder
        Call grd_SalesOrg_SalesReps.Load("exec MKT_SO_People_lst " & mo_Db.GetFields(ml_Cursor, "MKT_SO_Key"), True)
    End If
    
    fra_item.Visible = True
    fra_item.ZOrder
    mb_internalFin = False
    If ls_FrameName Like "CD_FINANCIAL_C" Then
        Call ConvertToEuro(txt_Financial_Profit_Loss, cbo_Financial_Fin_PL_Currency, cbo_Financial_Year, txt_Financial_Profit_Loss_Euro, 211, 214, txt_Financial_Profit_Loss, False)
        Call ConvertToEuro(txt_Financial_TurnOver, cbo_Financial_Fin_Currency, cbo_Financial_Year, txt_Financial_Turnover_Euro, 210, 213, txt_Financial_TurnOver, False)
    End If
    
    Exit Sub
errHandler:
    mb_internalFin = False
    SetMode (me_OldMode)
    Call ErrorHandler("Item_UpdateInit")
    
End Sub

Private Sub Item_ViewInit(ByVal al_InfoArrayIndex As Long, ByVal ao_grid As ArmGrid)
On Error GoTo errHandler
    
    mb_internalFin = True
   
    ml_MasterKey = grd_List.SelectedLine(0, "MKT_Key")
    If ao_grid.Visible Then ml_CurrentKey = ao_grid.SelectedLine(0, "Key")
    
    Dim li_FrameIndex As Integer
    Dim ls_FrameName As String
    
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    ls_FrameName = UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame)
    
    'change screen mode
    If me_Mode = emDetail Then Call SetMode(emView)
    
    'clear the frame record and disable frames
    Call ClearForm(UserControl.Controls, fra_record(li_FrameIndex))
    
    Call EnableFrame(UserControl.Controls, fra_record(li_FrameIndex), False)
        
    Call InitializedFraRecord(al_InfoArrayIndex)
    
    'load data
    Call OpenCursor(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.RequestView)
    
    If mo_Db.RowCount(ml_Cursor) = 0 Then
        Err.Raise C_ERRORRAISE + 2138, "Item_ViewInit", "#The record you try to open has been deleted by an other user. Please refresh the grid."
    End If
        
    
    Call LoadDataToForm(ml_Cursor, UserControl.Controls, fra_record(li_FrameIndex))
       
    txt_key(li_FrameIndex).Text = ml_CurrentKey
    
    'change face toolbar
    Call HandleToolbar(tlb_item, "2", mb_IsUpdater)
    
    If ls_FrameName Like "CD_SALESEST_S" Or ls_FrameName Like "CD_SALESORG_S" Or ls_FrameName Like "CD_PRODUCTS_S" Then
        lbl_ItemTitle.Caption = lbl_DetailTitle.Caption & IIf(grd_detail1.Columns("CT_desc").ColumnIndex <> 0 And ml_tbsidx = 1, " // Country record from " & grd_detail1.SelectedLine(0, "CT_desc"), "")
    ElseIf ls_FrameName Like "CD_FINANCIAL_S" And grd_detail2.SelectedCount > 0 Then
        lbl_ItemTitle.Caption = lbl_DetailTitle.Caption & IIf(grd_detail2.Columns("CT_desc").ColumnIndex <> 0 And ml_tbsidx = 1, " // Country record from " & grd_detail2.SelectedLine(0, "CT_desc"), "")
    Else
        lbl_ItemTitle.Caption = lbl_DetailTitle.Caption
    End If
    lbl_ItemTitle.Visible = True
    lbl_ItemTitle.ZOrder
    
    'Resize the frame
    Call fra_item.Move(fra_list.left, fra_list.top, fra_list.Width, fra_list.Height)
    Call tlb_item.Move(fra_item.Width - tlb_item.Width - 120, 120 * 2, tlb_item.Width, fra_item.Height - 120 * 3)
    Call fra_record(li_FrameIndex).Move(120, 120 + lbl_ItemTitle.Height, fra_item.Width - tlb_item.Width - 120 * 3, fra_item.Height - lbl_DetailTitle.Height - 120 * 2)
    
    'display frame item ady_index
    fra_record(li_FrameIndex).Visible = True
    fra_record(li_FrameIndex).ZOrder

    'Attachment
    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ExistAttach Then
        'disable frame list
        Call EnableFrame(UserControl.Controls, Fra_Attachments, False)
        Call HandleToolbar(tlb_Attachments, "0", mb_IsUpdater)
        tlb_Attachments.Visible = True
        Fra_Attachments.Visible = True
        Fra_Attachments.ZOrder
        Call grd_Attachments.Load("exec MKT_Attachments_lst " & ml_CurrentKey & ",'" & ms_Language_Code & "'," & mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexClassAtt, True)
    End If
    
    If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_SALESORG_*" Then
        'disable frame list
        Call EnableFrame(UserControl.Controls, Fra_SalesReps, False)
        Call HandleToolbar(tlb_SalesReps, "0", mb_IsUpdater)
        tlb_SalesReps.Visible = True
        Fra_SalesReps.left = Fra_Attachments.left - 120
        Fra_SalesReps.Visible = True
        Fra_SalesReps.ZOrder
        Call grd_SalesOrg_SalesReps.Load("exec MKT_SO_People_lst " & mo_Db.GetFields(ml_Cursor, "MKT_SO_Key"), True)
    End If
    
    fra_item.Visible = True
    fra_item.ZOrder
    mb_internalFin = False
    Exit Sub
    
errHandler:
    mb_internalFin = False
    Call ErrorHandler("Item_ViewInit")
   
End Sub
Private Function Item_Copy_SubItems(ByVal al_InfoArrayIndex As Long) As Boolean


Dim ll_Count As Long
Dim lb_TranOpenned As Boolean
Dim ls_req_dup As String

Const REQ_ATT_FILE As String = "exec MKT_AttachmentsFile_Dup $ID_Blob$, $ID_Blob_To_Dup$"
Const REQ_ATT_INFO As String = "exec MKT_Attachments_Dup $ATT_Key$," & _
                                                    "$ATT_Key_To_Dup$," & _
                                                    "$ID_Blob$," & _
                                                    "$Z_Creator_User$," & _
                                                    "$MKT_BM_Key$," & _
                                                    "$MKT_COM_Key$," & _
                                                    "$MKT_LOC_Key$," & _
                                                    "$MKT_GP_Key$," & _
                                                    "$MKT_SO_Key$," & _
                                                    "$MKT_SERV_KEY$," & _
                                                    "$MKT_Fin_Key$"


Const REQ_SALESREPS As String = "exec MKT_SO_People_Dup $MKT_SO_Key$," & _
                                                    "$MKT_SOPeople_key$," & _
                                                    "$MKT_SOPeople_key_To_Dup$," & _
                                                    "$Z_Creator_User$"

Const REQ_PRODUCTS As String = "exec MKT_Channel_PE_Dup  $MKT_CHNL_PE_KEY$," & _
                                                    "$MKT_CHNL_PE_KEY_To_Dup$," & _
                                                    "$MKT_CHNL_Key$," & _
                                                    "$Z_Creator_User$"

On Error GoTo errHandler

    Dim ll_IndexFrame As Long
    
    ll_IndexFrame = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    
    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ExistAttach Then
        Dim ll_NbAtt As Long
        ll_NbAtt = grd_Attachments.Rows
        
        If ll_NbAtt <> 0 Then
            For ll_Count = 0 To ll_NbAtt - 1
                'get the new id for the blob ->
                Dim ll_NewBlob As Long
                ll_NewBlob = mo_Db.SQLNextID("MKT_AttachmentsFile")
                
                'get the new id for the attachment info
                Dim ll_NewAttInfo As Long
                ll_NewAttInfo = mo_Db.SQLNextID("MKT_Attachments")
                
                
                Dim ll_ATT_KeyToDup As Long
                ll_ATT_KeyToDup = grd_Attachments.Data(ll_Count, 0)
                
                Dim ll_ID_BlobToDup As Long
                ll_ID_BlobToDup = grd_Attachments.Data(ll_Count, 1)
                                
                ls_req_dup = REQ_ATT_FILE
                 
                ls_req_dup = Replace(ls_req_dup, "$ID_Blob$", ll_NewBlob, , , vbTextCompare)
                ls_req_dup = Replace(ls_req_dup, "$ID_Blob_To_Dup$", ll_ID_BlobToDup, , , vbTextCompare)
                 
                'duplicate the blob
                ExecuteSQLSafe mo_Db, ls_req_dup
                
                ls_req_dup = REQ_ATT_INFO
                ls_req_dup = Replace(ls_req_dup, "$ATT_Key$", ll_NewAttInfo, , , vbTextCompare)
                ls_req_dup = Replace(ls_req_dup, "$ATT_Key_To_Dup$", ll_ATT_KeyToDup, , , vbTextCompare)
                ls_req_dup = Replace(ls_req_dup, "$ID_Blob$", ll_NewBlob, , , vbTextCompare)
                ls_req_dup = Replace(ls_req_dup, "$Z_Creator_User$", ml_UCode, , , vbTextCompare)
    
                ls_req_dup = ReplaceHolders(UserControl.Controls, fra_record(ll_IndexFrame), ls_req_dup)
    
                ls_req_dup = Replace(ls_req_dup, "$MKT_BM_Key$", "NULL", , , vbTextCompare)
                ls_req_dup = Replace(ls_req_dup, "$MKT_COM_Key$", "NULL", , , vbTextCompare)
                ls_req_dup = Replace(ls_req_dup, "$MKT_LOC_Key$", "NULL", , , vbTextCompare)
                ls_req_dup = Replace(ls_req_dup, "$MKT_GP_Key$", "NULL", , , vbTextCompare)
                ls_req_dup = Replace(ls_req_dup, "$MKT_SO_Key$", "NULL", , , vbTextCompare)
                ls_req_dup = Replace(ls_req_dup, "$MKT_SERV_KEY$", "NULL", , , vbTextCompare)
                ls_req_dup = Replace(ls_req_dup, "$MKT_Fin_Key$", "NULL", , , vbTextCompare)
                                                    
                'duplicate the attachement info -> exec MKT_Attachments_Dup $ATT_Key$, $ATT_Key_To_Dup$, $ID_Blob$, $Z_Creator_User$
                ExecuteSQLSafe mo_Db, ls_req_dup

                'Call CommitTran("Item_CopyBlob")
                'lb_TranOpenned = False
            Next ll_Count

'            If ll_Count <> 0 Then
'                If grd_detail1.SelectedCount <> 0 Then
'                    grd_detail1.SelectedLine(0, "Attachment") = "X"
'                Else
'                    grd_detail2.SelectedLine(0, "Attachment") = "X"
'                End If
'            End If

            
        End If
    End If
    
    Dim ll_NbSalesReps As Long
    
    ll_NbSalesReps = grd_SalesOrg_SalesReps.Rows
    If grd_SalesOrg_SalesReps.Visible And ll_NbSalesReps <> 0 Then
        'loop on grid sales reps
        'get the new id for the SalesReps -> mo_Db.SQLNextID("SalesReps")
        'duplicate the SalesReps info -> exec MKT_SO_People_Dup $MKT_SO_Key$, $MKT_SOPeople_key$,$MKT_SOPeople_key_To_Dup$, $Z_Creator_User$
        For ll_Count = 0 To ll_NbSalesReps - 1
            'get the new id for the attachment info
                        
            Dim ll_NewSalesReps As Long
            ll_NewSalesReps = mo_Db.SQLNextID("MKT_SO_People")
                            
            Dim ll_MKT_SOPeople_KeyToDup As Long
            ll_MKT_SOPeople_KeyToDup = grd_SalesOrg_SalesReps.Data(ll_Count, 0)
            
             
            ls_req_dup = REQ_SALESREPS
            ls_req_dup = Replace(ls_req_dup, "$MKT_SOPeople_key$", ll_NewSalesReps, , , vbTextCompare)
            ls_req_dup = Replace(ls_req_dup, "$MKT_SOPeople_key_To_Dup$", ll_MKT_SOPeople_KeyToDup, , , vbTextCompare)
            ls_req_dup = Replace(ls_req_dup, "$Z_Creator_User$", ml_UCode, , , vbTextCompare)

            ls_req_dup = ReplaceHolders(UserControl.Controls, fra_record(ll_IndexFrame), ls_req_dup)
            
            'Call BeginTran("Item_CopySalesRep")
            'lb_TranOpenned = True
            
            'duplicate the blob
            ExecuteSQLSafe mo_Db, ls_req_dup
            
            'Call CommitTran("Item_CopySalesRep")
            'lb_TranOpenned = False
        Next ll_Count
        
'        If ll_Count <> 0 Then
'            If grd_detail1.SelectedCount <> 0 Then
'                grd_detail1.SelectedLine(0, "Rep Detail") = "X"
'            End If
'        End If
        
    End If
    
    Dim ll_NbProd As Long
    ll_NbProd = grd_Products.Rows
    
    If grd_Products.Visible And ll_NbProd <> 0 Then
        For ll_Count = 0 To ll_NbProd - 1
            'get the new id for the attachment info
                        
            Dim ll_NewProd As Long
            ll_NewProd = mo_Db.SQLNextID("MKT_Channel_PE")
                            
            Dim ll_Prod_KeyToDup As Long
            ll_Prod_KeyToDup = grd_Products.Data(ll_Count, 0)
            
            ls_req_dup = REQ_PRODUCTS
             
            ls_req_dup = Replace(ls_req_dup, "$MKT_CHNL_PE_KEY$", ll_NewProd, , , vbTextCompare)
            ls_req_dup = Replace(ls_req_dup, "$MKT_CHNL_PE_KEY_To_Dup$", ll_Prod_KeyToDup, , , vbTextCompare)
            ls_req_dup = Replace(ls_req_dup, "$Z_Creator_User$", ml_UCode, , , vbTextCompare)

            ls_req_dup = ReplaceHolders(UserControl.Controls, fra_record(ll_IndexFrame), ls_req_dup)
            
            'Call BeginTran("Item_CopyProd")
            'lb_TranOpenned = True
            
            'duplicate the prod
            
             ExecuteSQLSafe mo_Db, ls_req_dup
            

            'Call CommitTran("Item_CopyProd")
            'lb_TranOpenned = False
        Next ll_Count
    End If
    
    
    Item_Copy_SubItems = True
    Exit Function

errHandler:
    Call ErrorHandler("Item_Copy_SubItems")
    
End Function

Private Sub Item_Copy(ByVal al_InfoArrayIndex As Long)


On Error GoTo errHandler

    If Not Item_Add(al_InfoArrayIndex) Then Exit Sub
    
'    call Item_Copy_SubItems(al_InfoArrayIndex)
        
    Call Item_ExitToGrid(al_InfoArrayIndex)
    
    Exit Sub

errHandler:

    Call ErrorHandler("Item_Copy")
End Sub


Private Sub Item_CopyInit(ByVal al_InfoArrayIndex As Long, ByVal ao_grid As ArmGrid)

    'change screen mode
    'resize the frame
    'disable filter frame
    'disable frame list
    'enable/disable item components
    'load data in components
    'change face toolbar
    'display frame item

On Error GoTo errHandler
  
    
    mb_internalFin = True
    If grd_List.SelectedCount <= 0 Then Exit Sub
    
    If me_Mode <> emList And (ao_grid.SelectedCount <= 0 And mt_ClassInfoLst(al_InfoArrayIndex).ConfigDetail.ConfigGrid(0).Request <> "") Then Exit Sub
   
    
    ml_MasterKey = grd_List.SelectedLine(0, "MKT_Key")
    
    If me_Mode <> emList And mt_ClassInfoLst(al_InfoArrayIndex).ConfigDetail.ConfigGrid(0).Request <> "" Then
        ml_CurrentKey = ao_grid.SelectedLine(0, "Key")
    Else
        ml_CurrentKey = ml_MasterKey
    End If
    
    'Change screen mode
    Call SetMode(emCopy)
    
    me_OldMode = emDetail
    
    Dim ls_FrameName As String
    Dim li_FrameIndex As Integer
    
    ls_FrameName = UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame)
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
        
    Call EnableFrame(UserControl.Controls, fra_record(li_FrameIndex), True)
    
    Call EnableFrame(UserControl.Controls, fra_ModifInfo(li_FrameIndex), False)
    
    If ls_FrameName Like "CD_SALESORG_*" Then Call EnableFrame(UserControl.Controls, Fra_SalesReps, False)
    
    If ls_FrameName Like "CD_CHANNEL" Then Call EnableFrame(UserControl.Controls, Fra_Products, False)
    
    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ExistAttach Then Call EnableFrame(UserControl.Controls, Fra_Attachments, False)
        
    
    Call LoadDataToForm(ml_Cursor, UserControl.Controls, fra_record(li_FrameIndex))
           
    'change face toolbar
    Call HandleToolbar(tlb_item, "F", True)
        
    lbl_ItemTitle.Caption = lbl_DetailTitle.Caption
    lbl_ItemTitle.Visible = True
    lbl_ItemTitle.ZOrder
    
    txt_CreationDate(li_FrameIndex).Text = Format(Date, "dd\/mm\/yyyy")
    Txt_Creator(li_FrameIndex).Text = ms_LoginName
    txt_LastUpdDate(li_FrameIndex).Text = Format(Date, "dd\/mm\/yyyy")
    txt_UpdUser(li_FrameIndex).Text = ms_LoginName
    
    
    'Resize the frame
    Call fra_item.Move(120, 120, UserControl.Width - 120 * 2, UserControl.Height - 120 * 2)
    Call tlb_item.Move(fra_item.Width - tlb_item.Width - 120, 120 * 2, tlb_item.Width - 120, fra_item.Height - 120 * 3)
    Call fra_record(li_FrameIndex).Move(120, 120 + lbl_ItemTitle.Height, fra_item.Width - tlb_item.Width - 120 * 3, fra_item.Height - 120 * 2 - lbl_ItemTitle.Height)
    
    'display frame item ady_index
    fra_record(li_FrameIndex).Visible = True
    fra_record(li_FrameIndex).ZOrder
    
        'Attachment
    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ExistAttach Then
        'disable frame list
        Call EnableFrame(UserControl.Controls, Fra_Attachments, True)
        Call HandleToolbar(tlb_Attachments, "1", mb_IsUpdater)
        tlb_Attachments.Visible = True
        Fra_Attachments.Visible = True
        Fra_Attachments.ZOrder
    End If
    
    If ls_FrameName Like "CD_SALESORG*" Then
        'disable frame list
        Call EnableFrame(UserControl.Controls, Fra_SalesReps, True)
        Call HandleToolbar(tlb_SalesReps, "1", mb_IsUpdater)
    End If

    If ls_FrameName Like "CD_CHANNEL" Then
        Call EnableFrame(UserControl.Controls, grd_Products, True)
        Call HandleToolbar(tlb_Products, "2", mb_IsUpdater)
    End If
    fra_item.Visible = True
    fra_item.ZOrder
    
    mb_internalFin = False

    If ls_FrameName Like "CD_FINANCIAL_C" Then
        Call ConvertToEuro(txt_Financial_Profit_Loss, cbo_Financial_Fin_PL_Currency, cbo_Financial_Year, txt_Financial_Profit_Loss_Euro, 211, 214, txt_Financial_Profit_Loss, False)
        Call ConvertToEuro(txt_Financial_TurnOver, cbo_Financial_Fin_Currency, cbo_Financial_Year, txt_Financial_Turnover_Euro, 210, 213, txt_Financial_TurnOver, False)
    End If

    
    Exit Sub
errHandler:
    mb_internalFin = False
    SetMode (me_OldMode)
    Call ErrorHandler("Item_CopyInit")

End Sub

Private Sub Item_Update(ByVal al_InfoArrayIndex As Long, ByVal ao_grid As ArmGrid)
On Error GoTo errHandler
    Dim li_FrameIndex As Integer
    
    'check the data validity -> Item_Check
    If Not Item_CheckMandatory(al_InfoArrayIndex) Then Exit Sub
    
    If Not Item_Check(al_InfoArrayIndex) Then Exit Sub
    
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    
    'update data on the db ->
    If Not Item_UpdateDB(al_InfoArrayIndex) Then Exit Sub
    'if success then Add the data locally ->
    If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.TableName) Like "MKT_MASTER" Then
        If IsItemFiltered Then
'            MsgBox MsgText(202, ms_Language_Code, "#The item you have added/updated couldn't be displayed with the current criteria set."), vbInformation + vbOKOnly
'            GoTo BackToGrid
            Err.Raise C_ERRORRAISE + 202, "Item_Update", "#The item you have added/updated couldn't be displayed with the current criteria set."
        End If
        If Not Item_UpdateLocal(UserControl.Controls, fra_record(li_FrameIndex), grd_List) Then Exit Sub
        If me_OldMode = emDetail Then txt_DetailGeneral_comment.Text = txt_General_comment.Text
    Else
        If Not Item_UpdateLocal(UserControl.Controls, fra_record(li_FrameIndex), ao_grid) Then Exit Sub
    End If
    
BackToGrid:
    'go back to the detail screen
    Call Item_ExitToGrid(al_InfoArrayIndex)
    
    Exit Sub
errHandler:
    Call ErrorHandler("Item_Update")
   
End Sub

Private Function Item_UpdateDB(ByVal al_InfoArrayIndex As Long) As Boolean

On Error GoTo errHandler

    Const DB_MASTER_MAINTENANCE_UPD As String = "exec MKT_Master_Maintenance_Upd $MKT_Key$, $Z_last_upd_user$"
    
    Dim ls_UPD_Request As String
    Dim lb_TranOpened As Boolean
    
Item_UpdateDB = False
    
'get the request from the ClassInfo
    ls_UPD_Request = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.RequestUpd
    
'replace the holders (from the frame record)
    ls_UPD_Request = ReplaceHolders(UserControl.Controls, fra_record(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), ls_UPD_Request)
    
    If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_CHANNEL_PE" Or UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_SALESREPS" Or UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_ATTACHMENTS" Then
        ls_UPD_Request = Replace(ls_UPD_Request, "$iConcurrency$", mo_Db.GetFields(ml_Cursor_SubItem, "iConcurrency"), , , vbTextCompare)
    Else
        ls_UPD_Request = Replace(ls_UPD_Request, "$iConcurrency$", mo_Db.GetFields(ml_Cursor, "iConcurrency"), , , vbTextCompare)
    End If

'START Check unicity ************
    Dim ls_check_request As String
    Dim ll_Curs As Long
    Dim li_Count As Integer
    Dim ll_Key As Long
    
    ls_check_request = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.RequestCheck
    If ls_check_request <> "" Then
        If grd_detail2.SelectedCount > 0 Then ls_check_request = Replace(ls_check_request, "$MKT_Key$", grd_detail2.SelectedLine(0, "MKT_Key"), , , vbTextCompare)
        ls_check_request = ReplaceHolders(UserControl.Controls, fra_record(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), ls_check_request)
        If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_CHANNEL_PE" Then
            ls_check_request = Replace(ls_check_request, "$CHNL_Year$", mo_Db.GetFields(ml_Cursor, "CHNL_Year"), , , vbTextCompare)
            ls_check_request = Replace(ls_check_request, "$MKT_CHNL_Key$", mo_Db.GetFields(ml_Cursor, "MKT_CHNL_Key"))
        End If
        ll_Curs = OpenSQLSafe(mo_Db, ls_check_request)
        
        li_Count = mo_Db.RowCount(ll_Curs)
        If li_Count > 0 Then ll_Key = mo_Db.GetFields(ll_Curs, "Key")
        mo_Db.Close (ll_Curs)
        
        If li_Count > 0 And ll_Key <> CLng(txt_key(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame).Text) Then
            MsgBox MsgText(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.CheckMsg(0, 0), ms_Language_Code, mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.CheckMsg(0, 1)), vbInformation + vbOKOnly
            Exit Function
        End If
    End If
'END Check unicity ************



'open the transaction
     lb_TranOpened = BeginTran("UpdCompDB")

    ExecuteSQLSafe mo_Db, ls_UPD_Request, 1
    

    If Not UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.TableName) Like "MKT_MASTER" Then
        'if not add of a master then update the master (date + user)
        Dim ls_MasterMaintRequest As String
        If grd_detail2.Visible And grd_detail2.SelectedCount <> 0 Then
            ls_MasterMaintRequest = Replace(DB_MASTER_MAINTENANCE_UPD, "$MKT_Key$", grd_detail2.SelectedLine(0, 1), , , vbTextCompare)
        Else
            ls_MasterMaintRequest = Replace(DB_MASTER_MAINTENANCE_UPD, "$MKT_Key$", ml_MasterKey, , , vbTextCompare)
        End If
        
        ls_MasterMaintRequest = Replace(ls_MasterMaintRequest, "$Z_last_upd_user$", ml_UCode, , , vbTextCompare)
        
        ExecuteSQLSafe mo_Db, ls_MasterMaintRequest, 1
        
        If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_CHANNEL_PE" Or UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_SALESREPS" Or UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_ATTACHMENTS" Then
            Dim ls_MaintRequest As String
            Dim li_Key As Integer
            Select Case UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame)
                Case "CD_CHANNEL_PE"
                    ls_MaintRequest = "exec MKT_Channel_Maintenance_Upd $Key$, $Z_last_upd_user$"
                    li_Key = mo_Db.GetFields(ml_Cursor, "MKT_CHNL_Key")
                Case "CD_SALESREPS"
                    ls_MaintRequest = "exec MKT_Sales_Organisation_Maintenance_Upd $Key$, $Z_last_upd_user$"
                    li_Key = mo_Db.GetFields(ml_Cursor, "MKT_SO_Key")
                Case "CD_ATTACHMENTS"
                
                     Select Case UCase(tbs_selector(ml_tbsidx).SelectedItem.Tag)
                        Case "CD_BUSINESSMODEL"
                            ls_MaintRequest = "exec MKT_BusMod_Maintenance_Upd $Key$, $Z_last_upd_user$"
                            li_Key = mo_Db.GetFields(ml_Cursor, "MKT_BM_Key")
                        Case "CD_COMMUNICATION"
                            ls_MaintRequest = "exec MKT_Communication_Maintenance_Upd $Key$, $Z_last_upd_user$"
                            li_Key = mo_Db.GetFields(ml_Cursor, "MKT_COM_Key")
                        Case "CD_LOCATION"
                            ls_MaintRequest = "exec MKT_Location_Maintenance_Upd $Key$, $Z_last_upd_user$"
                            li_Key = mo_Db.GetFields(ml_Cursor, "MKT_LOC_Key")
                        Case "CD_PRODUCTS_C", "CD_PRODUCTS_S"
                            ls_MaintRequest = "exec MKT_GenProd_Maintenance_Upd $Key$, $Z_last_upd_user$"
                            li_Key = mo_Db.GetFields(ml_Cursor, "MKT_GP_Key")
                        Case "CD_SALESORG_C", "CD_SALESORG_S"
                            ls_MaintRequest = "exec MKT_Sales_Organisation_Maintenance_Upd $Key$, $Z_last_upd_user$"
                            li_Key = mo_Db.GetFields(ml_Cursor, "MKT_SO_Key")
                        Case "CD_SERVICES"
                            ls_MaintRequest = "exec MKT_Services_Maintenance_Upd $Key$, $Z_last_upd_user$"
                            li_Key = mo_Db.GetFields(ml_Cursor, "MKT_SERV_Key")
                        Case "CD_FINANCIAL_C", "CD_FINANCIAL_S"
                            ls_MaintRequest = "exec MKT_Financial_Maintenance_Upd $Key$, $Z_last_upd_user$"
                            li_Key = mo_Db.GetFields(ml_Cursor, "MKT_FIN_Key")
                     End Select
            End Select
            ls_MaintRequest = Replace(ls_MaintRequest, "$Key$", li_Key, , , vbTextCompare)
            ls_MaintRequest = Replace(ls_MaintRequest, "$Z_last_upd_user$", ml_UCode, , , vbTextCompare)
            ExecuteSQLSafe mo_Db, ls_MaintRequest, 1
        End If
        
    End If

'close the transaction
    lb_TranOpened = Not CommitTran("UpdCompDB")
    Item_UpdateDB = True
    
    Exit Function
    
errHandler:
    Item_UpdateDB = False
    If lb_TranOpened Then
        Call RollbackTran("UpdCompDB")
    End If
    Call ErrorHandler("Item_UpdateDB")
    
End Function

Private Function Item_UpdateLocal(ByRef aControls As Variant, ByRef aContainer As Object, ByRef ao_grid As ArmGrid) As Boolean
On Error GoTo errHandler
    'change the data locally
    
    'If ao_Grid.SearchKey(True, Array(ml_CurrentKey)) Then
    Dim ll_Idx As Long
    Dim lIdx As Long, lCount As Long
    Dim lControl As Control
    Dim lValues As Variant
    Dim ll_nbcol As Long
    ll_nbcol = ao_grid.Cols - 1
    
    ReDim ls_ColInfo(ll_nbcol)
    
    For ll_Idx = 0 To ll_nbcol
    
        lCount = aControls.Count - 1
    
        For lIdx = 0 To lCount
            Set lControl = aControls.Item(lIdx)
            If HasContainer(lControl, aContainer) Then
                Select Case UCase(TypeName(lControl))
                    Case "TEXTBOX"
                        'handle numeric
                        lValues = Split(lControl.Tag, SEP)
                        If UBound(lValues) > 0 Then
                            If UCase(Replace(lValues(0), "_code", "_desc", , , vbTextCompare)) Like UCase(ao_grid.Columns(ll_Idx).Name) Then ao_grid.SelectedLine(0, ll_Idx) = Trim(lControl.Text)
                        End If
                        
                    Case "ARMCOMBOBOX"
                        'TODO : If not mandatory
                        If UCase(Replace(lControl.Tag, "_code", "_desc", , , vbTextCompare)) Like UCase(ao_grid.Columns(ll_Idx).Name) Then
                            If Not lControl.SelectedItem Is Nothing Then
                                ao_grid.SelectedLine(0, ll_Idx) = lControl.SelectedItem.GetData(1)
                            Else
                                ao_grid.SelectedLine(0, ll_Idx) = ""
                            End If
                            
                            Select Case UCase(lControl.Name)
                                Case "CBO_SALESEST_MATERIAL", "CBO_CHANNEL_PE_BM"
                                    If Not IsEmpty(lControl.SelectedItem.GetData(3)) Then ao_grid.SelectedLine(0, "SBM_desc") = lControl.SelectedItem.GetData(3)
                            End Select
                        End If
                        
                    Case "OPTIONBUTTON" ', "ARMTREEVIEW", "LISTBOX", "PICTUREBOX", "A_CALOCX"
                        lValues = Split(lControl.Tag, SEP)
                        If UCase(lValues(0)) Like UCase(ao_grid.Columns(ll_Idx).Name) And lControl.value = True Then
                            ao_grid.SelectedLine(0, ll_Idx) = lValues(2)
                        End If
                    
                    Case "CHECKBOX"
                        If UCase(lControl.Tag) Like UCase(ao_grid.Columns(ll_Idx).Name) Then
                            If lControl.value = True Then
                                ao_grid.SelectedLine(0, ll_Idx) = "X"
                            End If
                        End If
                    
                    Case "ARMGRID"
                        If UCase(lControl.Tag) Like UCase(ao_grid.Columns(ll_Idx).Name) Then
                            If lControl.Rows > 0 Then
                                ao_grid.SelectedLine(0, ll_Idx) = "X"
                            Else
                                ao_grid.SelectedLine(0, ll_Idx) = ""
                            End If
                        End If
                    Case "LABEL", "FRAME", "TOOLBARCONTROL", "ARMGRID", "DRIVELISTBOX", "DIRLISTBOX", "FILELISTBOX"
                        'do nothing
                    Case Else
                        Debug.Print "Item_UpdateLocal -> " & UCase(TypeName(lControl))
                End Select
            End If
            Set lControl = Nothing
        Next
    Next ll_Idx
    'End If
    
    If UCase(aContainer.Tag) Like "CD_SWOT" Then
        ao_grid.SelectedLine(0, ao_grid.Columns("Z_Last_upd").ColumnIndex) = Format(Date, "DD/MM/YYYY")
    End If
    
    Item_UpdateLocal = True
    Exit Function
errHandler:
    If Not lControl Is Nothing Then Set lControl = Nothing
    Call ErrorHandler("Item_UpdateLocal")
   
End Function



Private Sub Item_DeleteInit(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler


    If grd_List.SelectedCount <= 0 Then Exit Sub
    If grd_detail1.Visible And grd_detail1.SelectedCount <= 0 And me_Mode <> emList Then Exit Sub
        
        
    
        
    Dim ls_FrameName As String
    ls_FrameName = UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame)
    
    ml_MasterKey = grd_List.SelectedLine(0, "MKT_Key")
    If grd_detail1.Visible And me_Mode <> emList Then
            ml_CurrentKey = grd_detail1.SelectedLine(0, "Key")
    Else
        ml_CurrentKey = grd_List.SelectedLine(0, "MKT_Key")
    End If
    
    If Not Item_CheckDelete(al_InfoArrayIndex) Then Exit Sub
    
    mb_internalFin = True
    
    If ls_FrameName Like "CD_SALESEST_S" Or ls_FrameName Like "CD_SALESORG_S" Or ls_FrameName Like "CD_PRODUCTS_S" Then
        lbl_ItemTitle.Caption = lbl_DetailTitle.Caption & IIf(grd_detail1.Columns("CT_desc").ColumnIndex <> 0 And ml_tbsidx = 1, " // Country record from " & grd_detail1.SelectedLine(0, "CT_desc"), "")
    Else
        lbl_ItemTitle.Caption = lbl_DetailTitle.Caption
    End If
    lbl_ItemTitle.Visible = True
    lbl_ItemTitle.ZOrder
       
    'change screen mode
    Call SetMode(emDelete)
    
    Dim li_FrameIndex As Integer
    
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    
    
    'clear the frame record and disable frames
    Call ClearForm(UserControl.Controls, fra_record(li_FrameIndex))
    
    Call EnableFrame(UserControl.Controls, fra_filter, False)
    
    Call EnableFrame(UserControl.Controls, fra_record(li_FrameIndex), False)
            
    Call InitializedFraRecord(al_InfoArrayIndex)
    
    'load data
    Call OpenCursor(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.RequestView)
    
    If mo_Db.RowCount(ml_Cursor) = 0 Then
        Err.Raise C_ERRORRAISE + 2138, "Item_DeleteInit", "#The record you try to open has been deleted by an other user. Please refresh the grid."
    End If
    
    Call LoadDataToForm(ml_Cursor, UserControl.Controls, fra_record(li_FrameIndex))
    
    txt_key(li_FrameIndex).Text = ml_CurrentKey
    
    'change face toolbar
    Call HandleToolbar(tlb_item, "4", mb_IsUpdater)

    
    'Resize the frame
    Call fra_item.Move(fra_list.left, fra_list.top, fra_list.Width, fra_list.Height)
    Call tlb_item.Move(fra_item.Width - tlb_item.Width - 120, 120 * 2, tlb_item.Width, fra_item.Height - 120 * 3)
    Call fra_record(li_FrameIndex).Move(120, 120 + lbl_ItemTitle.Height, fra_item.Width - tlb_item.Width - 120 * 3, fra_item.Height - lbl_DetailTitle.Height - 120 * 2)
    
    'display frame item ady_index
    fra_record(li_FrameIndex).Visible = True
    fra_record(li_FrameIndex).ZOrder

    'Attachment
    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ExistAttach Then
        'disable frame list
        Call EnableFrame(UserControl.Controls, Fra_Attachments, True)
        tlb_Attachments.Visible = False
        Fra_Attachments.Visible = True
        Fra_Attachments.ZOrder
        grd_Attachments.ClearGrid
    End If
    
    'MKT_SO_People
    If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_SALESORG*" Then
        'disable frame list
        Call EnableFrame(UserControl.Controls, Fra_SalesReps, True)
        tlb_SalesReps.Visible = False
        Fra_SalesReps.left = Fra_Attachments.left - 120
        Fra_SalesReps.Visible = True
        Fra_SalesReps.ZOrder
        grd_SalesOrg_SalesReps.ClearGrid
    End If
    
    If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_CHANNEL" Then
        tlb_Products.Visible = False
        grd_Products.ClearGrid
    End If
    
    
    fra_item.Visible = True
    fra_item.ZOrder
    mb_internalFin = False
    Exit Sub
errHandler:
    mb_internalFin = False
    SetMode (me_OldMode)
    Call ErrorHandler("Item_DeleteInit")
   
End Sub

Private Sub Item_Delete(ByVal al_InfoArrayIndex As Long)

On Error GoTo errHandler

'    Dim lv_MsgReplaceInfo(0, 1) As String
    
    'ask confirmation for delete
'    lv_MsgReplaceInfo(0, 0) = "$TabSelectorCaption$"
'    lv_MsgReplaceInfo(0, 1) = tbs_selector(ml_tbsidx).SelectedItem.Caption
'
'    If MsgBox(MsgText(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.DeleteMsg(0, 0), ms_Language_Code, mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.DeleteMsg(0, 1), lv_MsgReplaceInfo), vbExclamation + vbDefaultButton2 + vbYesNo) <> vbYes Then Exit Sub
    
    'delete data on the db
    If Not Item_DeleteDB(al_InfoArrayIndex) Then Exit Sub
    
    'if success then Add the data locally ->
    If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.TableName) Like "MKT_MASTER" Then
        If Not Item_DeleteLocal(grd_List, ml_MasterKey, True) Then Exit Sub
        me_OldMode = emList
    Else
        If Not Item_DeleteLocal(grd_detail1, ml_CurrentKey, False) Then Exit Sub
        me_OldMode = emDetail
    End If
    
    'go back to the detail screen
    Call Item_ExitToGrid(al_InfoArrayIndex)
    

    Exit Sub
errHandler:
    Call ErrorHandler("Item_Delete")
   
End Sub

Private Function Item_DeleteDB(al_InfoArrayIndex) As Boolean

On Error GoTo errHandler

    Const DB_MASTER_MAINTENANCE_UPD As String = "exec MKT_Master_Maintenance_Upd $MKT_Key$, $Z_last_upd_user$"
    
    Dim ls_DEL_Request As String
    Dim lb_TranOpened As Boolean
    
'get the request from the ClassInfo
    ls_DEL_Request = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.RequestDel
    
'replace the holders (from the frame record)
    ls_DEL_Request = ReplaceHolders(UserControl.Controls, fra_record(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), ls_DEL_Request)
    If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_CHANNEL_PE" Or UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_SALESREPS" Or UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_ATTACHMENTS" Then
        ls_DEL_Request = Replace(ls_DEL_Request, "$iConcurrency$", mo_Db.GetFields(ml_Cursor_SubItem, "iConcurrency"), , , vbTextCompare)
    Else
        ls_DEL_Request = Replace(ls_DEL_Request, "$iConcurrency$", mo_Db.GetFields(ml_Cursor, "iConcurrency"), , , vbTextCompare)
    End If

'open the transaction
    If Not BeginTran("DelCompDB") Then
        Err.Raise C_ERRORRAISE + 3, SCREEN_NAME, "Transaction Failure." & vbCrLf & "Enable to Start the transaction." & vbCrLf & Join(mo_Db.SQLErrorMessages, vbCrLf)
    End If
    lb_TranOpened = True
    
   
    ExecuteSQLSafe mo_Db, ls_DEL_Request, 1
    
    If Not UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.TableName) Like "MKT_MASTER" Then
        'if not add of a master then update the master (date + user)
        Dim ls_MasterMaintRequest As String
        
        If grd_detail2.Visible And grd_detail2.SelectedCount <> 0 Then
            ls_MasterMaintRequest = Replace(DB_MASTER_MAINTENANCE_UPD, "$MKT_Key$", grd_detail2.SelectedLine(0, 1), , , vbTextCompare)
        Else
        ls_MasterMaintRequest = Replace(DB_MASTER_MAINTENANCE_UPD, "$MKT_Key$", ml_MasterKey, , , vbTextCompare)
        End If
        
        ls_MasterMaintRequest = Replace(ls_MasterMaintRequest, "$Z_last_upd_user$", ml_UCode, , , vbTextCompare)
        ExecuteSQLSafe mo_Db, ls_MasterMaintRequest, 1
    
        If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_CHANNEL_PE" Or UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_SALESREPS" Or UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_ATTACHMENTS" Then
            Dim ls_MaintRequest As String
            Dim li_Key As Integer
            Select Case UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame)
                Case "CD_CHANNEL_PE"
                    ls_MaintRequest = "exec MKT_Channel_Maintenance_Upd $Key$, $Z_last_upd_user$"
                    li_Key = mo_Db.GetFields(ml_Cursor, "MKT_CHNL_Key")
                Case "CD_SALESREPS"
                    ls_MaintRequest = "exec MKT_Sales_Organisation_Maintenance_Upd $Key$, $Z_last_upd_user$"
                    li_Key = mo_Db.GetFields(ml_Cursor, "MKT_SO_Key")
                Case "CD_ATTACHMENTS"
                
                     Select Case UCase(tbs_selector(ml_tbsidx).SelectedItem.Tag)
                        Case "CD_BUSINESSMODEL"
                            ls_MaintRequest = "exec MKT_BusMod_Maintenance_Upd $Key$, $Z_last_upd_user$"
                            li_Key = mo_Db.GetFields(ml_Cursor, "MKT_BM_Key")
                        Case "CD_COMMUNICATION"
                            ls_MaintRequest = "exec MKT_Communication_Maintenance_Upd $Key$, $Z_last_upd_user$"
                            li_Key = mo_Db.GetFields(ml_Cursor, "MKT_COM_Key")
                        Case "CD_LOCATION"
                            ls_MaintRequest = "exec MKT_Location_Maintenance_Upd $Key$, $Z_last_upd_user$"
                            li_Key = mo_Db.GetFields(ml_Cursor, "MKT_LOC_Key")
                        Case "CD_PRODUCTS_C", "CD_PRODUCTS_S"
                            ls_MaintRequest = "exec MKT_GenProd_Maintenance_Upd $Key$, $Z_last_upd_user$"
                            li_Key = mo_Db.GetFields(ml_Cursor, "MKT_GP_Key")
                        Case "CD_SALESORG_C", "CD_SALESORG_S"
                            ls_MaintRequest = "exec MKT_Sales_Organisation_Maintenance_Upd $Key$, $Z_last_upd_user$"
                            li_Key = mo_Db.GetFields(ml_Cursor, "MKT_SO_Key")
                        Case "CD_SERVICES"
                            ls_MaintRequest = "exec MKT_Services_Maintenance_Upd $Key$, $Z_last_upd_user$"
                            li_Key = mo_Db.GetFields(ml_Cursor, "MKT_SERV_Key")
                        Case "CD_FINANCIAL_C", "CD_FINANCIAL_S"
                            ls_MaintRequest = "exec MKT_Financial_Maintenance_Upd $Key$, $Z_last_upd_user$"
                            li_Key = mo_Db.GetFields(ml_Cursor, "MKT_FIN_Key")
                        
                     End Select
            End Select
            ls_MaintRequest = Replace(ls_MaintRequest, "$Key$", li_Key, , , vbTextCompare)
            ls_MaintRequest = Replace(ls_MaintRequest, "$Z_last_upd_user$", ml_UCode, , , vbTextCompare)
            ExecuteSQLSafe mo_Db, ls_MaintRequest, 1
        End If
    
        End If

'close the transaction
    If Not CommitTran("DelCompDB") Then
        Err.Raise C_ERRORRAISE + 3, "Competitive Database", "Transaction Failure." & vbCrLf & "Enable to commit the transaction." & vbCrLf & Join(mo_Db.SQLErrorMessages, vbCrLf)
    End If
    lb_TranOpened = False
    
    Item_DeleteDB = True
    
    
    Exit Function
    
errHandler:
    Item_DeleteDB = False
    If lb_TranOpened Then
         Call RollbackTran("DelCompDB")
    End If
    
    Call ErrorHandler("Item_AddDB")
End Function

Private Function Item_DeleteLocal(ByVal ao_grid As ArmGrid, ByVal al_Key As Long, ByVal ab_Repostioning As Boolean) As Boolean
On Error GoTo errHandler

    If Not ao_grid.DeleteLine(al_Key) Then
        Debug.Print "Unable to delete line from grid"
        Item_DeleteLocal = False
        Exit Function
    End If
    
    
    If Not ab_Repostioning Then
            Item_DeleteLocal = True
            Exit Function
    End If
    
    Dim lo_Node As Node, lo_SelNode As Node
    
    If ao_grid.Rows = 0 And (me_CurrentTvwSelMethod <> etmCheckBoxes) Then
       Set lo_SelNode = DeleteNode(tv_filter, tv_filter.SelectedItem)
    End If
    
    Dim ls_paths As Variant, ls_path As Variant
    ls_paths = GetCurrentPath(UserControl.Controls, fra_record(0), cbo_Views.SelectedItem.GetData(2))
    
    For Each ls_path In ls_paths
        Set lo_Node = FindInTreeView(tv_filter, ls_path)
        If Not lo_Node Is Nothing And Not (lo_Node Is lo_SelNode) Then
            Set lo_Node = DeleteNode(tv_filter, lo_Node)
        End If
    Next
    
    If Not lo_SelNode Is Nothing Then
        lo_SelNode.Selected = True
        Call tv_filter_NodeClick(lo_SelNode)
    End If

    Item_DeleteLocal = True
    Exit Function
    
errHandler:
    If Not lo_Node Is Nothing Then Set lo_Node = Nothing
    If Not lo_SelNode Is Nothing Then Set lo_SelNode = Nothing
    Call ErrorHandler("Item_DeleteLocal")
   
End Function

Public Function IsItemFiltered() As Boolean
On Error GoTo errHandler
    ' Check date
    If opt_FiltersDate(1).value = True Then
        Dim lDate As Date
        Select Case CStr(cbo_FiltersDate.SelectedItem.Key)
            Case "1" ' Date entered
                lDate = txt_CreationDate(0).Text
            Case "2" ' Date last updated
                lDate = txt_LastUpdDate(0).Text
        End Select
        ' CHECK
        If Len(cal_FiltersMin.date_courte) > 0 Then
            If DateDiff("d", cal_FiltersMin.date_courte, lDate) < 0 Then
                IsItemFiltered = True
                Exit Function
            End If
        End If
        
        If Len(cal_filtersMax.date_courte) > 0 Then
            If DateDiff("d", cal_filtersMax.date_courte, lDate) > 0 Then
                IsItemFiltered = True
                Exit Function
            End If
        End If
    End If
    
    If Opt_FiltersType(0).value And Not opt_General_Strat_Flag(0).value Then
        IsItemFiltered = True
        Exit Function
    End If
        
    If Opt_FiltersType(1).value And Not opt_General_Strat_Flag(1).value Then
        IsItemFiltered = True
        Exit Function
    End If
    Exit Function
    
errHandler:
    Call ErrorHandler("IsItemFiltered")
   
End Function




Private Function DeleteNode(ByRef ao_TreeView As ArmTreeView, ByRef ao_Node As Node) As Node
On Error GoTo errHandler

    Dim lo_Node As Node, lo_ParentNode As Node, lo_PreviousNode As Node

    Set lo_Node = ao_Node
    
    While Not lo_Node Is Nothing
        Call lo_Node.Tag.SetData(3, Val(lo_Node.Tag.GetData(3)) - 1)
        Set lo_Node = lo_Node.Parent
    Wend
    
    Set lo_Node = ao_Node
    Do While (lo_Node.Tag.GetData(3) = 0)
        Set lo_ParentNode = lo_Node.Parent
        Set lo_PreviousNode = lo_Node.Previous
        Call ao_TreeView.RemoveNode(lo_Node)
        Set lo_Node = lo_ParentNode
        If lo_Node Is Nothing Then Exit Do
    Loop
    Set ao_Node = Nothing

    Set DeleteNode = IIf(lo_ParentNode Is Nothing, lo_PreviousNode, lo_ParentNode)
    Exit Function
    
errHandler:
    If (Not lo_Node Is Nothing) Then Set lo_Node = Nothing
    If (Not lo_ParentNode Is Nothing) Then Set lo_ParentNode = Nothing
    If (Not lo_PreviousNode Is Nothing) Then Set lo_PreviousNode = Nothing
    Call ErrorHandler("DeleteNode")

End Function



' Return true if have created the node
' TODO : Manage the third parameter...
Private Function FindInTreeView(ByRef aTV As ArmTreeView, ByVal aPath As String, Optional ByVal ab_AutoCreate As Boolean = False) As Node
On Error GoTo errHandler

    Dim lb_Internal As Boolean
    lb_Internal = mb_internal
    mb_internal = True

    Dim lValues As Variant, ls_Key As String, lv_Data As Variant
    lValues = Split(aPath, SEP & SEP)

    Dim lIdx As Long, lCount As Long, lFoundedCount As Long
    lCount = UBound(lValues)
    Dim lData As Variant, lKey As String, lValue As String
    
    lData = Split(lValues(0), SEP)
    lKey = lData(0)
    lValue = lData(1)
    
    Dim lo_Node As Node
    
    If Not aTV.Find(lKey, 0, , 0) Then
        If ab_AutoCreate Then
            Set lo_Node = aTV.AddNode(, lKey, lValue, 1, 2)
            lo_Node.Selected = True
        Else
            GoTo CleanUp
        End If
    End If
    
    Set FindInTreeView = aTV.SelectedItem
    If Not aTV.SelectedItem.Expanded Then
        Call aTV.ExpandNode(aTV.SelectedItem)
    End If
    If ab_AutoCreate Then
        Call aTV.SelectedItem.Tag.SetData(3, Val(aTV.SelectedItem.Tag.GetData(3)) + 1)
    End If
    
    For lIdx = 1 To lCount
        lData = Split(lValues(lIdx), SEP)
        lKey = lData(0)
        lValue = lData(1)
        If Not aTV.Find(lKey, 0, aTV.SelectedItem, lIdx) Then
            If ab_AutoCreate Then
                Set lo_Node = aTV.AddNode(aTV.SelectedItem, lKey, lValue, 1, 2)
                
                lo_Node.Selected = True
            Else
                GoTo CleanUp
            End If
        End If
        If Not aTV.SelectedItem.Expanded Then
            Call aTV.ExpandNode(aTV.SelectedItem)
        End If
        Set FindInTreeView = aTV.SelectedItem
        If ab_AutoCreate Then
            Call aTV.SelectedItem.Tag.SetData(3, Val(aTV.SelectedItem.Tag.GetData(3)) + 1)
        End If
    
    Next
    
CleanUp:
    mb_internal = lb_Internal
    
    Exit Function
    
errHandler:
    If Not lo_Node Is Nothing Then Set lo_Node = Nothing
    Call ErrorHandler("FindInTreeView")

End Function



' TODO : Retourner la boucle
Private Function GetCurrentPath(ByRef aControls As Variant, ByRef aContainer As Object, ByVal aPattern As String) As Variant
               
On Error GoTo errHandler
    Dim ls_paths As Variant
    
    Dim lPattern() As String
    lPattern = Split(aPattern, SEP)

    Dim lPath() As String
    lPath = lPattern

    Dim lIdxPattern As Long, lCountPattern As Long, lIdxPath As Long
    Dim lIdx As Long, lCount As Long, lIdxLbl As Long
    Dim lControl As Control

    lCountPattern = UBound(lPattern)
    lCount = aControls.Count - 1
    For lIdx = 0 To lCount
        Set lControl = aControls.Item(lIdx)
        If HasContainer(lControl, aContainer) Then
            lIdxPath = -1
            For lIdxPattern = 0 To lCountPattern
                If StrComp(lControl.Tag, IIf(UCase(lPattern(lIdxPattern)) Like "BMK_CODE", "CT_Code", lPattern(lIdxPattern)), vbTextCompare) = 0 Then
                    Select Case UCase(TypeName(lControl))
                        Case "ARMCOMBOBOX"
                            Select Case UCase(lPattern(lIdxPattern))
                                Case "COMP_CODE", "CT_CODE"
                                    lPath(lIdxPattern) = lControl.SelectedItem.Key & SEP & lControl.SelectedItem.DisplayText
                                Case "BMK_CODE"
                                    lPath(lIdxPattern) = lControl.SelectedItem.GetData(2) & SEP & lControl.SelectedItem.GetData(3)
                            End Select
                        Case Else
                            Debug.Print "GetCurrentPath" & UCase(TypeName(lControl))
                    End Select
                End If
            Next
        End If
        Set lControl = Nothing
    Next
    ls_paths = Array(Join(lPath, SEP & SEP))
    
    GetCurrentPath = ls_paths

    Exit Function

errHandler:
    If Not lControl Is Nothing Then Set lControl = Nothing
    Call ErrorHandler("GetCurrentPath")

End Function


Private Sub Item_UpdateReinit(ByVal al_Cursor As Long, ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler
    'clear the frame record
    Dim li_FrameIndex As Long
    
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    
    Call LoadDataToForm(al_Cursor, UserControl.Controls, fra_record(li_FrameIndex))
    
    If me_Mode Like emCopy Then
        txt_CreationDate(li_FrameIndex).Text = Format(Date, "dd\/mm\/yyyy")
        Txt_Creator(li_FrameIndex).Text = ms_LoginName
        txt_LastUpdDate(li_FrameIndex).Text = Format(Date, "dd\/mm\/yyyy")
        txt_UpdUser(li_FrameIndex).Text = ms_LoginName
    End If
    
    Exit Sub
errHandler:
    Call ErrorHandler("Item_UpdateReinit")
   
End Sub

Private Sub Item_AddReinit(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler
    Dim li_FrameIndex As Integer
    
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
    
    Call ClearForm(UserControl.Controls, fra_record(li_FrameIndex))
    Call Item_LoadDefaultValue(al_InfoArrayIndex)
    If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_ATTACHMENTS" Then Call EnableFrame(UserControl.Controls, fra_FileSelector, False)
    txt_CreationDate(li_FrameIndex).Text = Format(Date, "dd\/mm\/yyyy")
    Txt_Creator(li_FrameIndex).Text = ms_LoginName
    txt_LastUpdDate(li_FrameIndex).Text = Format(Date, "dd\/mm\/yyyy")
    txt_UpdUser(li_FrameIndex).Text = ms_LoginName

    Exit Sub

errHandler:
    Call ErrorHandler("item_AddReinit")

End Sub


Private Function GetInfoArrayIndex(ByVal as_FraName As String) As Long
On Error GoTo errHandler
    Dim li_Idx As Integer
    Dim li_Count As Integer
    Dim ls_franame As String
    
    ls_franame = as_FraName
    
    
    li_Count = UBound(mt_ClassInfoLst)
    For li_Idx = 0 To li_Count
        If UCase(mt_ClassInfoLst(li_Idx).ConfigRecord.NameFrame) Like UCase(ls_franame) Then
            Exit For
        End If
    Next li_Idx
    
    GetInfoArrayIndex = li_Idx
    Exit Function
errHandler:
    Call ErrorHandler("GetInfoArrayIndex")
   
End Function



Private Sub tlb_list_action(ByVal as_Role As String, as_Language As String)
' TODO : Manage error and mouse

On Error GoTo errHandler
    
    Call LockScreen(True)
    
    Dim ll_InfoArrayIndex As Long
    
    mb_internal = True
    tbs_selector(0).Tabs.Item(1).Selected = True
    mb_internal = False
    
    ll_InfoArrayIndex = GetInfoArrayIndex(tbs_selector(ml_tbsidx).SelectedItem.Tag)
    
    Call SetMode(emList)
    
    Select Case as_Role
        Case "A"
        ' Want to add a new competitor
            Call Item_AddInit(ll_InfoArrayIndex)
            
        Case "B"
        ' Want to Update
            Call Item_UpdateInit(ll_InfoArrayIndex, grd_List)
        
        Case "C"
        ' Want to delete
            Call Item_DeleteInit(ll_InfoArrayIndex)
        
        Case "L"
            Call LoadCurrentTVSelection
        ' Want to reload treeview and refresh the grid
            '-> call LoadCurrentTVSelection
                
        Case "F"
            ' Want to reload grid according to treeview selection
            Call RefreshList
            
        Case "T"
            ' TODO : Ask user if he really want to quit if the application is in maintenance mode (add, update, delete)
            RaiseEvent quit
        
    End Select
    
    Call LockScreen(False)
    
    Exit Sub
errHandler:
    DBLog "tlb_list_action"
    Call LockScreen(False)

    Select Case Err.Number
    Case "202"
        MsgBox MsgText(202, ms_Language_Code, "#The item you have added/updated couldn't be displayed with the current criteria set."), vbInformation + vbOKOnly
    Case "927":
        MsgBox MsgText(927, ms_Language_Code, "#No more previous item"), vbInformation
    Case "928":
        MsgBox MsgText(928, ms_Language_Code, "#No more next item"), vbInformation
    Case "2135":
        MsgBox MsgText(2135, ms_Language_Code, "#Unable to update the record."), vbInformation
    Case "2136"
        MsgBox MsgText(2136, ms_Language_Code, "#Unable to delete the record."), vbInformation
    Case "2137":
        MsgBox MsgText(2137, ms_Language_Code, "#Unable to add the record."), vbInformation
    Case "2138":
        MsgBox MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation
    Case 2507
        MsgBox MsgText(2144, ms_Language_Code, "#This record has been, modified by an other.Please exit from this screen and refresh the grid."), vbInformation
    Case Else
        MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation
    End Select

End Sub


Private Sub InitializedFraRecord(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler

    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.Initialized Then Exit Sub

    Select Case UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame)
        Case "CD_GENERAL"
            Call Init_Cbo_Lst(cbo_General_Competitor, "exec MKT_competitor_lst '" & ms_Language_Code & "'", False)
            
            Call Init_Cbo_Lst(cbo_General_Country, "exec MKT_countries_lst 'E" & ms_Language_Code & "'", False)
        
        Case "CD_CHANNEL"
        
            
            Call Init_Cbo_Year(cbo_Channel_Year, Year(Now) - 10, Year(Now) + 10, False)
                        
            Call Init_Cbo_Year(cbo_Channel_Year_began, Year(Now) - 10, Year(Now) + 10, True)
            
            Call Init_Cbo_Lst(cbo_Channel_Type, "exec MKT_CHNL_Type_lst '" & ms_Language_Code & "'", False)
                            
            Call Init_Cbo_Lst(cbo_Channel_Category, "exec MKT_Super_Categories_lst '" & ms_Language_Code & "'", False)
            
' START Products = Channel_PE **********************************************************
            Set grd_Products.ArmDb = mo_Db
            grd_Products.Load_A_Com
            grd_Products.AllowExcelExport = True
            grd_Products.ExportTitles = True
            grd_Products.MultiSelect = False
            
            Call InitializedSubItemGrid(grd_Products, 0, GetInfoArrayIndex("CD_CHANNEL_PE"))
            Call LoadLabels(UserControl.Controls, Fra_Products, SCREEN_NAME & "_" & Fra_Products.Tag, ms_Language_Code)

' START Products = Channel_PE **********************************************************
            
            
        Case "CD_SALESORG_C", "CD_SALESORG_S"
            Call Init_Cbo_Year(cbo_SalesOrg_Year, Year(Now) - 10, Year(Now) + 10, False)
            
            Call Init_Cbo_Lst(cbo_SalesOrg_TypeofOffice, "exec MKT_SalesOffice_Type_Lst '" & ms_Language_Code & "'", True)
            
' START SalesReps **********************************************************
            Set grd_SalesOrg_SalesReps.ArmDb = mo_Db
            grd_SalesOrg_SalesReps.Load_A_Com
            grd_SalesOrg_SalesReps.AllowExcelExport = True
            grd_SalesOrg_SalesReps.ExportTitles = True
            grd_SalesOrg_SalesReps.MultiSelect = False
            ReDim lColumns(4)
            lColumns(0) = Join(Array("MKT_SOPeople_Key", 0, 1, "MKT_SOPeople_Key", "MKT_SOPeople_Key"), SEP)
            lColumns(1) = Join(Array("SOP_Name", 1800, 0, "SOP_Name", "#Name"), SEP)
            lColumns(2) = Join(Array("SOP_BeginYR_Comp", 1350, 0, "SOP_BeginYR_Comp", "#Join Company"), SEP)
            lColumns(3) = Join(Array("SOP_BeginYR_Ind", 1350, 0, "SOP_BeginYR_Ind", "#Begin in Ind."), SEP)
            lColumns(4) = Join(Array("SOP_Comment", 4000, 0, "SOP_Comment", "#Comment"), SEP)
            
            
            If Not grd_SalesOrg_SalesReps.SetColumns(lColumns) Then
                Debug.Print "grd_SalesOrg_SalesReps.SetColumns error"
                Call Unload_A_Com
                End
            End If
            
            Call LoadLabels(UserControl.Controls, Fra_SalesReps, SCREEN_NAME & "_" & Fra_SalesReps.Tag, ms_Language_Code)
' END SalesReps **********************************************************
        
        Case "CD_SALESEST_C", "CD_SALESEST_S"
            Call Init_Cbo_Year(cbo_SalesEst_Year, Year(Now) - 10, Year(Now) + 10, False)
                   
            Call Init_Cbo_Lst(cbo_SalesEst_Category, "exec MKT_Super_Categories_lst '" & ms_Language_Code & "'", False)
            
            Call Init_Cbo_Lst(cbo_SalesEst_Material, "", False)
            
            Call Init_Cbo_Lst(cbo_SalesEst_Unit_of_Measure, "exec MKT_Unit_Of_Measure_lst '" & ms_Language_Code & "'", False)
            
            Call Init_Cbo_Lst(cbo_SalesEst_Currency, "exec MKT_Currencies_lst '" & ms_Language_Code & "'", False)
            
        Case "CD_SWOT"
            Call Init_Cbo_Year(cbo_SWOT_Year, Year(Now) - 10, Year(Now) + 10, False)

        Case "CD_ATTACHMENTS"
            Call Init_Cbo_Lst(cbo_Attachment_Type, "exec MKT_Attachment_Type_lst '" & ms_Language_Code & "'", False)
            
            Call Init_Cbo_Lst(cbo_Attachment_DocLanguage, "exec language_cbo", False)
            


        Case "CD_SALESREPS"
            
            Set cbo_SalesReps_BeginYrComp.ArmDb = mo_Db
            cbo_SalesReps_BeginYrComp.FirstBlankItem = False
            Call cbo_SalesReps_BeginYrComp.Load_A_Com
            
            Set cbo_SalesReps_BeginYrInd.ArmDb = mo_Db
            cbo_SalesReps_BeginYrInd.FirstBlankItem = False
            Call cbo_SalesReps_BeginYrInd.Load_A_Com
            
            Dim li_Year As Integer
            Dim li_Idx As Integer
            li_Year = Year(Now)
            
            Call cbo_SalesReps_BeginYrInd.AddItem(Array(0, ""))
            Call cbo_SalesReps_BeginYrComp.AddItem(Array(0, ""))
            For li_Idx = li_Year - 50 To li_Year
                Call cbo_SalesReps_BeginYrInd.AddItem(Array(li_Idx, li_Idx))
                Call cbo_SalesReps_BeginYrComp.AddItem(Array(li_Idx, li_Idx))
            Next li_Idx
            Call cbo_SalesReps_BeginYrInd.SearchItem(0)
            Call cbo_SalesReps_BeginYrComp.SearchItem(0)

        Case "CD_CHANNEL_PE"
            Call Init_Cbo_Lst(cbo_Channel_PE_Category, "exec MKT_Super_Categories_lst '" & ms_Language_Code & "'", False)
            Call Init_Cbo_Lst(cbo_Channel_PE_BM, "", False)
            Call Init_Cbo_Lst(cbo_Channel_PE_UM, "exec MKT_Unit_Of_Measure_lst '" & ms_Language_Code & "'", False)
            Call Init_Cbo_Lst(cbo_Channel_PE_Curr, "exec MKT_Currencies_lst '" & ms_Language_Code & "'", False)
        
        Case "CD_SERVICES"
            Call Init_Cbo_Year(cbo_Services_Year, Year(Now) - 10, Year(Now) + 10, False)
            
            Call Init_Cbo_Lst(cbo_Services_Compliance_Ranking, "exec MKT_ComplianceRNKG_lst '" & ms_Language_Code & "'", True)
            
            Call Init_Cbo_Lst(cbo_Services_TechSupportRating, "exec MKT_TSRating_lst '" & ms_Language_Code & "'", False)
        
        Case "CD_PRODUCTS_C", "CD_PRODUCTS_S"
            Call Init_Cbo_Year(cbo_Product_Year, Year(Now) - 10, Year(Now) + 10, False)
            
            Call Init_Cbo_Lst(cbo_Product_Currency, "exec MKT_Currencies_lst '" & ms_Language_Code & "'", False)
            
            Call Init_Cbo_Lst(cbo_Product_Unit_of_Measure, "exec MKT_Unit_Of_Measure_lst '" & ms_Language_Code & "'", False)
            
            Call Init_Cbo_Lst(cbo_Product_GP_Type, "exec MKT_GP_Type_lst '" & ms_Language_Code & "'", False)
            
            Call Init_Cbo_Lst(cbo_Product_Price_Positioning, "exec MKT_Position_lst '" & ms_Language_Code & "'", False)
        
        Case "CD_LOCATION"
            Call Init_Cbo_Year(cbo_Location_Year, Year(Now) - 10, Year(Now) + 10, False)
            
        Case "CD_BUSINESSMODEL"
            Call Init_Cbo_Year(cbo_BusMod_Year, Year(Now) - 10, Year(Now) + 10, False)
            
            Call Init_Cbo_Lst(cbo_BusMod_Type, "exec MKT_BusMod_Type_lst '" & ms_Language_Code & "'", False)
        
        Case "CD_PRODUCTION"
            Call Init_Cbo_Year(cbo_Production_Year, Year(Now) - 10, Year(Now) + 10, False)
            
            Call Init_Cbo_Lst(cbo_Production_Type, "exec MKT_Prod_Type_lst '" & ms_Language_Code & "'", False)
            
            Call Init_Cbo_Lst(cbo_Production_Country, "exec MKT_countries_lst '" & ms_Language_Code & "'", True)
            
            Call Init_Cbo_Lst(cbo_Production_Unit_of_Measure, "exec MKT_Unit_Of_Measure_lst '" & ms_Language_Code & "'", False)
            
        Case "CD_FINANCIAL_C", "CD_FINANCIAL_S"
            Call Init_Cbo_Year(cbo_Financial_Year, Year(Now) - 10, Year(Now) - 1, False)
            
            Call Init_Cbo_Lst(cbo_Financial_Fin_Currency, "exec MKT_Currencies_lst '" & ms_Language_Code & "'", False)
            
            Call Init_Cbo_Lst(cbo_Financial_Fin_PL_Currency, "exec MKT_Currencies_lst '" & ms_Language_Code & "'", False)
        
        Case "CD_COMMUNICATION"
            Call Init_Cbo_Year(cbo_Communication_Year, Year(Now) - 10, Year(Now) + 10, False)
            
            Call Init_Cbo_Lst(cbo_Communication_Type, "exec MKT_COM_Type_lst '" & ms_Language_Code & "'", False)
            
            
    End Select
    
    mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.Initialized = True

    Exit Sub
errHandler:
    Call ErrorHandler("InitializedFraRecord")

End Sub

Private Sub Item_LoadDefaultValue(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler
    Dim lIdx As Long, lCount As Long
    Dim lParams As Variant
    mb_internalFin = True
    lCount = UBound(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsDefaultValue, 1)

    For lIdx = 0 To lCount
            Select Case UCase(TypeName(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsDefaultValue(lIdx, 0)))
                Case "FRAME", "LABEL", "MSFLEXGRID", "TOOLBARCONTROL"
                    ' Do nothing !
                
                Case "TEXTBOX"
                    mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsDefaultValue(lIdx, 0).Text = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsDefaultValue(lIdx, 1)
                    
                Case "ARMGRID", "ARMCHECKVIEW", "COMMANDBUTTON", "A_CALOCX", "ARMTREEVIEW", "LISTBOX", "PICTUREBOX", "TABSTRIP", "CHECKBOX"
                
                Case "OPTIONBUTTON"
                    
                Case "ARMCOMBOBOX"
                    lParams = Split(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsDefaultValue(lIdx, 1), SEP1)
                    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsDefaultValue(lIdx, 0).SearchItem(lParams(0), 0, 0, True) = False Then
                        If Not mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsDefaultValue(lIdx, 0).AddItem(Array(lParams(0), lParams(1)), True) Is Nothing Then
                            Select Case UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame)
                                Case "CD_CHANNEL"
                                    Call cbo_Channel_Type_ComboItemSelected
                                Case "CD_PRODUCTS_C", "CD_PRODUCTS_S"
                                    Call cbo_Product_GP_Type_ComboItemSelected
                                Case "CD_COMMUNICATION"
                                    Call cbo_Communication_Type_ComboItemSelected
                            End Select
                        End If
                    End If
                                    
                Case Else
                    Debug.Print "Item_LoadDefaultValue " & UCase(TypeName(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsDefaultValue(lIdx, 0)))
            End Select
    Next
    mb_internalFin = False
    Exit Sub
errHandler:
    mb_internalFin = False
    Call ErrorHandler("Item_LoadDefaultValue")
   
End Sub
Private Function Item_CheckMandatory(ByVal al_InfoArrayIndex As Long) As Boolean

On Error GoTo errHandler
    
    Dim lIdx As Long, lCount As Long
    Dim lv_MsgReplaceInfo(0, 1) As String
    
    lCount = UBound(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsMandatory, 1)
    
    For lIdx = 0 To lCount
            Select Case UCase(TypeName(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsMandatory(lIdx, 0)))
                Case "FRAME", "LABEL", "MSFLEXGRID", "TOOLBARCONTROL"
                    ' Do nothing !
                
                Case "TEXTBOX"
                    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsMandatory(lIdx, 0).Text = "" Then
                        lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                        lv_MsgReplaceInfo(0, 1) = lbl_label(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsMandatory(lIdx, 1)).Caption
                        Call MsgBox(MsgText(2120, ms_Language_Code, "The field " & lv_MsgReplaceInfo(0, 1) & " is mandatory.", lv_MsgReplaceInfo), vbInformation)
                        mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsMandatory(lIdx, 0).SetFocus
                        Exit Function
                    End If
                    
                Case "ARMGRID", "ARMCHECKVIEW", "COMMANDBUTTON", "A_CALOCX", "ARMTREEVIEW", "LISTBOX", "PICTUREBOX", "TABSTRIP", "CHECKBOX"
                
                Case "OPTIONBUTTON"
                    
                Case "ARMCOMBOBOX"
                    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsMandatory(lIdx, 0).SelectedItem Is Nothing Then
                        lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                        lv_MsgReplaceInfo(0, 1) = lbl_label(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsMandatory(lIdx, 1)).Caption
                        Call MsgBox(MsgText(2120, ms_Language_Code, "The field " & lv_MsgReplaceInfo(0, 1) & " is mandatory.", lv_MsgReplaceInfo), vbInformation)
                        mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsMandatory(lIdx, 0).SetFocus
                        Exit Function
                    End If
                                    
                Case Else
                    Debug.Print "Item_CheckMandatory " & UCase(TypeName(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsMandatory(lIdx, 0)))
            End Select
    Next

    Item_CheckMandatory = True

    Exit Function
errHandler:
    Call ErrorHandler("Item_CheckMandatory")
    
End Function


Private Sub Init_Cbo_Lst(ByVal ao_cboctrl As ArmCombobox, ByVal as_Request As String, ByVal ab_FirstBlank As Boolean)
On Error GoTo errHandler
    Set ao_cboctrl.ArmDb = mo_Db
    ao_cboctrl.FirstBlankItem = ab_FirstBlank
    ao_cboctrl.Load_A_Com
    ao_cboctrl.Request = as_Request
    
    Exit Sub
    
errHandler:
    Call ErrorHandler("Init_Cbo_Lst")

End Sub
Private Sub Init_Cbo_Year(ByVal ao_cboctrl As ArmCombobox, ByVal ai_FirstYear As Integer, ByVal ai_LastYear As Integer, ByVal ab_FirstLineBlank As Boolean)
On Error GoTo errHandler
    Dim li_Idx As Integer
    Dim li_Year As Integer
    
    ao_cboctrl.Load_A_Com
    'li_year = ai_LastYear
    If ab_FirstLineBlank Then
        Call ao_cboctrl.AddItem(Array(0, ""))
    End If
    
    For li_Idx = ai_FirstYear To ai_LastYear
        Call ao_cboctrl.AddItem(Array(li_Idx, li_Idx))
    Next li_Idx
    Exit Sub
errHandler:
    Call ErrorHandler("Init_Cbo_Year")

End Sub


Private Sub Item_AddInit(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler
    'Change screen mode
    Call SetMode(emAdd)
    Dim ls_FrameName As String
    Dim li_FrameIndex As Integer
    
    ls_FrameName = UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame)
    li_FrameIndex = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame
  
    
    'clear the frame record
    Call ClearForm(UserControl.Controls, fra_record(li_FrameIndex))
    
    Call EnableFrame(UserControl.Controls, fra_record(li_FrameIndex), True)
    
    Call EnableFrame(UserControl.Controls, fra_ModifInfo(li_FrameIndex), False)
    
    If ls_FrameName Like "CD_SALESORG_*" Then Call EnableFrame(UserControl.Controls, Fra_SalesReps, False)
    
    If ls_FrameName Like "CD_CHANNEL" Then Call EnableFrame(UserControl.Controls, Fra_Products, False)
    
    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ExistAttach Then Call EnableFrame(UserControl.Controls, Fra_Attachments, False)
    
    InitializedFraRecord (al_InfoArrayIndex)
    
    'load default values
    Call Item_LoadDefaultValue(al_InfoArrayIndex)
    
    'change face toolbar
    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ExistAttach Or ls_FrameName Like "CD_CHANNEL" Then
        Call HandleToolbar(tlb_item, "1", True)
    Else
        Call HandleToolbar(tlb_item, "0", True)
    End If
    
    If Not ls_FrameName Like "CD_GENERAL" Then
        lbl_ItemTitle.Caption = lbl_DetailTitle.Caption
        lbl_ItemTitle.Visible = True
        lbl_ItemTitle.ZOrder
    Else
        lbl_ItemTitle.Visible = False
    End If
    
    txt_CreationDate(li_FrameIndex).Text = Format(Date, "dd\/mm\/yyyy")
    Txt_Creator(li_FrameIndex).Text = ms_LoginName
    txt_LastUpdDate(li_FrameIndex).Text = Format(Date, "dd\/mm\/yyyy")
    txt_UpdUser(li_FrameIndex).Text = ms_LoginName

    'Resize the frame
    Call fra_item.Move(120, 120, UserControl.Width - 120 * 2, UserControl.Height - 120 * 2)
    Call tlb_item.Move(fra_item.Width - tlb_item.Width - 120, 120 * 2, tlb_item.Width - 120, fra_item.Height - 120 * 3)
    Call fra_record(li_FrameIndex).Move(120, 120 + lbl_ItemTitle.Height, fra_item.Width - tlb_item.Width - 120 * 3, fra_item.Height - 120 * 2 - lbl_ItemTitle.Height)
    
    'display frame item ady_index
    fra_record(li_FrameIndex).Visible = True
    fra_record(li_FrameIndex).ZOrder

    'Attachment
    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ExistAttach Then
        'disable frame list
        Fra_Attachments.Visible = False
        Call ClearForm(UserControl.Controls, Fra_Attachments)
        Call EnableFrame(UserControl.Controls, Fra_Attachments, False)
        Fra_Attachments.Visible = True
        Fra_Attachments.ZOrder
    End If
    
    fra_item.Visible = True
    fra_item.ZOrder
    Exit Sub
errHandler:
    SetMode (me_OldMode)
    Call ErrorHandler("Item_AddInit")

End Sub




' Apply default value on a screen
Private Sub ClearForm(ByRef aControls As Variant, ByRef aContainer As Object)
On Error GoTo errHandler
    'mb_internal = True
    
    Dim lIdx As Long, lCount As Long, lControl As Object
    lCount = aControls.Count - 1
    For lIdx = 0 To lCount
        Set lControl = aControls.Item(lIdx)
        If HasContainer(lControl, aContainer) Then
            Select Case UCase(TypeName(lControl))
                Case "TEXTBOX"
                    lControl.Text = ""
                Case "ARMCOMBOBOX"
                    Select Case UCase(lControl.Name)
                        Case "CBO_SALESEST_CATEGORY", "CBO_CHANNEL_PE_CATEGORY"
                            lControl.Clear
                        Case "CBO_SALESEST_MATERIAL", "CBO_CHANNEL_PE_BM"
                            lControl.Clear
                            lControl.Request = ""
                    End Select
                    
                    Set lControl.SelectedItem = Nothing
                    
                Case "A_CALOCX"
                    lControl.reinit_cal
                Case "CHECKBOX"
                    lControl.value = vbUnchecked
                Case "ARMCHECKVIEW"
                    'lControl.Reset
                    
                Case "FRAME", "LABEL", "TOOLBARCONTROL", "PICTUREBOX", "COMMANDBUTTON"
                
                Case "ARMGRID"
                    lControl.ClearGrid
                    lControl.Requests = ""
                Case "LISTBOX"
                    lControl.ListIndex = -1
                Case "OPTIONBUTTON"
                    Dim lValues As Variant
                    lValues = Split(lControl.Tag, SEP)
                    lControl.value = lValues(1)
                Case "TABSTRIP", "DRIVELISTBOX", "DIRLISTBOX", "FILELISTBOX"
                
                Case Else
                    Debug.Print "ClearForm " & UCase(TypeName(lControl))
            End Select
        End If
        
        Set lControl = Nothing
    Next
    
    Exit Sub
    
errHandler:
    If (Not lControl Is Nothing) Then Set lControl = Nothing
    Call ErrorHandler("ClearForm")

End Sub
Private Function Item_Add(ByVal al_InfoArrayIndex As Long) As Boolean
    
    'check the data validity -> Item_Check
    If Not Item_CheckMandatory(al_InfoArrayIndex) Then Exit Function
    
    If Not Item_Check(al_InfoArrayIndex) Then Exit Function
    
    'update data on the db ->
    If Not Item_AddDB(al_InfoArrayIndex) Then Exit Function 'GoTo BackToGrid
    
    'if success then Add the data locally ->
    If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.TableName) Like "MKT_MASTER" Then
        If IsItemFiltered Then
            MsgBox MsgText(202, ms_Language_Code, "#The item you have added/updated couldn't be displayed with the current criteria set."), vbInformation + vbOKOnly
            GoTo BackToGrid
        End If
        
        If Not Item_AddLocal(UserControl.Controls, fra_record(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), grd_List, al_InfoArrayIndex) Then Exit Function
    

        Dim ls_paths As Variant
        ls_paths = GetCurrentPath(UserControl.Controls, fra_record(0), cbo_Views.SelectedItem.GetData(2))
        
        Dim lo_Node As Node, lo_SelNode As Node
        Set lo_SelNode = FindInTreeView(tv_filter, ls_paths(0), True)
        
        If (me_CurrentTvwSelMethod = etmCheckBoxes) And (Not lo_SelNode Is Nothing) Then
            Call tv_filter.SetNodeState(lo_SelNode, 8)
        End If
        
        
        Dim ll_Idx As Long, ll_Count As Long
        ll_Count = UBound(ls_paths)
        For ll_Idx = 1 To ll_Count
            Set lo_Node = FindInTreeView(tv_filter, ls_paths(ll_Idx), True)
             If (me_CurrentTvwSelMethod = etmCheckBoxes) And (Not lo_Node Is Nothing) Then
                Call tv_filter.SetNodeState(lo_Node, 8)
            End If
        Next
        
        If (Not lo_SelNode Is Nothing) Then
            lo_SelNode.Selected = True
            If (me_CurrentTvwSelMethod = etmCheckBoxes) Then
                Call LoadCurrentTVSelection
            Else
                Call tv_filter_NodeClick(lo_SelNode)
            End If
            If Not grd_List.SearchKey(True, ml_CurrentKey) Then Debug.Print "error"
        End If
        
    Else
            If Not Item_AddLocal(UserControl.Controls, fra_record(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), grd_detail1, al_InfoArrayIndex) Then Exit Function
    End If
    
    
    
BackToGrid:
    'go back to the detail screen
    If me_Mode <> emCopy Then
        Call Item_ExitToGrid(al_InfoArrayIndex)
    End If
    
    Item_Add = True
    
    Exit Function
errHandler:
    If Not lo_SelNode Is Nothing Then Set lo_SelNode = Nothing
    Call ErrorHandler("Item_Add")

End Function

Private Function Item_AddDB(ByVal al_InfoArrayIndex As Long) As Boolean

On Error GoTo errHandler

    Const DB_MASTER_MAINTENANCE_UPD As String = "exec MKT_Master_Maintenance_Upd $MKT_Key$, $Z_last_upd_user$"
    
    Dim ls_ADD_Request As String
    Dim lb_TranOpened As Boolean
    
'get the request from the ClassInfo
    ls_ADD_Request = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.RequestAdd
    
    Dim ll_NextID As Long
    ll_NextID = mo_Db.SQLNextID(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.TableName)
    
    txt_key(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame).Text = ll_NextID
    ml_CurrentKey = ll_NextID
    
'replace the holders (from the frame record)
        
    If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_CHANNEL_PE" Then ls_ADD_Request = Replace(ls_ADD_Request, "$MKT_CHNL_Key$", mo_Db.GetFields(ml_Cursor, "MKT_CHNL_Key"), , , vbTextCompare)
    If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_SALESREPS" Then ls_ADD_Request = Replace(ls_ADD_Request, "$MKT_SO_Key$", mo_Db.GetFields(ml_Cursor, "MKT_SO_Key"), , , vbTextCompare)
    
    ls_ADD_Request = ReplaceHolders(UserControl.Controls, fra_record(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), ls_ADD_Request)

'START Check unicity ************
    Dim ls_check_request As String
    Dim ll_Curs As Long
    Dim li_Count As Integer
    
    ls_check_request = mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.RequestCheck
    If ls_check_request <> "" Then
        ls_check_request = Replace(ls_check_request, "$MKT_Key$", grd_List.SelectedLine(0, "MKT_Key"), , , vbTextCompare)
        ls_check_request = ReplaceHolders(UserControl.Controls, fra_record(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame), ls_check_request)
        If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_CHANNEL_PE" Then
            ls_check_request = Replace(ls_check_request, "$CHNL_Year$", mo_Db.GetFields(ml_Cursor, "CHNL_Year"), , , vbTextCompare)
            ls_check_request = Replace(ls_check_request, "$MKT_CHNL_Key$", mo_Db.GetFields(ml_Cursor, "MKT_CHNL_Key"))
        End If
        
        ' HERE WE CHECK THE DATA INTEGRITY (UNICITY)
        ' li_Count indicates if the data already  exists
        ll_Curs = OpenSQLSafe(mo_Db, ls_check_request)
        li_Count = mo_Db.RowCount(ll_Curs)
        mo_Db.Close (ll_Curs)
        
        If li_Count > 0 Then
            MsgBox MsgText(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.CheckMsg(0, 0), ms_Language_Code, mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.CheckMsg(0, 1)), vbInformation + vbOKOnly
            Exit Function
        End If
    End If

'END Check unicity ************

'open the transaction
    Call BeginTran("AddCompDB")
        
    lb_TranOpened = True

    ExecuteSQLSafe mo_Db, ls_ADD_Request

    If Not UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.TableName) Like "MKT_MASTER" Then
        'if not add of a master then update the master (date + user)
        Dim ls_MasterMaintRequest As String
        
        ls_MasterMaintRequest = Replace(DB_MASTER_MAINTENANCE_UPD, "$MKT_Key$", ml_MasterKey, , , vbTextCompare)
        ls_MasterMaintRequest = Replace(ls_MasterMaintRequest, "$Z_last_upd_user$", ml_UCode, , , vbTextCompare)
        
        ExecuteSQLSafe mo_Db, ls_MasterMaintRequest, 1
        
        If UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_CHANNEL_PE" Or UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame) Like "CD_SALESREPS" Then
            Dim ls_MaintRequest As String
            Dim li_Key As Integer
            Select Case UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame)
                Case "CD_CHANNEL_PE"
                    ls_MaintRequest = "exec MKT_Channel_Maintenance_Upd $Key$, $Z_last_upd_user$"
                    li_Key = mo_Db.GetFields(ml_Cursor, "MKT_CHNL_Key")
                Case "CD_SALESREPS"
                    ls_MaintRequest = "exec MKT_Sales_Organisation_Maintenance_Upd $Key$, $Z_last_upd_user$"
                    li_Key = mo_Db.GetFields(ml_Cursor, "MKT_SO_Key")
            End Select
            ls_MaintRequest = Replace(ls_MaintRequest, "$Key$", li_Key, , , vbTextCompare)
            ls_MaintRequest = Replace(ls_MaintRequest, "$Z_last_upd_user$", ml_UCode, , , vbTextCompare)
            ExecuteSQLSafe mo_Db, ls_MaintRequest, 1
        End If
    End If
    
    If me_Mode = emCopy Then
        Call Item_Copy_SubItems(al_InfoArrayIndex)
    End If
    
    Call CommitTran("AddCompDB")
    lb_TranOpened = False
    
    'ml_CurrentKey = ll_NextID
    
    Item_AddDB = True
    
    
    Exit Function
    
errHandler:
    If lb_TranOpened Then
        Call RollbackTran("AddCompDB")
    End If
    Call ErrorHandler("Item_AddDB")

End Function

Private Function BeginTran(as_Tran As String) As Boolean

On Error GoTo errHandler
    BeginTran = False
    ExecuteSQLSafe mo_Db, "BEGIN TRANSACTION " & as_Tran

    BeginTran = True
    Exit Function
    
errHandler:
    mo_Db.Disconnect
    Set mo_Db = Nothing
    MsgBox "A Fatal error occured in " & SCREEN_NAME & ".BeginTran, your application will be close. Please contact your IT support"
    End
End Function

Private Function CommitTran(as_Tran As String) As Boolean

On Error GoTo errHandler
    CommitTran = False
    ExecuteSQLSafe mo_Db, "COMMIT TRANSACTION " & as_Tran

    CommitTran = True
    Exit Function
    
errHandler:
    mo_Db.Disconnect
    Set mo_Db = Nothing
    MsgBox "A Fatal error occured in " & SCREEN_NAME & ".CommitTran, your application will be close. Please contact your IT support"
    End

End Function

Private Function RollbackTran(as_Tran As String) As Boolean
    
    Dim ll_errNumber As Long, ls_ErrSrc As String, ls_ErrDesc As String
    ll_errNumber = Err.Number
    ls_ErrSrc = Err.Source
    ls_ErrDesc = Err.Description

On Error GoTo errHandler
    RollbackTran = False
    
    ExecuteSQLSafe mo_Db, "ROLLBACK TRANSACTION " & as_Tran


    Err.Number = ll_errNumber
    Err.Source = ls_ErrSrc
    Err.Description = ls_ErrDesc

    RollbackTran = True
    Exit Function
    
errHandler:
    mo_Db.Disconnect
    Set mo_Db = Nothing
    MsgBox "A Fatal error occured in " & SCREEN_NAME & ".RollbackTran, your application will be close. Please contact your IT support"
    End
End Function

Private Function ReplaceHolders(ByRef aControls As Variant, ByRef aContainer As Object, ByVal as_Request As String) As String
    
On Error GoTo errHandler

    Dim lIdx As Long, lCount As Long
    Dim lControl As Control
    Dim lv_number As Variant
    Dim lValues As Variant
    
    
    lCount = aControls.Count - 1
    
    For lIdx = 0 To lCount
        Set lControl = aControls.Item(lIdx)
        If HasContainer(lControl, aContainer) Then
            Select Case UCase(TypeName(lControl))
                Case "TEXTBOX"
                    'handle numeric
                    lValues = Split(lControl.Tag, SEP)
                    If UBound(lValues) > 0 Then
                        Select Case lValues(1)
                            Case "Text"
                                as_Request = Replace(as_Request, "$" & lValues(0) & "$", Replace(Trim(lControl.Text), "'", "''"), , , vbTextCompare)
                            Case "Num"
                                'lv_number = Replace(Trim(IIf(lControl.Text = "", 0, lControl.Text)), ms_ThousandSeparator, "", , , vbTextCompare)
                                lv_number = Replace(Trim(IIf(lControl.Text = "", 0, lControl.Text)), ms_ThousandSeparator, "", , , vbTextCompare)
                                lv_number = Replace(lv_number, ms_DecimalSeparator, ".", , , vbTextCompare)
                                'lv_number = Replace(Trim(IIf(lControl.Text = "", 0, lControl.Text)), ms_DecimalSeparator, ".", , , vbTextCompare)
                                as_Request = Replace(as_Request, "$" & lValues(0) & "$", lv_number, , , vbTextCompare)
                                
                        End Select
                    End If
                Case "ARMCOMBOBOX"
                    'TODO : If not mandatory
                    'If cbo_Production_Unit_of_Measure.SelectedItem Is Nothing Then Stop
                    If Not lControl.SelectedItem Is Nothing Then
                        as_Request = Replace(as_Request, "$" & lControl.Tag & "$", IIf(lControl.SelectedItem.Key = "", "NULL", lControl.SelectedItem.Key), , , vbTextCompare)
                    Else
                        as_Request = Replace(as_Request, "$" & lControl.Tag & "$", "Null", , , vbTextCompare)
                    End If
                    
                Case "OPTIONBUTTON" ', "ARMTREEVIEW", "LISTBOX", "PICTUREBOX" '"A_CALOCX",
                    If lControl.value = True Then
                        lValues = Split(lControl.Tag, SEP)
                        as_Request = Replace(as_Request, "$" & lValues(0) & "$", lValues(2), , , vbTextCompare)
                    End If
                Case "CHECKBOX"
                        lValues = Split(lControl.Tag, SEP)
                  If lControl.value = vbChecked Then
                    as_Request = Replace(as_Request, "$" & lValues(0) & "$", "X", , , vbTextCompare)
                  Else
                    as_Request = Replace(as_Request, "$" & lValues(0) & "$", "", , , vbTextCompare)
                    End If
            End Select
        End If
        Set lControl = Nothing
    Next
    
    as_Request = Replace(as_Request, "$MKT_Key$", ml_MasterKey, , , vbTextCompare)
    as_Request = Replace(as_Request, "$Language_code$", ms_Language_Code, , , vbTextCompare)
    as_Request = Replace(as_Request, "$Z_Creator_User$", ml_UCode, , , vbTextCompare)
    as_Request = Replace(as_Request, "$Z_last_upd_user$", ml_UCode, , , vbTextCompare)
    as_Request = Replace(as_Request, "$Strat_flag$", IIf(Opt_FiltersType(0).value = True, "C", "S"), , , vbTextCompare)
    as_Request = Replace(as_Request, "'Null'", "Null", , , vbTextCompare)

    ReplaceHolders = as_Request
    Exit Function
    
errHandler:
    If Not lControl Is Nothing Then Set lControl = Nothing
    Call ErrorHandler("ReplaceHolders")
    
End Function

Private Function Item_AddLocal(ByRef aControls As Variant, ByRef aContainer As Object, ByRef ao_grid As ArmGrid, ByVal al_InfoArrayIndex As Long) As Boolean
On Error GoTo errHandler
    'change the data locally
    Dim ll_Idx As Long
    Dim lIdx As Long, lCount As Long
    Dim lControl As Control
    Dim ls_ColInfo() As String
    Dim lValues As Variant
    Dim ll_nbcol As Long
    ll_nbcol = ao_grid.Cols - 1
    
    ReDim ls_ColInfo(ll_nbcol)
    
    For ll_Idx = 0 To ll_nbcol
    
        lCount = aControls.Count - 1
    
        For lIdx = 0 To lCount
            Set lControl = aControls.Item(lIdx)
            If HasContainer(lControl, aContainer) Then
                Select Case UCase(TypeName(lControl))
                    Case "TEXTBOX"
                        'handle numeric
                        lValues = Split(lControl.Tag, SEP)
                        If UBound(lValues) > 0 Then
                            If UCase(Replace(lValues(0), "_code", "_desc", , , vbTextCompare)) Like UCase(ao_grid.Columns(ll_Idx).Name) Then ls_ColInfo(ll_Idx) = Trim(lControl.Text)
                        End If
                    Case "ARMCOMBOBOX"
                        'TODO : If not mandatory
                        If UCase(Replace(lControl.Tag, "_code", "_desc", , , vbTextCompare)) Like UCase(ao_grid.Columns(ll_Idx).Name) Then
                            If Not lControl.SelectedItem Is Nothing Then
                                ls_ColInfo(ll_Idx) = lControl.SelectedItem.GetData(1)
                            Else
                                ls_ColInfo(ll_Idx) = ""
                            
                            End If
                            Select Case UCase(lControl.Name)
                                Case "CBO_SALESEST_MATERIAL", "CBO_CHANNEL_PE_BM"
                                     ls_ColInfo(ao_grid.Columns("SBM_desc").ColumnIndex) = lControl.SelectedItem.GetData(3)
                            End Select
                            
                        End If
                    Case "OPTIONBUTTON" ', "ARMTREEVIEW", "LISTBOX", "PICTUREBOX"Else '"A_CALOCX",
                        lValues = Split(lControl.Tag, SEP)
                        If UBound(lValues) > 0 Then
                            If UCase(lValues(0)) Like UCase(ao_grid.Columns(ll_Idx).Name) And lControl.value = True Then ls_ColInfo(ll_Idx) = lValues(2)
                        End If
                    Case "ARMGRID"
                    
                        If UCase(lControl.Tag) Like UCase(ao_grid.Columns(ll_Idx).Name) Then
                            If lControl.Rows > 0 Then
                                ls_ColInfo(ll_Idx) = "X"
                            Else
                                ls_ColInfo(ll_Idx) = ""
                            End If
                        End If
                        
                End Select
            End If
            Set lControl = Nothing
        Next
    Next ll_Idx
    
    Select Case UCase(aContainer.Tag)
        Case "CD_SWOT"
            ls_ColInfo(ao_grid.Columns("Z_Last_upd").ColumnIndex) = Format(Date, "DD/MM/YYYY")
        Case "CD_FINANCIAL"
            If ml_tbsidx = 1 Then ls_ColInfo(ao_grid.Columns("Level").ColumnIndex) = "STRAT"
    End Select
    
    
    ls_ColInfo(0) = txt_key(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame).Text
    
    If mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ExistAttach Then
        If grd_Attachments.Rows > 0 Then
            ls_ColInfo(ll_nbcol) = "X"
        End If
    End If
    
    ao_grid.AddLine ls_ColInfo
    
    Item_AddLocal = True
    Exit Function
errHandler:
    If Not lControl Is Nothing Then Set lControl = Nothing
    Call ErrorHandler("Item_AddLocal")
   
End Function




'

Private Function Item_Check(ByVal al_InfoArrayIndex As Long) As Boolean
On Error GoTo errHandler
    Dim lv_MsgReplaceInfo() As String
    Dim ll_IsNum As Long 'if 0 then ok
    
    'select case to manage the different records
    Select Case UCase(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame)
        Case "CD_SALESEST_C", "CD_SALESEST_S"
            ll_IsNum = 0
            
            ll_IsNum = CheckNumericField(txt_SalesEst_Quantity, 0, 0, 999999999)
            If ll_IsNum <> 0 Then
                ReDim lv_MsgReplaceInfo(2, 1)
                lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                lv_MsgReplaceInfo(0, 1) = lbl_label(116).Caption
                lv_MsgReplaceInfo(1, 0) = "$Min$"
                lv_MsgReplaceInfo(1, 1) = 0
                lv_MsgReplaceInfo(2, 0) = "$Max$"
                lv_MsgReplaceInfo(2, 1) = FormatNumber(999999999, 0)
                GoTo errMessage
            End If
            
            ll_IsNum = CheckNumericField(txt_SalesEst_Value, 0, 0, 9999999999#)
            If ll_IsNum <> 0 Then
                ReDim lv_MsgReplaceInfo(2, 1)
                lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                lv_MsgReplaceInfo(0, 1) = lbl_label(117).Caption
                lv_MsgReplaceInfo(1, 0) = "$Min$"
                lv_MsgReplaceInfo(1, 1) = 0
                lv_MsgReplaceInfo(2, 0) = "$Max$"
                lv_MsgReplaceInfo(2, 1) = FormatNumber(9999999999#, 0)
                GoTo errMessage
            End If
                        
        Case "CD_SWOT"
            If Trim(txt_SWOT_Strength.Text) = "" And Trim(txt_SWOT_Weakness.Text) = "" And Trim(txt_SWOT_Opportunity.Text) = "" And Trim(txt_SWOT_Threat.Text) = "" Then
                Call MsgBox(MsgText(2123, ms_Language_Code, "#You must fill at least one of the fields (Strenght, or Weakness or Oppotinity or Threat)"), vbInformation)
                txt_SWOT_Strength.SetFocus
                Exit Function
            End If
            
        Case "CD_SERVICES"
            If opt_Services_TechSupport(0).value = True And Trim(txt_Services_Tech_Support.Text) = "" And cbo_Services_TechSupportRating.SelectedItem Is Nothing Then
                Call MsgBox(MsgText(2124, ms_Language_Code, "#You set the tech support to Yes. You must select a rating and fill the field."), vbInformation)
                cbo_Services_TechSupportRating.SetFocus
                Exit Function
            End If
            
            If opt_Services_TechSupport(0).value = True And Trim(txt_Services_Tech_Support.Text) = "" Then
                Call MsgBox(MsgText(2125, ms_Language_Code, "#You set the tech support to Yes. You must fill the field."), vbInformation)
                txt_Services_Tech_Support.SetFocus
                Exit Function
            End If
            
            If opt_Services_TechSupport(0).value = True And cbo_Services_TechSupportRating.SelectedItem Is Nothing Then
                Call MsgBox(MsgText(2126, ms_Language_Code, "#You set the tech support to Yes. You must select a rating."), vbInformation)
                cbo_Services_TechSupportRating.SetFocus
                Exit Function
            End If
            
            If opt_Services_Warranty(0).value = True And Trim(txt_Services_Warranty.Text) = "" Then
                Call MsgBox(MsgText(2127, ms_Language_Code, "#You set the warranty to Yes. You must fill the field."), vbInformation)
                txt_Services_Warranty.SetFocus
                Exit Function
            End If
            
        Case "CD_ATTACHMENTS"
            If Trim(txt_Attachment_File.Text) = "" Then
                Call MsgBox(MsgText(2128, ms_Language_Code, "#You must select a file."), vbInformation)
                Exit Function
            End If
            
        
        Case "CD_PRODUCTS_C", "CD_PRODUCTS_C"
            ll_IsNum = 0
            
            ll_IsNum = CheckNumericField(txt_Product_Price, 2, 0, 999.99)
            If ll_IsNum <> 0 Then
                ReDim lv_MsgReplaceInfo(2, 1)
                lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                lv_MsgReplaceInfo(0, 1) = lbl_label(160).Caption
                lv_MsgReplaceInfo(1, 0) = "$Min$"
                lv_MsgReplaceInfo(1, 1) = 0
                lv_MsgReplaceInfo(2, 0) = "$Max$"
                lv_MsgReplaceInfo(2, 1) = FormatNumber(999.99, 2)
                GoTo errMessage
            End If
            
            ll_IsNum = CheckNumericField(txt_Product_Volume, 0, 0, 99999999)
            If ll_IsNum <> 0 Then
                ReDim lv_MsgReplaceInfo(2, 1)
                lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                lv_MsgReplaceInfo(0, 1) = lbl_label(162).Caption
                lv_MsgReplaceInfo(1, 0) = "$Min$"
                lv_MsgReplaceInfo(1, 1) = 0
                lv_MsgReplaceInfo(2, 0) = "$Max$"
                lv_MsgReplaceInfo(2, 1) = FormatNumber(99999999, 0)
                GoTo errMessage
            End If
            
        Case "CD_CHANNEL"
            Select Case cbo_Channel_Type.SelectedItem.GetData(0)
                Case 1 'Local Alliance
                    If Len(Trim(txt_Channel_Name.Text)) = 0 Then
                        ReDim lv_MsgReplaceInfo(0, 1)
                        lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                        lv_MsgReplaceInfo(0, 1) = lbl_label(310).Caption
                        Call MsgBox(MsgText(2120, ms_Language_Code, "The field " & lv_MsgReplaceInfo(0, 1) & " is mandatory.", lv_MsgReplaceInfo), vbInformation)
                        txt_Channel_Name.SetFocus
                        Exit Function
                    End If
                    
                    
                Case 2 'Channel Split
                
                    If cbo_Channel_Category.SelectedItem Is Nothing Then
                        ReDim lv_MsgReplaceInfo(0, 1)
                        lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                        lv_MsgReplaceInfo(0, 1) = lbl_label(312).Caption
                        Call MsgBox(MsgText(2120, ms_Language_Code, "The field " & lv_MsgReplaceInfo(0, 1) & " is mandatory.", lv_MsgReplaceInfo), vbInformation)
                        cbo_Channel_Category.SetFocus
                        Exit Function
                    End If
                    
                    Dim li_SumPercent As Integer
                    li_SumPercent = 0
                    
                    ll_IsNum = 0
                    
                    ll_IsNum = CheckNumericField(txt_Channel_percent_Distributor, 0, 0, 100)
                    If ll_IsNum <> 0 Then
                        ReDim lv_MsgReplaceInfo(2, 1)
                        lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                        lv_MsgReplaceInfo(0, 1) = lbl_label(314).Caption
                        lv_MsgReplaceInfo(1, 0) = "$Min$"
                        lv_MsgReplaceInfo(1, 1) = 0
                        lv_MsgReplaceInfo(2, 0) = "$Max$"
                        lv_MsgReplaceInfo(2, 1) = FormatNumber(100, 0)
                        GoTo errMessage
                    End If
                    
                    li_SumPercent = li_SumPercent + CInt(Trim(txt_Channel_percent_Distributor.Text))
                    
                    ll_IsNum = CheckNumericField(txt_Channel_percent_Contractor, 0, 0, 100)
                    If ll_IsNum <> 0 Then
                        ReDim lv_MsgReplaceInfo(2, 1)
                        lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                        lv_MsgReplaceInfo(0, 1) = lbl_label(315).Caption
                        lv_MsgReplaceInfo(1, 0) = "$Min$"
                        lv_MsgReplaceInfo(1, 1) = 0
                        lv_MsgReplaceInfo(2, 0) = "$Max$"
                        lv_MsgReplaceInfo(2, 1) = FormatNumber(100, 0)
                        GoTo errMessage
                    End If
                    
                    li_SumPercent = li_SumPercent + CInt(Trim(txt_Channel_percent_Contractor.Text))
                    
                    ll_IsNum = CheckNumericField(txt_Channel_percent_Strat_Accounts, 0, 0, 100)
                    If ll_IsNum <> 0 Then
                        ReDim lv_MsgReplaceInfo(2, 1)
                        lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                        lv_MsgReplaceInfo(0, 1) = lbl_label(316).Caption
                        lv_MsgReplaceInfo(1, 0) = "$Min$"
                        lv_MsgReplaceInfo(1, 1) = 0
                        lv_MsgReplaceInfo(2, 0) = "$Max$"
                        lv_MsgReplaceInfo(2, 1) = FormatNumber(100, 0)
                        GoTo errMessage
                    End If
                    
                    li_SumPercent = li_SumPercent + CInt(Trim(txt_Channel_percent_Strat_Accounts.Text))
                                        
                    ll_IsNum = CheckNumericField(txt_Channel_percent_Main_Contractor, 0, 0, 100)
                    If ll_IsNum <> 0 Then
                        ReDim lv_MsgReplaceInfo(2, 1)
                        lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                        lv_MsgReplaceInfo(0, 1) = lbl_label(317).Caption
                        lv_MsgReplaceInfo(1, 0) = "$Min$"
                        lv_MsgReplaceInfo(1, 1) = 0
                        lv_MsgReplaceInfo(2, 0) = "$Max$"
                        lv_MsgReplaceInfo(2, 1) = FormatNumber(100, 0)
                        GoTo errMessage
                    End If
                    
                    li_SumPercent = li_SumPercent + CInt(Trim(txt_Channel_percent_Main_Contractor.Text))
                    
                    ll_IsNum = CheckNumericField(txt_Channel_percent_End_User, 0, 0, 100)
                    If ll_IsNum <> 0 Then
                        ReDim lv_MsgReplaceInfo(2, 1)
                        lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                        lv_MsgReplaceInfo(0, 1) = lbl_label(318).Caption
                        lv_MsgReplaceInfo(1, 0) = "$Min$"
                        lv_MsgReplaceInfo(1, 1) = 0
                        lv_MsgReplaceInfo(2, 0) = "$Max$"
                        lv_MsgReplaceInfo(2, 1) = FormatNumber(100, 0)
                        GoTo errMessage
                    End If
                    
                    li_SumPercent = li_SumPercent + CInt(Trim(txt_Channel_percent_End_User.Text))
                    
                    If li_SumPercent > 100 Then
                        Call MsgBox(MsgText(2129, ms_Language_Code, "#You can not have more than 100% split between the channel types."), vbInformation)
                        txt_Channel_percent_Distributor.SetFocus
                        Exit Function
                    End If
                    
                    txt_Channel_Name.Text = "%Dist " & Trim(txt_Channel_percent_Distributor.Text) & _
                                    " %Cont " & Trim(txt_Channel_percent_Contractor.Text) & _
                                    " %SA " & Trim(txt_Channel_percent_Strat_Accounts.Text) & _
                                    " %MC " & Trim(txt_Channel_percent_Main_Contractor.Text) & _
                                    " %EndU " & Trim(txt_Channel_percent_End_User.Text)

                    
                Case 3 'Key Customer
                    If Len(Trim(txt_Channel_Name.Text)) = 0 Then
                        ReDim lv_MsgReplaceInfo(0, 1)
                        lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                        lv_MsgReplaceInfo(0, 1) = lbl_label(310).Caption
                        Call MsgBox(MsgText(2120, ms_Language_Code, "The field " & lv_MsgReplaceInfo(0, 1) & " is mandatory.", lv_MsgReplaceInfo), vbInformation)
                        txt_Channel_Name.SetFocus
                        Exit Function
                    End If
            
                    ll_IsNum = 0
                    
                    ll_IsNum = CheckNumericField(txt_Channel_percent_of_Turnover, 0, 0, 100)
                    If ll_IsNum <> 0 Then
                        ReDim lv_MsgReplaceInfo(2, 1)
                        lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                        lv_MsgReplaceInfo(0, 1) = lbl_label(311).Caption
                        lv_MsgReplaceInfo(1, 0) = "$Min$"
                        lv_MsgReplaceInfo(1, 1) = 0
                        lv_MsgReplaceInfo(2, 0) = "$Max$"
                        lv_MsgReplaceInfo(2, 1) = FormatNumber(100, 0)
                        GoTo errMessage
                    End If
            
            End Select
            
        Case "CD_CHANNEL_PE"
            ll_IsNum = 0
            
            ll_IsNum = CheckNumericField(txt_Channel_PE_Quantity, 0, 0, 99999999)
            If ll_IsNum <> 0 Then
                ReDim lv_MsgReplaceInfo(2, 1)
                lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                lv_MsgReplaceInfo(0, 1) = lbl_label(473).Caption
                lv_MsgReplaceInfo(1, 0) = "$Min$"
                lv_MsgReplaceInfo(1, 1) = 0
                lv_MsgReplaceInfo(2, 0) = "$Max$"
                lv_MsgReplaceInfo(2, 1) = FormatNumber(99999999, 0)
                GoTo errMessage
            End If
            
            ll_IsNum = CheckNumericField(txt_Channel_PE_Value, 0, 0, 999999999)
            If ll_IsNum <> 0 Then
                ReDim lv_MsgReplaceInfo(2, 1)
                lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                lv_MsgReplaceInfo(0, 1) = lbl_label(474).Caption
                lv_MsgReplaceInfo(1, 0) = "$Min$"
                lv_MsgReplaceInfo(1, 1) = 0
                lv_MsgReplaceInfo(2, 0) = "$Max$"
                lv_MsgReplaceInfo(2, 1) = FormatNumber(999999999, 0)
                GoTo errMessage
            End If
        
        Case "CD_SALESORG_C"
            ll_IsNum = 0
            
            ll_IsNum = CheckNumericField(txt_SalesOrg_NbofOffices, 0, 0, 99)
            If ll_IsNum <> 0 Then
                ReDim lv_MsgReplaceInfo(2, 1)
                lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                lv_MsgReplaceInfo(0, 1) = lbl_label(5).Caption
                lv_MsgReplaceInfo(1, 0) = "$Min$"
                lv_MsgReplaceInfo(1, 1) = 0
                lv_MsgReplaceInfo(2, 0) = "$Max$"
                lv_MsgReplaceInfo(2, 1) = FormatNumber(99, 0)
                GoTo errMessage
            End If
            
            ll_IsNum = CheckNumericField(txt_SalesOrg_NbofManagers, 0, 0, 999)
            If ll_IsNum <> 0 Then
                ReDim lv_MsgReplaceInfo(2, 1)
                lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                lv_MsgReplaceInfo(0, 1) = lbl_label(7).Caption
                lv_MsgReplaceInfo(1, 0) = "$Min$"
                lv_MsgReplaceInfo(1, 1) = 0
                lv_MsgReplaceInfo(2, 0) = "$Max$"
                lv_MsgReplaceInfo(2, 1) = FormatNumber(999, 0)
                GoTo errMessage
            End If
            
            
            ll_IsNum = CheckNumericField(txt_SalesOrg_NbofReps, 0, 0, 9999)
            If ll_IsNum <> 0 Then
                ReDim lv_MsgReplaceInfo(2, 1)
                lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                lv_MsgReplaceInfo(0, 1) = lbl_label(8).Caption
                lv_MsgReplaceInfo(1, 0) = "$Min$"
                lv_MsgReplaceInfo(1, 1) = 0
                lv_MsgReplaceInfo(2, 0) = "$Max$"
                lv_MsgReplaceInfo(2, 1) = FormatNumber(9999, 0)
                GoTo errMessage
            End If
                
'            If CInt(Trim(txt_SalesOrg_NbofReps)) < grd_SalesOrg_SalesReps.Rows Then
'              Call MsgBox(MsgText(2130, ms_Language_Code, "#The number of Sales Reps has to be greater than or equal to the number of reps attached to the record." & vbCrLf & "You must change this number or add/delete some Sales Reps attached."), vbInformation)
'              txt_SalesOrg_NbofReps.SelStart = 0
'              txt_SalesOrg_NbofReps.SelLength = Len(txt_SalesOrg_NbofReps.Text)
'              txt_SalesOrg_NbofReps.SetFocus
'              Exit Function
'            End If
        
        Case "CD_FINANCIAL_C", "CD_FINANCIAL_S"
        
            ll_IsNum = 0
            ll_IsNum = CheckNumericField(txt_Financial_TurnOver, 0, -999999999999#, 999999999999#)
            If ll_IsNum <> 0 Then
                ReDim lv_MsgReplaceInfo(2, 1)
                lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                lv_MsgReplaceInfo(0, 1) = lbl_label(210).Caption
                lv_MsgReplaceInfo(1, 0) = "$Min$"
                lv_MsgReplaceInfo(1, 1) = FormatNumber(-999999999999#, 0)
                lv_MsgReplaceInfo(2, 0) = "$Max$"
                lv_MsgReplaceInfo(2, 1) = FormatNumber(999999999999#, 0)
                GoTo errMessage
            End If
            
            ll_IsNum = 0
            ll_IsNum = CheckNumericField(txt_Financial_Profit_Loss, 0, -999999999999#, 999999999999#)
            If ll_IsNum <> 0 Then
                ReDim lv_MsgReplaceInfo(2, 1)
                lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                lv_MsgReplaceInfo(0, 1) = lbl_label(211).Caption
                lv_MsgReplaceInfo(1, 0) = "$Min$"
                lv_MsgReplaceInfo(1, 1) = FormatNumber(-999999999999#, 0)
                lv_MsgReplaceInfo(2, 0) = "$Max$"
                lv_MsgReplaceInfo(2, 1) = FormatNumber(999999999999#, 0)
                GoTo errMessage
            End If
                                   
            ll_IsNum = 0
            ll_IsNum = CheckNumericField(txt_Financial_Profit_Margin, 2, -100, 100)
            If ll_IsNum <> 0 Then
                ReDim lv_MsgReplaceInfo(2, 1)
                lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                lv_MsgReplaceInfo(0, 1) = lbl_label(212).Caption
                lv_MsgReplaceInfo(1, 0) = "$Min$"
                lv_MsgReplaceInfo(1, 1) = FormatNumber(-100, 2)
                lv_MsgReplaceInfo(2, 0) = "$Max$"
                lv_MsgReplaceInfo(2, 1) = FormatNumber(100, 2)
                GoTo errMessage
            End If
                        
            ll_IsNum = 0
            ll_IsNum = CheckNumericField(txt_Financial_Number_of_Employees, 0, 0, 999999)
            If ll_IsNum <> 0 Then
                ReDim lv_MsgReplaceInfo(2, 1)
                lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                lv_MsgReplaceInfo(0, 1) = lbl_label(218).Caption
                lv_MsgReplaceInfo(1, 0) = "$Min$"
                lv_MsgReplaceInfo(1, 1) = 0
                lv_MsgReplaceInfo(2, 0) = "$Max$"
                lv_MsgReplaceInfo(2, 1) = FormatNumber(999999, 0)
                GoTo errMessage
            End If
            
            Dim ld_rate As Double
            Dim lc_rate As Long
            
            Dim lValues As Variant
            
            If cbo_Financial_Fin_Currency.SelectedItem.GetData(0) <> "EUR" Then
                'lc_rate = mo_Db.OpenSQL("exec MKT_EURO_RATE '" & cbo_Financial_Fin_Currency.SelectedItem.GetData(0) & "', " & cbo_Financial_Year.SelectedItem.GetData(0))
                lc_rate = OpenSQLSafe(mo_Db, "exec MKT_EURO_RATE '" & cbo_Financial_Fin_Currency.SelectedItem.GetData(0) & "', " & cbo_Financial_Year.SelectedItem.GetData(0))
                ld_rate = mo_Db.GetFields(lc_rate, 0)
                mo_Db.Close (lc_rate)
                
                If ld_rate = 0 Then
                    ReDim lv_MsgReplaceInfo(0, 1)
                    lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                    lv_MsgReplaceInfo(0, 1) = lbl_label(213).Caption
                    If MsgBox(MsgText(2141, ms_Language_Code, "#There is not exchange rate for euro for this year. The $LabelCaption$ is zero. Would you like to continue ?", lv_MsgReplaceInfo), vbInformation + vbYesNo) = vbNo Then
                        Item_Check = False
                        Exit Function
                    End If
                End If
                
                
                If ld_rate <> 0 Then
                    txt_Financial_Turnover_Euro.Text = Format(CDbl(txt_Financial_TurnOver.Text) / ld_rate, "0")
                Else
                    txt_Financial_Turnover_Euro.Text = 0
                End If
            Else
                txt_Financial_Turnover_Euro.Text = txt_Financial_TurnOver.Text
            End If
            
            If cbo_Financial_Fin_PL_Currency.SelectedItem.GetData(0) <> "EUR" Then
                'lc_rate = mo_Db.OpenSQL("exec MKT_EURO_RATE '" & cbo_Financial_Fin_PL_Currency.SelectedItem.GetData(0) & "', " & cbo_Financial_Year.SelectedItem.GetData(0))
                lc_rate = OpenSQLSafe(mo_Db, "exec MKT_EURO_RATE '" & cbo_Financial_Fin_PL_Currency.SelectedItem.GetData(0) & "', " & cbo_Financial_Year.SelectedItem.GetData(0))
                ld_rate = mo_Db.GetFields(lc_rate, "Rate")
                
                mo_Db.Close (lc_rate)
                
                If ld_rate = 0 Then
                    ReDim lv_MsgReplaceInfo(0, 1)
                    lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                    lv_MsgReplaceInfo(0, 1) = lbl_label(214).Caption
                    If MsgBox(MsgText(2141, ms_Language_Code, "#There is not exchange rate for euro for this year. The $LabelCaption$ is zero. Would you like to continue ?", lv_MsgReplaceInfo), vbInformation + vbYesNo) = vbNo Then
                        Item_Check = False
                        Exit Function
                    End If
                End If
                If ld_rate <> 0 Then
                    lValues = Split(txt_Financial_Profit_Loss_Euro.Tag, SEP)
                    txt_Financial_Profit_Loss_Euro.Text = Format(CDbl(txt_Financial_Profit_Loss.Text) / ld_rate, "0")
                Else
                    txt_Financial_Profit_Loss_Euro.Text = 0
                End If
            Else
                txt_Financial_Profit_Loss_Euro.Text = txt_Financial_Profit_Loss.Text
            End If
           
            
        Case "CD_PRODUCTION"
            If cbo_Production_Type.SelectedItem.GetData(0) = 1 Then
                ll_IsNum = 0
                ll_IsNum = CheckNumericField(txt_Production_Capacity, 0, 0, 9999999999#)
                If ll_IsNum <> 0 Then
                    ReDim lv_MsgReplaceInfo(2, 1)
                    lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
                    lv_MsgReplaceInfo(0, 1) = lbl_label(433).Caption
                    lv_MsgReplaceInfo(1, 0) = "$Min$"
                    lv_MsgReplaceInfo(1, 1) = 0
                    lv_MsgReplaceInfo(2, 0) = "$Max$"
                    lv_MsgReplaceInfo(2, 1) = FormatNumber(9999999999#, 0)
                    GoTo errMessage
                End If
            End If
    End Select
    
errMessage:
    Select Case ll_IsNum
        Case 2131
            Call MsgBox(MsgText(ll_IsNum, ms_Language_Code, "#The field " & lv_MsgReplaceInfo(0, 1) & " must be numeric.", lv_MsgReplaceInfo), vbInformation)
            Exit Function
        Case 2134
            Call MsgBox(MsgText(ll_IsNum, ms_Language_Code, "#The field " & lv_MsgReplaceInfo(0, 1) & " does not accept decimal number.", lv_MsgReplaceInfo), vbInformation)
            Exit Function
        Case 2132
            Call MsgBox(MsgText(ll_IsNum, ms_Language_Code, "#The field " & lv_MsgReplaceInfo(0, 1) & " must be a number between " & lv_MsgReplaceInfo(1, 1) & " and " & lv_MsgReplaceInfo(2, 1) & ".", lv_MsgReplaceInfo), vbInformation)
            Exit Function
            
    End Select
    
    Item_Check = True
    Exit Function
    
errHandler:
    mo_Db.Close (lc_rate)
    Call ErrorHandler("Item_Check")


End Function


Private Sub GotoPreviousItem(ByRef ao_grid As ArmGrid)
On Error GoTo errHandler
    
    If Not ao_grid.PreviousItem Then
        Call MsgBox(MsgText(927, ms_Language_Code, "#No more previous item"), vbInformation)
    Else
        Refresh_ToolbarDetail
        Call LoadDetailFrame
    End If
    
    Exit Sub
    
errHandler:
    Call ErrorHandler("GotoPreviousItem")
   
End Sub

Private Sub GotoNextItem(ByRef ao_grid As ArmGrid)
On Error GoTo errHandler

    If Not ao_grid.NextItem Then
        Call MsgBox(MsgText(928, ms_Language_Code, "#No more next item"), vbInformation)
    Else
        Refresh_ToolbarDetail
        Call LoadDetailFrame
    End If
    
    Exit Sub

errHandler:
    Call ErrorHandler("GotoNextItem")
    
End Sub


Private Sub Refresh_ToolbarDetail()
On Error GoTo errHandler
    
    'TODO: Refresh the toolbar hide or unhide buttons
    
    Exit Sub

errHandler:
    Call ErrorHandler("Refresh_ToolbarDetail")

End Sub

Private Function ApplyTVFilters(ByVal aRequest As Variant) As Variant
On Error GoTo errHandler
    Dim lRequests As Variant
    If IsArray(aRequest) Then
        ReDim lRequests(UBound(aRequest))
        Dim lIdx As Long, lCount As Long
        lCount = UBound(lRequests)
        For lIdx = 0 To lCount
            lRequests(lIdx) = ReplaceTVFiltersHolders(aRequest(lIdx))
        Next
    Else
        ReDim lRequests(0)
        lRequests(0) = ReplaceTVFiltersHolders(aRequest)
    End If

    ApplyTVFilters = lRequests
    Exit Function

errHandler:
    Call ErrorHandler("ApplyTVFilters")
    
End Function

Private Function ReplaceTVFiltersHolders(ByVal as_Request As String) As String
On Error GoTo errHandler
    ' For date, there is three params
    Dim ls_Request As String
    Dim ls_DateType As String, ls_DateMin As String, ls_DateMax As String

    If opt_FiltersDate(0).value Then
        ls_DateType = "null"
        ls_DateMin = "null"
        ls_DateMax = "null"
    End If
    
    If opt_FiltersDate(1).value Then
        ls_DateType = cbo_FiltersDate.SelectedItem.GetData(0)
        ls_DateMin = IIf(cal_FiltersMin.date_us <> "", "'" & cal_FiltersMin.date_us & "'", "null")
        ls_DateMax = IIf(cal_filtersMax.date_us <> "", "'" & cal_filtersMax.date_us & "'", "null")
    End If

    ls_Request = Replace(as_Request, "$datetype$", ls_DateType, , , vbTextCompare)
    ls_Request = Replace(ls_Request, "$datemin$", ls_DateMin, , , vbTextCompare)
    ls_Request = Replace(ls_Request, "$datemax$", ls_DateMax, , , vbTextCompare)

    
    If Opt_FiltersType.Item(0).value Then
        ls_Request = Replace(ls_Request, "$itemtype$", "C")
    End If
    If Opt_FiltersType.Item(1).value Then
        ls_Request = Replace(ls_Request, "$itemtype$", "S")
    End If

    ReplaceTVFiltersHolders = ls_Request
    Exit Function

errHandler:
    Call ErrorHandler("ReplaceTVFiltersHolders")
   
End Function



Private Sub LoadCurrentTVSelection()
On Error GoTo errHandler
    
    If tv_filter.Checkboxes = True Then
        grd_List.Requests = ApplyTVFilters(tv_filter.CheckedNodesRequests)
    Else
        grd_List.Requests = ApplyTVFilters(tv_filter.SelectedNodeRequest)
    End If
    
    If grd_List.Execute = False Then
        'Error
    End If
    
    me_CurrentTvwSelMethod = IIf(tv_filter.Checkboxes, eTvwSelMethod.etmCheckBoxes, eTvwSelMethod.etmBranch)
    Exit Sub

errHandler:
    Call ErrorHandler("LoadCurrentTVSelection")
   
End Sub
Private Sub SetMode(ByVal aMode As eMode)
    me_OldMode = me_Mode
    me_Mode = aMode
End Sub


Private Sub tlb_Products_action(ByVal as_Role As String, as_Language As String)
On Error GoTo errHandler
    
    Call LockScreen(True)

    Dim ll_InfoArrayIndex As Long
    ll_InfoArrayIndex = GetInfoArrayIndex("CD_Channel_PE")
    
    Select Case as_Role
        
        Case "A"
            ' Want to add an item
            Call Item_AddInit_Channel_PE(ll_InfoArrayIndex)
        Case "B"
            ' Want to update the item
            If grd_Products.SelectedCount <= 0 Then GoTo CleanUp
'            fra_detail.Visible = False
'            fra_filter.Visible = False
'            fra_list.Visible = False
'            fra_item.Visible = False
            Call Item_UpdateInit_Channel_PE(ll_InfoArrayIndex, grd_Products.SelectedLine(0, "MKT_CHNL_PE_Key"))
            
        Case "C"
            ' Want to delete
            If grd_Products.SelectedCount <= 0 Then GoTo CleanUp
            'fra_detail.Visible = False
            'fra_filter.Visible = False
            'fra_list.Visible = False
            fra_item.Visible = False
            Call Item_DeleteInit_Channel_PE(ll_InfoArrayIndex, grd_Products.SelectedLine(0, "MKT_CHNL_PE_Key"))
            
        Case "F"
            ' Want to Reload the grid
            grd_Products.Refresh
        
        Case "S"
            'Want to aggregate the grid
            Call InitializedSubItemGrid(grd_Products, 1, ll_InfoArrayIndex)
            Call LoadLabels(UserControl.Controls, Fra_Products, SCREEN_NAME & "_" & Fra_Products.Tag & "_Agg", ms_Language_Code)
            Call HandleToolbar(tlb_Products, "1", True)
                    
        Case "m"
            Call InitializedSubItemGrid(grd_Products, 0, ll_InfoArrayIndex)
            Call LoadLabels(UserControl.Controls, Fra_Products, SCREEN_NAME & "_" & Fra_Products.Tag, ms_Language_Code)
            Call HandleToolbar(tlb_Products, "0", mb_IsUpdater)
        
        Case "l"
            'delete local from grid
            Call Item_DeleteLocal(grd_Products, grd_Products.SelectedLine(0, "MKT_CHNL_PE_Key"), False)
        
    End Select
CleanUp:
    Call LockScreen(False)

    Exit Sub
    
errHandler:
    DBLog "tlb_Products_action"
    Call LockScreen(False)
    Select Case Err.Number - C_ERRORRAISE
    Case "202"
        MsgBox MsgText(202, ms_Language_Code, "#The item you have added/updated couldn't be displayed with the current criteria set."), vbInformation + vbOKOnly
    Case "927":
        MsgBox MsgText(927, ms_Language_Code, "#No more previous item"), vbInformation
    Case "928":
        MsgBox MsgText(928, ms_Language_Code, "#No more next item"), vbInformation
    Case "2135":
        MsgBox MsgText(2135, ms_Language_Code, "Unable to update the record."), vbInformation
    Case "2136"
        MsgBox MsgText(2136, ms_Language_Code, "Unable to delete the record."), vbInformation
    Case "2137":
        MsgBox MsgText(2137, ms_Language_Code, "Unable to add the record."), vbInformation
    Case "2138":
        MsgBox MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation
    Case Else
        MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation
    End Select

End Sub

Private Sub tlb_SalesReps_action(ByVal as_Role As String, as_Language As String)
On Error GoTo errHandler

    Call LockScreen(True)
    
    Dim ll_InfoArrayIndex As Long
    ll_InfoArrayIndex = GetInfoArrayIndex("CD_SalesReps")
    
    Select Case as_Role
        
        Case "A"
            ' Want to add an item
            Call Item_AddInit_SalesReps(ll_InfoArrayIndex)
        Case "B"
            ' Want to update the item
            If grd_SalesOrg_SalesReps.SelectedCount <= 0 Then GoTo CleanUp
            fra_detail.Visible = False
            'fra_filter.Visible = False
            fra_list.Visible = False
            fra_item.Visible = False
            Call Item_UpdateInit_SalesReps(ll_InfoArrayIndex, grd_SalesOrg_SalesReps.SelectedKey(0)(0))
        
        Case "C"
            ' Want to delete
            If grd_SalesOrg_SalesReps.SelectedCount <= 0 Then GoTo CleanUp
            fra_detail.Visible = False
            'fra_filter.Visible = False
            fra_list.Visible = False
            fra_item.Visible = False
            Call Item_DeleteInit_SalesReps(ll_InfoArrayIndex, grd_SalesOrg_SalesReps.SelectedKey(0)(0))
        
        Case "F"
            ' Want to Reload the grid
            Call grd_SalesOrg_SalesReps.Load("exec MKT_SO_People_lst " & mo_Db.GetFields(ml_Cursor, "MKT_SO_Key"), True)
    
        Case "l"
            'delete local from grid
            Call Item_DeleteLocal(grd_SalesOrg_SalesReps, grd_SalesOrg_SalesReps.SelectedLine(0, "MKT_SOPeople_Key"), False)

    End Select
    
CleanUp:
    Call LockScreen(False)
    
    Exit Sub
    
errHandler:
    DBLog "tlb_SalesReps_action"
    Call LockScreen(False)
    Select Case Err.Number
    Case 202
        MsgBox MsgText(202, ms_Language_Code, "#The item you have added/updated couldn't be displayed with the current criteria set."), vbInformation + vbOKOnly
    Case 927:
        MsgBox MsgText(927, ms_Language_Code, "#No more previous item"), vbInformation
    Case 928:
        MsgBox MsgText(928, ms_Language_Code, "#No more next item"), vbInformation
    Case 2135:
        MsgBox MsgText(2135, ms_Language_Code, "Unable to update the record."), vbInformation
    Case 2136
        MsgBox MsgText(2136, ms_Language_Code, "Unable to delete the record."), vbInformation
    Case 2137:
        MsgBox MsgText(2137, ms_Language_Code, "Unable to add the record."), vbInformation
    Case 2138 + C_ERRORRAISE:
        MsgBox MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation
    Case Else
        MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation
    End Select
End Sub

Private Sub tv_filter_CheckboxesChange(Checkboxes As Boolean)
On Error GoTo errHandler

    Call LockScreen(True)
    
    If Checkboxes Then
        Call tv_filter_NodeClick(Nothing)
    Else
    grd_List.Requests = ""
    grd_List.ClearGrid
        If Not tv_filter.SelectedItem Is Nothing Then
            tv_filter.SelectedItem.Selected = False
        End If
    End If
    
CleanUp:
    Call LockScreen(False)
    Exit Sub

errHandler:
    DBLog "tv_filter_CheckboxesChange"
    Call LockScreen(False)
    MsgBox MsgText(2142, ms_Language_Code, "#There is a problem while loading treeview data."), vbInformation + vbOKOnly
    
End Sub

Private Sub tv_filter_NodeCheck(ByVal Node As MSComctlLib.Node)
    mb_TvwAfterCheck = True
End Sub


Private Sub tv_filter_NodeClick(ByVal Node As MSComctlLib.Node)
On Error GoTo errHandler
    
    If mb_internal Then Exit Sub
    
    Call LockScreen(True)
    
    Dim lv_Requests As Variant, lb_DelayedLoad As Boolean
    If tv_filter.Checkboxes Then
        If mb_TvwAfterCheck Then
            lv_Requests = ApplyTVFilters(tv_filter.CheckedNodesRequests)
            lb_DelayedLoad = True
            me_CurrentTvwSelMethod = eTvwSelMethod.etmCheckBoxes
            Call grd_List.Load(lv_Requests, False, , , lb_DelayedLoad)
            mb_TvwAfterCheck = False
        End If
    Else
        lv_Requests = ApplyTVFilters(tv_filter.SelectedNodeRequest)
        If (tv_filter.NodeInfo(Node).ml_Level = tv_filter.Levels - 1) Then
            lb_DelayedLoad = False
            me_CurrentTvwSelMethod = eTvwSelMethod.etmNode
        Else
            lb_DelayedLoad = True
            me_CurrentTvwSelMethod = eTvwSelMethod.etmBranch
        End If
        Call grd_List.Load(lv_Requests, False, , , lb_DelayedLoad)
    End If

    'If me_CurrentTvwSelMethod <> eTvwSelMethod.etmCheckBoxes Or Node Is Nothing Then
        
    'End If

    Call LockScreen(False)
    Exit Sub

errHandler:
    DBLog "tv_filter_NodeClick"
    Call LockScreen(False)
    MsgBox MsgText(2142, ms_Language_Code, "#There is a problem while loading treeview data."), vbInformation + vbOKOnly
End Sub


Private Sub RefreshList()

On Error GoTo errHandler
    
   mb_internal = True
    Dim lb_Grid As Boolean
    lb_Grid = (tv_filter.Checkboxes = True Or grd_List.Rows > 0)
   
    tv_filter.Refresh
    If lb_Grid Then
        Call LoadCurrentTVSelection
    End If
    
    mb_internal = False
    
    Exit Sub

errHandler:
    mb_internal = False
    Call ErrorHandler("RefreshList")
    
End Sub

Private Sub Item_ExitToGrid(ByVal al_InfoArrayIndex As Long)
    
On Error GoTo errHandler
    
    If ml_Cursor > 0 Then
        mo_Db.Close (ml_Cursor)
        ml_Cursor = 0
    End If
    
    fra_record(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame).Visible = False
    
    Select Case me_OldMode
        Case emList
            fra_item.Visible = False
            mb_internal = True
            tbs_selector(ml_tbsidx).Tabs(1).Selected = True
            mb_internal = False
            fra_list.Visible = True
            fra_list.ZOrder
            fra_filter.Visible = True
            fra_filter.ZOrder
            Call EnableFrame(UserControl.Controls, fra_filter, True)
            Call EnableFrame(UserControl.Controls, fra_list, True)
            Call SetMode(emList)
            ml_MasterKey = 0
            ml_CurrentKey = 0
    
        Case emDetail
            fra_item.Visible = False
            fra_detail.Visible = True
            fra_detail.ZOrder
            fra_filter.Visible = True
            fra_filter.ZOrder
            Call SetMode(emDetail)
                
        Case Else
            
            Call DBLog("Item_ExitToGrid ::: Something is wrong with the Mode in Item_ExitToGrid :: FrameIndex = " & mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.IndexFrame & " :: FrameName = " & mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.NameFrame & " :: me_OldMode = " & me_OldMode & " :: me_Mode = " & me_Mode & " :: ml_MasterKey = " & ml_MasterKey & " :: ml_CurrentKey = " & ml_CurrentKey)
            
            fra_item.Visible = False
            mb_internal = True
            tbs_selector(ml_tbsidx).Tabs(1).Selected = True
            mb_internal = False
            fra_list.Visible = True
            fra_list.ZOrder
            fra_filter.Visible = True
            fra_filter.ZOrder
            Call EnableFrame(UserControl.Controls, fra_filter, True)
            Call EnableFrame(UserControl.Controls, fra_list, True)
            Call SetMode(emList)
            
            ml_MasterKey = 0
            ml_CurrentKey = 0
        
        End Select
    
    Exit Sub

errHandler:
    Call ErrorHandler("Item_ExitToGrid")
   
End Sub

Private Sub DisableFrameParts(ByVal al_InfoArrayIndex As Long)
On Error GoTo errHandler
    Dim lIdx As Long, lCount As Long
    Dim lParams As Variant
    
    lCount = UBound(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsToDisable)
    
    For lIdx = 0 To lCount
            Select Case UCase(TypeName(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsToDisable(lIdx)))
                Case "FRAME", "LABEL", "MSFLEXGRID", "TOOLBARCONTROL"
                    ' Do nothing !
                
                Case "TEXTBOX"
                        mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsToDisable(lIdx).Locked = True
                        mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsToDisable(lIdx).BackColor = CL_COLOR_DISABLED
                        
                Case "ARMGRID", "ARMCHECKVIEW"
                                    
                Case "OPTIONBUTTON", "COMMANDBUTTON", "ARMCOMBOBOX", "A_CALOCX", "ARMTREEVIEW", "LISTBOX", "PICTUREBOX", "TABSTRIP", "CHECKBOX"
                    mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsToDisable(lIdx).Enabled = False
                    
                Case Else
                    Debug.Print "DisableFrameParts " & UCase(TypeName(mt_ClassInfoLst(al_InfoArrayIndex).ConfigRecord.ListFieldsToDisable(lIdx)))
            End Select
    Next
    Exit Sub
errHandler:
    Call ErrorHandler("DisableFrameParts")

End Sub
Private Sub EnableFrame(ByRef aControls As Variant, ByRef aContainer As Object, ByVal aEnabled As Boolean)
On Error GoTo errHandler
    Dim lIdx As Long, lCount As Long
    Dim lControl As Control
    
    lCount = aControls.Count - 1
    
    For lIdx = 0 To lCount
        Set lControl = aControls.Item(lIdx)
        If HasContainer(lControl, aContainer) Then
            'Debug.Print "EnableFrame trace -> " & aContainer.Name & " -> " & UCase(TypeName(lControl))
            Select Case UCase(TypeName(lControl))
                Case "TOOLBARCONTROL"
                    lControl.Visible = aEnabled
                
                Case "FRAME", "LABEL", "MSFLEXGRID"
                    ' Do nothing !
                
                Case "TEXTBOX"
                    If aEnabled And (UCase(lControl.Name) Like "TXT_FINANCIAL_TURNOVER_EURO" Or UCase(lControl.Name) Like "TXT_FINANCIAL_PROFIT_LOSS_EURO" Or UCase(lControl.Name) Like "TXT_ATTACHMENT_FILE") Then
                        'Virer le not
                        lControl.Locked = aEnabled
                        lControl.BackColor = IIf(aEnabled, CL_COLOR_LOCKED, CL_COLOR_DISABLED)
                    Else
                        lControl.Locked = Not aEnabled
                        lControl.BackColor = IIf(aEnabled, CL_COLOR_ENABLED, CL_COLOR_DISABLED)
                    End If
                
                Case "ARMGRID", "ARMCHECKVIEW"
                    
                Case "DIRLISTBOX", "DRIVELISTBOX", "FILELISTBOX"
                    lControl.Enabled = aEnabled
                    lControl.BackColor = IIf(aEnabled, CL_COLOR_ENABLED, CL_COLOR_DISABLED)

                Case "COMMANDBUTTON", "ARMCOMBOBOX", "A_CALOCX", "OPTIONBUTTON", "ARMTREEVIEW", "LISTBOX", "PICTUREBOX", "TABSTRIP", "CHECKBOX"
                    lControl.Enabled = aEnabled
                Case Else
                    lControl.Enabled = aEnabled
                    Debug.Print "EnableFrame " & UCase(TypeName(lControl))
            End Select
        End If
        Set lControl = Nothing
    Next
    Exit Sub
errHandler:
    If Not lControl Is Nothing Then Set lControl = Nothing
    Call ErrorHandler("EnableFrame")

End Sub

Private Function HasContainer(ByRef aControl As Control, ByRef aContainer As Object) As Boolean
    
    HasContainer = False
    Dim lControl As Control
    
    Set lControl = aControl
    While Not (lControl Is Nothing)
        On Error GoTo NotFound
        If lControl.Container Is aContainer Then
            Set lControl = Nothing
            HasContainer = True
            Exit Function
        End If
        Set lControl = lControl.Container
    Wend

NotFound:
    Set lControl = Nothing
    HasContainer = False
End Function


Private Function GetTreeViewInfo(ByRef aTVInfos() As TTreeViewInfo, ByVal AScreenName As String, ByVal aTVCode As String) As TTreeViewInfo
On Error GoTo errHandler
    Dim lIdx As Long, lCount As Long
    Dim lTreeView As TTreeViewInfo, lFound As Boolean
    
    ' Search in the array
    lCount = UBound(aTVInfos)
    lFound = False
    For lIdx = 0 To lCount
        If aTVInfos(lIdx).TreeViewCode = aTVCode Then
            aTVInfos(lIdx).Loaded = False
            If Not aTVInfos(lIdx).Loaded Then
                aTVInfos(lIdx) = GetTreeViewInfoFrom_Db(AScreenName, aTVCode)
            End If
            lTreeView = aTVInfos(lIdx)
            lFound = True
            Exit For
        End If
    Next
    
    If Not lFound Then
        'ERROR
    End If
    
    GetTreeViewInfo = lTreeView
    Exit Function
errHandler:
    Call ErrorHandler("GetTreeViewInfo")

End Function


Private Function GetTreeViewInfoFrom_Db(ByVal AScreenName As String, ByVal aTVCode As String) As TTreeViewInfo
On Error GoTo errHandler
    Dim lTreeView As TTreeViewInfo
    Dim lRequest As String
    Dim lCurs As Long, lIdx As Long, lCount As Long
    
    ' Get the data from the DB
    lRequest = "EXEC Treeview_Parameters_lst '" & AScreenName & "', '" & aTVCode & "'"
'    lCurs = mo_Db.OpenSQL(lRequest)
    lCurs = OpenSQLSafe(mo_Db, lRequest)
    
    lCount = mo_Db.RowCount(lCurs) - 1
    
    If lCount = -1 Then
        Debug.Print "ERROR GetTreeViewInfoFrom_Db"
    End If
    
    ReDim lTreeView.NodeRequest(lCount)
    ReDim lTreeView.GridRequest(lCount)
    ReDim lTreeView.ExcelRequest(lCount)
    ReDim lTreeView.FindRequest(lCount)
    ReDim lTreeView.CountRequest(lCount)
    ReDim lTreeView.Images(lCount)
    ReDim lTreeView.SelectedImages(lCount)
    
    Dim lLevel As Long
    For lIdx = 0 To lCount
        lLevel = mo_Db.GetFields(lCurs, "TV_Level")
        lTreeView.NodeRequest(lLevel) = ReplaceTVHolders(mo_Db.GetFields(lCurs, "TV_NodeRequest"))
        lTreeView.GridRequest(lLevel) = ReplaceTVHolders(mo_Db.GetFields(lCurs, "TV_GridRequest"))
        lTreeView.ExcelRequest(lLevel) = ReplaceTVHolders(mo_Db.GetFields(lCurs, "TV_ExcelRequest"))
        lTreeView.FindRequest(lLevel) = ReplaceTVHolders(mo_Db.GetFields(lCurs, "TV_FindRequest"))
        lTreeView.CountRequest(lLevel) = ReplaceTVHolders(mo_Db.GetFields(lCurs, "TV_CountRequest"))
        lTreeView.Images(lLevel) = mo_Db.GetFields(lCurs, "TV_Images")
        lTreeView.SelectedImages(lLevel) = mo_Db.GetFields(lCurs, "TV_SelectedImages")
        mo_Db.Next (lCurs)
    Next
    
    lTreeView.TreeViewCode = aTVCode
    lTreeView.Levels = lCount + 1
    lTreeView.Loaded = True
    GetTreeViewInfoFrom_Db = lTreeView
    
    mo_Db.Close (lCurs)
    Exit Function
errHandler:
    mo_Db.Close (lCurs)
    Call ErrorHandler("GetTreeViewInfoFrom_Db")
    
End Function


Private Function ReplaceTVHolders(ByVal aRequest As String) As String
On Error GoTo errHandler
    Dim lBuffer As String
    lBuffer = Replace(aRequest, "$lang$", ms_Language_Code, , , vbTextCompare)
    lBuffer = Replace(lBuffer, "$u_code$", IIf(mb_IsStrategic Or mb_IsUpdater, "null", ml_UCode), , , vbTextCompare)
    'lBuffer = Replace(lBuffer, "$u_code$", 220, , , vbTextCompare)
    ReplaceTVHolders = lBuffer
    
CleanUp:
    Exit Function

errHandler:
    Call ErrorHandler("ReplaceTVHolders")
    
End Function



Private Function LoadTreeView(ByRef aTV As ArmTreeView, ByRef aTreeViewInfo As TTreeViewInfo, Optional ByRef aGrid As ArmGrid = Nothing) As Boolean
On Error GoTo errHandler
    aTV.Visible = False

    aTV.Clear
    ' Clearing the associated grid
    If Not aGrid Is Nothing Then
        aGrid.Requests = ""
        Call aGrid.ClearGrid
    End If

    aTV.Levels = aTreeViewInfo.Levels
    aTV.StartDemandLevel = 1
    aTV.SelectedImages = aTreeViewInfo.SelectedImages
    aTV.Images = aTreeViewInfo.Images
    aTV.NodeRequests = ApplyTVFilters(aTreeViewInfo.NodeRequest)
    aTV.GridRequests = aTreeViewInfo.GridRequest
    aTV.FindRequests = ApplyTVFilters(aTreeViewInfo.FindRequest)
    aTV.CountRequests = aTreeViewInfo.CountRequest
    
    If Not aTV.LoadTree(LoadTypeChildsDemand) Then
        'ERROR
        LoadTreeView = False
    End If
    
    aTV.Visible = True
    Exit Function
errHandler:
    Call ErrorHandler("LoadTreeView")
   
End Function


Function MsgText(ByVal aID As Long, ByVal aLang As String, ByVal aDefault As String, Optional ByVal aInfo As Variant) As String

On Error GoTo errHandler

Const DB_REQ As String = "SELECT message_text FROM error_message WHERE msgid = $id$ AND Language_code = '$lang$'"

    MsgText = ""
    
    Dim lRequest As String
    lRequest = Replace(DB_REQ, "$id$", aID)
    lRequest = Replace(lRequest, "$lang$", aLang)
    Dim lData As Long
'    lData = mo_Db.OpenSQL(lRequest)
    lData = OpenSQLSafe(mo_Db, lRequest)
    
    Dim lBuffer As String
    lBuffer = mo_Db.GetFields(lData, "message_text")
    mo_Db.Close (lData)
    If lBuffer = "" Then lBuffer = aDefault
    
    Dim li_Idx As Integer
    If Not IsMissing(aInfo) Then
        For li_Idx = 0 To UBound(aInfo)
            lBuffer = Replace(lBuffer, aInfo(li_Idx, 0), aInfo(li_Idx, 1), , , vbTextCompare)
        Next li_Idx
    End If
    
    
    MsgText = lBuffer
    Exit Function
errHandler:
    mo_Db.Close (lData)
    Call ErrorHandler("MsgText")
   
End Function
' Load the labels of a containers
Public Sub LoadLabels(ByRef aControls As Variant, ByRef av_Container As Object, ByVal as_ScreenName As String, ByVal as_Language As String)


On Error GoTo errHandler
    Dim lIdx As Long, lCount As Long, lLabels As Long, lb_Apply As Boolean, lv_Iter As Object, ls_Buffer As String
    Dim lControl As Control, ll_idx2 As Long, ll_Count2 As Long, ll_IdxGrd As Long
    
    'lLabels = mo_Db.OpenSQL("exec Screen_Csts '" & as_ScreenName & "','" & as_Language & "'")
    lLabels = OpenSQLSafe(mo_Db, "exec Screen_Csts '" & as_ScreenName & "','" & as_Language & "'")
    lCount = aControls.Count - 1
    
    For lIdx = 0 To lCount
        Set lControl = aControls.Item(lIdx)
        
        If Not av_Container Is Nothing Then
            lb_Apply = HasContainer(lControl, av_Container)
        Else
            lb_Apply = True
        End If
        If lb_Apply Then
            Select Case UCase(TypeName(lControl))
                Case "LABEL", "FRAME", "COMMANDBUTTON", "CHECKBOX"
                    If lControl.Tag <> "" Then
                        If mo_Db.Find(lLabels, "FIELD_NAME", lControl.Tag, , 1) >= 0 Then
                            lControl.Caption = mo_Db.GetFields(lLabels, "LOCAL_TEXT")
                        End If
                    End If
                Case "TEXTBOX"
                    If lControl.Tag <> "" Then
                        If mo_Db.Find(lLabels, "FIELD_NAME", lControl.Tag, , 1) >= 0 Then
                            lControl.Text = mo_Db.GetFields(lLabels, "LOCAL_TEXT")
                        End If
                    End If
                Case "TABSTRIP"
                    
                    If lControl.Tag <> "" Then
                        For Each lv_Iter In lControl.Tabs
                            If mo_Db.Find(lLabels, "FIELD_NAME", lControl.Tag & "_" & lv_Iter.Tag, , 1) >= 0 Then
                                lv_Iter.Caption = mo_Db.GetFields(lLabels, "LOCAL_TEXT")
                            End If
                        Next
                    End If
                
                Case "OPTIONBUTTON"
                    If lControl.Tag <> "" Then
                        ls_Buffer = Split(lControl.Tag, SEP, , vbTextCompare)(0)
                        On Error Resume Next
                        ls_Buffer = ls_Buffer & lControl.Index
                        On Error GoTo 0
                        If mo_Db.Find(lLabels, "FIELD_NAME", ls_Buffer, , 1) >= 0 Then
                            lControl.Caption = mo_Db.GetFields(lLabels, "LOCAL_TEXT")
                        End If
                    End If
                Case "ARMGRID"
                    If lControl.Tag <> "" Then
                        If (StrComp(lControl.Tag, "grd_detail1", vbTextCompare) = 0) Or (StrComp(lControl.Tag, "grd_detail2", vbTextCompare) = 0) Then
                           ll_Count2 = UBound(mt_ClassInfoLst)
                           For ll_idx2 = 0 To ll_Count2
                                ll_IdxGrd = IIf(StrComp(lControl.Tag, "grd_detail1", vbTextCompare) = 0, 0, 1)
                                ' Strat / Agg
                                ls_Buffer = left(lControl.Tag & "_N_" & mt_ClassInfoLst(ll_idx2).ConfigRecord.NameFrame, 30)
                                If mo_Db.Find(lLabels, "FIELD_NAME", ls_Buffer, , 1) >= 0 Then
                                    mt_ClassInfoLst(ll_idx2).ConfigDetail.ConfigGrid(ll_IdxGrd).Labels = mo_Db.GetFields(lLabels, "LOCAL_TEXT")
                                End If
                                ' Strat /Norm
                                ls_Buffer = left(lControl.Tag & "_A_" & mt_ClassInfoLst(ll_idx2).ConfigRecord.NameFrame, 30)
                                If mo_Db.Find(lLabels, "FIELD_NAME", ls_Buffer, , 1) >= 0 Then
                                    mt_ClassInfoLst(ll_idx2).ConfigDetail.ConfigGrid(ll_IdxGrd + 2).Labels = mo_Db.GetFields(lLabels, "LOCAL_TEXT")
                                End If
                            Next
                        Else
                        
                            If mo_Db.Find(lLabels, "FIELD_NAME", lControl.Tag, , 1) >= 0 Then
                                Call lControl.LoadConstants(ptStatic, mo_Db.GetFields(lLabels, "LOCAL_TEXT"), ctColumns)
                            End If
                        End If
                    End If
                    
                Case "FRAME", "MSFLEXGRID", "TOOLBARCONTROL", "COMMANDBUTTON", "ARMCHECKVIEW", "ARMCOMBOBOX", "A_CALOCX", "ARMTREEVIEW", "LISTBOX", "PICTUREBOX"
                   ' NOTHING
                
            End Select
        End If
        Set lControl = Nothing
    Next
    
CleanUp:
    mo_Db.Close (lLabels)
    Exit Sub
            
errHandler:
    mo_Db.Close (lLabels)
    If Not lControl Is Nothing Then Set lControl = Nothing
    Call ErrorHandler("LoadLabels")
            
End Sub


'' Standard error handler
Private Sub ErrorHandler(ByVal as_Fct As String)
    Err.Raise Err.Number, UserControl.Name & "." & UserControl.Ambient.DisplayName & "::" & as_Fct & SEP1 & Err.Source, Err.Description
End Sub

' Return the result of a SQL request
' Convert SQL runtime errors and process errors to VB Error
#If LIVE = 1 Then
Private Function OpenSQLSafe(ByVal ao_Db As Object, ByVal as_Request As String, Optional ByVal al_RowExpectedCount = -1) As Long
#Else
Private Function OpenSQLSafe(ByVal ao_Db As ARMSYSCOMLib.ArmDb, ByVal as_Request As String, Optional ByVal al_RowExpectedCount = -1) As Long
#End If

On Error GoTo errHandler

    Dim lc_Data As Long
    lc_Data = ao_Db.OpenSQL(as_Request)
    
    If lc_Data = 0 Then
        Err.Raise ArmErr.SQLFailure, "SQL : " & as_Request, Join(ao_Db.SQLErrorCodes, SEP2) & SEP1 & Join(ao_Db.SQLErrorMessages, SEP2)
    End If
'    Debug.Print 1 / 0
    If al_RowExpectedCount <> -1 Then
        ' Then check the rowcount
        If ao_Db.RowCount(lc_Data) <> al_RowExpectedCount Then
            Err.Raise ArmErr.SQLBadRowExpectedCount, "SQL : " & as_Request, al_RowExpectedCount & "<>" & ao_Db.RowCount(lc_Data)
        End If
    End If

    OpenSQLSafe = lc_Data

    Exit Function

errHandler:

    Call ErrorHandler("OpenSQLSafe")

End Function


' Execute a SQL request returning no data
' Convert SQL runtime errors and process errors to VB Error
' Params:
' ao_Db (Object)
' as_Request (String)
' al_RowAffectedCount (String)
#If LIVE = 1 Then
Private Sub ExecuteSQLSafe(ByVal ao_Db As Object, ByVal as_Request As String, Optional ByVal al_RowAffectedCount = -1, Optional ab_DuplicityCheck As Boolean = False)
#Else
Private Sub ExecuteSQLSafe(ByVal ao_Db As ARMSYSCOMLib.ArmDb, ByVal as_Request As String, Optional ByVal al_RowAffectedCount = -1, Optional ab_DuplicityCheck As Boolean = False)
#End If
On Error GoTo errHandler

    ' First execute the request
    If Not ao_Db.ExecuteSQL(as_Request) Then
        Err.Raise ArmErr.SQLFailure, "SQL : " & as_Request, Join(ao_Db.SQLErrorCodes, SEP2) & SEP1 & Join(ao_Db.SQLErrorMessages, SEP2)
    End If

    If al_RowAffectedCount <> -1 Then
        ' Then check the rowcount
        If ao_Db.SQLRowsAffected <> al_RowAffectedCount Then
            
            If ab_DuplicityCheck Then
                Err.Raise ArmCusErr.DuplicityDetected, "SQL : " & as_Request, al_RowAffectedCount & "<>" & ao_Db.SQLRowsAffected
            Else
                Err.Raise ArmErr.SQLBadRowAffectedCount, "SQL : " & as_Request, al_RowAffectedCount & "<>" & ao_Db.SQLRowsAffected
            End If
        End If
    End If

    Exit Sub

errHandler:
    Call ErrorHandler("ExecuteSQLSafe")
End Sub

' logs message to database
Private Sub DBLog(ByVal as_msg As String)
    
    Dim ll_errNumber As Long
    Dim ls_ErrDescription As String, ls_ErrSource As String
    
    ll_errNumber = Err.Number
    ls_ErrDescription = Err.Description
    ls_ErrSource = Err.Source

On Error GoTo errHandler

    Dim ls_Req As String
    
    ls_Req = "EXEC Error_Log_Insert '" & App.EXEName & "', '" & App.Major & "." & App.Minor & "." & App.Revision & "', '" _
    & Replace(as_msg, "'", "''") & "', '" & ll_errNumber & "','" & Replace(ls_ErrSource, "'", "''") & SEP2 & Replace(ls_ErrDescription, "'", "''") & "'"
    ExecuteSQLSafe mo_Db, ls_Req
    
    Err.Number = ll_errNumber
    Err.Description = ls_ErrDescription
    Err.Source = ls_ErrSource
    Exit Sub
    
errHandler:
    MsgBox "A fatal error occured. Unable to log error into database, the application will be close. Please report the following message to your IT support: " & vbCrLf & _
        "Number:" & Err.Number & vbCrLf & "Description:" & Err.Description
    End

End Sub



Private Sub LoadAllLabels()
    
On Error GoTo errHandler
    
    Dim lv_Iter As Object
    For Each lv_Iter In fra_record
        Call LoadLabels(UserControl.Controls, lv_Iter, SCREEN_NAME & "_" & lv_Iter.Tag, ms_Language_Code)
    Next
    Call LoadLabels(UserControl.Controls, fra_detail, SCREEN_NAME & "_" & fra_detail.Tag, ms_Language_Code)
    Call LoadLabels(UserControl.Controls, fra_filter, SCREEN_NAME & "_" & fra_filter.Tag, ms_Language_Code)
    Call LoadLabels(UserControl.Controls, Fra_Attachments, SCREEN_NAME & "_" & Fra_Attachments.Tag, ms_Language_Code)
    Call LoadLabels(UserControl.Controls, fra_list, SCREEN_NAME & "_" & fra_list.Tag, ms_Language_Code)
    
    lbl_label(60).Caption = lbl_label(20).Caption
    lbl_label(61).Caption = lbl_label(21).Caption
    lbl_label(62).Caption = lbl_label(26).Caption
    lbl_label(63).Caption = lbl_label(27).Caption
    
    Exit Sub
    
errHandler:
    Call ErrorHandler("ExecuteSQLSafe")
 
End Sub


Private Sub Command1_Click()
    Dim lo_Control As Control
    
    Const C_REQUEST As String = "INSERT INTO Screen_Constants  (Screen_Name, Field_Name, Language_Code, Language_Order, Authorized_Length, Local_Text, TH_Code, Z_Last_Upd)" & vbCrLf & _
                                "VALUES ('$screen$', '$fieldname$', 'E', 'Z', 30, '$localtext$', NULL, GetDate())"
    Open "c:\scr.txt" For Output As #1
    Print #1, "DELETE Screen_Constants WHERE Screen_Name LIKE 'COMP_DB%'"
    
    Dim ls_Buffer As String, ls_Screen_Name As String, ll_Idx As Long, ll_Count As Long, ls_Buffer2 As String
    Dim lv_Iter As Object
    
    For Each lo_Control In UserControl.Controls
        'On Error Resume Next
        Dim ll_errnum As Long
        ls_Buffer = ""
        ls_Screen_Name = ""
        
        For Each lv_Iter In fra_record
            If HasContainer(lo_Control, lv_Iter) Then
                ls_Screen_Name = lv_Iter.Tag
                Exit For
            End If
        Next
        If HasContainer(lo_Control, fra_Disclaimer) Then
            ls_Screen_Name = fra_Disclaimer.Tag
        End If

        If HasContainer(lo_Control, Fra_Attachments) Then
            ls_Screen_Name = Fra_Attachments.Tag
        End If
        If HasContainer(lo_Control, fra_detail) Then
            ls_Screen_Name = fra_detail.Tag
        End If
        If HasContainer(lo_Control, fra_filter) Then
            ls_Screen_Name = fra_filter.Tag
        End If
        ls_Screen_Name = SCREEN_NAME & "_" & ls_Screen_Name
            
            Select Case UCase(TypeName(lo_Control))
                
                Case "LABEL", "COMMANDBUTTON", "CHECKBOX", "FRAME"
                    If Len(lo_Control.Tag) > 0 And UCase(lo_Control.Tag) <> "TITLE" And lo_Control.Caption <> "" Then
                        ls_Buffer = C_REQUEST
                        ls_Buffer = Replace(ls_Buffer, "$screen$", ls_Screen_Name, , , vbTextCompare)
                        ls_Buffer = Replace(ls_Buffer, "$fieldname$", lo_Control.Tag, , , vbTextCompare)
                        ls_Buffer = Replace(ls_Buffer, "$localtext$", Replace(lo_Control.Caption, "#", ""), , vbTextCompare)
                        ls_Buffer = ""
                    End If
                   
                Case "TABSTRIP"
                
                    ll_Count = lo_Control.Tabs.Count
                    For ll_Idx = 1 To ll_Count
                        ls_Buffer2 = C_REQUEST
                        ls_Buffer2 = Replace(ls_Buffer2, "$screen$", ls_Screen_Name, , , vbTextCompare)
                        ls_Buffer2 = Replace(ls_Buffer2, "$fieldname$", lo_Control.Tag & "_" & lo_Control.Tabs(ll_Idx).Tag, , , vbTextCompare)
                        ls_Buffer2 = Replace(ls_Buffer2, "$localtext$", Replace(lo_Control.Tabs(ll_Idx).Caption, "#", ""), , vbTextCompare)
                        ls_Buffer = ls_Buffer & vbCrLf & ls_Buffer2
                        ls_Buffer = ""
                    Next
                
                Case "OPTIONBUTTON"
                        ls_Buffer = C_REQUEST
                        ls_Buffer = Replace(ls_Buffer, "$screen$", ls_Screen_Name, , , vbTextCompare)
                        ls_Buffer2 = Split(lo_Control.Tag, SEP, , vbTextCompare)(0)
                        On Error Resume Next
                        ls_Buffer2 = ls_Buffer2 & lo_Control.Index
                        On Error GoTo 0
                        ls_Buffer = Replace(ls_Buffer, "$fieldname$", ls_Buffer2, , , vbTextCompare)
                        ls_Buffer = Replace(ls_Buffer, "$localtext$", Replace(lo_Control.Caption, "#", ""), , vbTextCompare)
                        ls_Buffer = ""
                Case "ARMGRID"

                    ls_Buffer = C_REQUEST
                    ls_Buffer = Replace(ls_Buffer, "$screen$", ls_Screen_Name, , , vbTextCompare)
                    ls_Buffer2 = lo_Control.Tag
                    If (StrComp(lo_Control.Tag, "grd_detail1", vbTextCompare) = 0) Or (StrComp(lo_Control.Tag, "grd_detail2", vbTextCompare) = 0) Then
                        ' Aggregate
                        ls_Buffer2 = ls_Buffer2 & IIf(me_Mode = emAgg, "A", "N")
                        ' The screen
                        ls_Buffer2 = ls_Buffer2 & "_" & tbs_selector(ml_tbsidx).SelectedItem.Tag

                    End If
                    ls_Buffer = Replace(ls_Buffer, "$fieldname$", ls_Buffer2, , , vbTextCompare)
                    ll_Count = lo_Control.Cols - 1
                    ls_Buffer2 = ""
                    For ll_Idx = 0 To ll_Count
                        ls_Buffer2 = ls_Buffer2 & Replace(lo_Control.Columns(ll_Idx).Title, "#", "") & SEP
                    Next
                    If ls_Buffer2 <> "" Then
                        ls_Buffer2 = left(ls_Buffer2, Len(ls_Buffer2) - Len(SEP))
                        ls_Buffer = Replace(ls_Buffer, "$localtext$", left(ls_Buffer2, 30), , , vbTextCompare)
                    End If
                Case Else
                    ls_Buffer = ""
            End Select
        If Len(ls_Buffer) > 0 Then
            On Error Resume Next
            Print #1, "PRINT '" & lo_Control.Index & "'"
            On Error GoTo 0
            Print #1, ls_Buffer
            Print #1, "GO"
        End If
    Next
    Close #1
End Sub


Private Function ConvertToEuro(ByRef ao_Source As TextBox, ByRef ao_Currency As ArmCombobox, ByRef ao_YearRef As ArmCombobox, ByRef ao_Destination As TextBox, ByVal al_SrcLabelIdx As Long, ByVal al_DestLabelIdx As Long, ByRef ao_Caller As Object, Optional ByVal ab_Verbose = True) As Boolean

On Error GoTo errHandler

    Dim ld_rate As Double
    Dim lc_rate As Long
    Dim lv_MsgReplaceInfo As Variant
    Dim lValues As Variant
    
    ' Check if reference data are selected
    If ao_Currency.SelectedItem Is Nothing Or ao_YearRef.SelectedItem Is Nothing Then
        ao_Destination.Text = ""
        Exit Function
    End If
    
    ' Check if the field is correct
    Dim ll_IsNum As Long
    ll_IsNum = CheckNumericField(ao_Source, 0, -999999999999#, 999999999999#)
    If ll_IsNum <> 0 Then
        If Not ab_Verbose Then
            ao_Destination.Text = ""
            Exit Function
        End If
        ReDim lv_MsgReplaceInfo(2, 1)
        lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
        lv_MsgReplaceInfo(0, 1) = lbl_label(al_SrcLabelIdx).Caption
        lv_MsgReplaceInfo(1, 0) = "$Min$"
        lv_MsgReplaceInfo(1, 1) = FormatNumber(-999999999999#, 0)
        lv_MsgReplaceInfo(2, 0) = "$Max$"
        lv_MsgReplaceInfo(2, 1) = FormatNumber(999999999999#, 0)
        Select Case ll_IsNum
            Case 2131
                Call MsgBox(MsgText(ll_IsNum, ms_Language_Code, "#The field " & lv_MsgReplaceInfo(0, 1) & " must be numeric.", lv_MsgReplaceInfo), vbInformation)
            Case 2134
                Call MsgBox(MsgText(ll_IsNum, ms_Language_Code, "#The field " & lv_MsgReplaceInfo(0, 1) & " does not accept decimal number.", lv_MsgReplaceInfo), vbInformation)
            Case 2132
                Call MsgBox(MsgText(ll_IsNum, ms_Language_Code, "#The field " & lv_MsgReplaceInfo(0, 1) & " must be a number between " & lv_MsgReplaceInfo(1, 1) & " and " & lv_MsgReplaceInfo(2, 1) & ".", lv_MsgReplaceInfo), vbInformation)
        End Select
       ao_Destination.Text = ""
        Call ao_Source.SetFocus
        Exit Function
    End If
    
    
    ' It the money is euro, no conversion needed
    If ao_Currency.SelectedItem.GetData(0) = "EUR" Then
        ao_Destination.Text = ao_Source.Text
        ConvertToEuro = True
        Exit Function
    End If
    
    ' Retrieve exchange rate
    lc_rate = OpenSQLSafe(mo_Db, "exec MKT_EURO_RATE '" & ao_Currency.SelectedItem.GetData(0) & "', " & ao_YearRef.SelectedItem.GetData(0))
    ld_rate = mo_Db.GetFields(lc_rate, 0)
    mo_Db.Close (lc_rate)
            
    If ld_rate = 0 Then
        If Not ab_Verbose Then
            ao_Destination.Text = 0
            Exit Function
        End If
        ReDim lv_MsgReplaceInfo(0, 1)
        lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
        lv_MsgReplaceInfo(0, 1) = lbl_label(al_DestLabelIdx).Caption
        If MsgBox(MsgText(2141, ms_Language_Code, "#There is not exchange rate for euro for this year. The $LabelCaption$ is zero. Would you like to continue ?", lv_MsgReplaceInfo), vbInformation + vbYesNo) = vbNo Then
            ConvertToEuro = False
            ao_Caller.SetFocus
            Exit Function
        End If
        ao_Destination.Text = 0
    Else
        lValues = Split(ao_Destination.Tag, SEP)
        
        Select Case me_Mode
            Case emAdd, emUpdate, emCopy
                ao_Destination.Text = Format(CDbl(ao_Source.Text) / ld_rate, "0")
            Case Else
                ao_Destination.Text = FormatNumber(CDbl(ao_Source.Text) / ld_rate, lValues(2))
        End Select
        
    End If
            
    
    ConvertToEuro = True
    Exit Function

errHandler:
    Call ErrorHandler("ConvertToEuro")

End Function


Private Sub txt_Financial_Profit_Loss_LostFocus()
On Error GoTo errHandler
    If mb_internalFin Then Exit Sub
    
    Call LockScreen(True)
    
    Call ConvertToEuro(txt_Financial_Profit_Loss, cbo_Financial_Fin_PL_Currency, cbo_Financial_Year, txt_Financial_Profit_Loss_Euro, 211, 214, txt_Financial_Profit_Loss)
    
CleanUp:
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "txt_Financial_TurnOver_LostFocus"
    Call LockScreen(False)
    MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation
End Sub

Private Sub txt_Financial_TurnOver_LostFocus()

On Error GoTo errHandler
    If mb_internalFin Then Exit Sub
    
    Call LockScreen(True)
    
    Call ConvertToEuro(txt_Financial_TurnOver, cbo_Financial_Fin_Currency, cbo_Financial_Year, txt_Financial_Turnover_Euro, 210, 213, txt_Financial_TurnOver)
    
CleanUp:
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "txt_Financial_TurnOver_LostFocus"
    Call LockScreen(False)
    MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation

End Sub



Private Sub cbo_Financial_Year_ComboItemSelected()
On Error GoTo errHandler
    If mb_internalFin Then Exit Sub
    
    Call LockScreen(True)
    
    Call ConvertToEuro(txt_Financial_Profit_Loss, cbo_Financial_Fin_PL_Currency, cbo_Financial_Year, txt_Financial_Profit_Loss_Euro, 211, 214, cbo_Financial_Year)
    Call ConvertToEuro(txt_Financial_TurnOver, cbo_Financial_Fin_Currency, cbo_Financial_Year, txt_Financial_Turnover_Euro, 210, 213, cbo_Financial_Year)
    
CleanUp:
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "txt_Financial_TurnOver_LostFocus"
    Call LockScreen(False)
    MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation

End Sub


Private Sub cbo_Financial_Fin_Currency_ComboItemSelected()
On Error GoTo errHandler
    If mb_internalFin Then Exit Sub
    
    Call LockScreen(True)
    
    Call ConvertToEuro(txt_Financial_Profit_Loss, cbo_Financial_Fin_PL_Currency, cbo_Financial_Year, txt_Financial_Profit_Loss_Euro, 211, 214, cbo_Financial_Fin_Currency)
    Call ConvertToEuro(txt_Financial_TurnOver, cbo_Financial_Fin_Currency, cbo_Financial_Year, txt_Financial_Turnover_Euro, 210, 213, cbo_Financial_Fin_Currency)
    
CleanUp:
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "txt_Financial_TurnOver_LostFocus"
    Call LockScreen(False)
    MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation

End Sub

Private Sub cbo_Financial_Fin_PL_Currency_ComboItemSelected()
On Error GoTo errHandler
    If mb_internalFin Then Exit Sub
    
    Call LockScreen(True)
    
    Call ConvertToEuro(txt_Financial_Profit_Loss, cbo_Financial_Fin_PL_Currency, cbo_Financial_Year, txt_Financial_Profit_Loss_Euro, 211, 214, cbo_Financial_Fin_PL_Currency)
    Call ConvertToEuro(txt_Financial_TurnOver, cbo_Financial_Fin_Currency, cbo_Financial_Year, txt_Financial_Turnover_Euro, 210, 213, cbo_Financial_Fin_PL_Currency)
    
CleanUp:
    Call LockScreen(False)
    Exit Sub
    
errHandler:
    DBLog "txt_Financial_TurnOver_LostFocus"
    Call LockScreen(False)
    MsgBox MsgText(2143, ms_Language_Code, "#There is a problem while doing this action. Please double check your entry."), vbInformation
End Sub




Private Sub LockScreen(ByVal ab_lock As Boolean)

    Dim ll_errNumber As Long, ls_ErrSrc As String, ls_ErrDesc As String
    ll_errNumber = Err.Number
    ls_ErrSrc = Err.Source
    ls_ErrDesc = Err.Description

On Error GoTo errHandler
    Static ll_Count As Long
    Static ll_Mousepointer As Long
    Static lb_Locked As Boolean
      
      
    ll_Count = ll_Count + IIf(ab_lock, 1, -1)
    Debug.Assert (ll_Count >= 0)
    
    ' First lock
    If Not lb_Locked And ab_lock Then
        ll_Mousepointer = Screen.MousePointer
        Screen.MousePointer = vbHourglass
        LockWindowUpdate UserControl.hwnd
        lb_Locked = True
    End If
    
    ' Unlock
    If ll_Count = 0 Then
        DoEvents ' Flush events
        LockWindowUpdate 0
        UserControl.Refresh ' Repaint immediately
        Screen.MousePointer = ll_Mousepointer
        lb_Locked = False
    End If
    
    Err.Number = ll_errNumber
    Err.Source = ls_ErrSrc
    Err.Description = ls_ErrDesc
    
    Exit Sub
    
errHandler:
    Call ErrorHandler("ExecuteSQLSafe")

End Sub
