VERSION 5.00
Begin VB.Form PrdAdd 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "#New Product Maintenance"
   ClientHeight    =   6570
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   10875
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6570
   ScaleWidth      =   10875
   StartUpPosition =   2  'CenterScreen
   Tag             =   "title"
   Begin Project1.ToolBr ToolBar 
      Align           =   1  'Align Top
      Height          =   495
      Left            =   0
      TabIndex        =   42
      Top             =   0
      Width           =   10875
      _ExtentX        =   19182
      _ExtentY        =   873
   End
   Begin VB.Frame fra_item 
      Height          =   5895
      Left            =   120
      TabIndex        =   0
      Top             =   600
      Width           =   10725
      Begin VB.CheckBox chk_GEMA 
         Caption         =   "#GEMA"
         Height          =   255
         Left            =   120
         TabIndex        =   10
         Tag             =   "chk_GEMA"
         Top             =   5520
         Width           =   1935
      End
      Begin Project1.ArmCombobox cbo_property 
         Height          =   345
         Index           =   8
         Left            =   2775
         TabIndex        =   9
         Tag             =   "cbo_Surface"
         Top             =   4905
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_property 
         Height          =   345
         Index           =   7
         Left            =   2775
         TabIndex        =   8
         Tag             =   "cbo_PE_Width"
         Top             =   4410
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_property 
         Height          =   345
         Index           =   6
         Left            =   2775
         TabIndex        =   7
         Tag             =   "cbo_PE_Length"
         Top             =   3930
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_property 
         Height          =   345
         Index           =   5
         Left            =   2775
         TabIndex        =   6
         Tag             =   "cbo_Segmentation"
         Top             =   3450
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_property 
         Height          =   345
         Index           =   4
         Left            =   2775
         TabIndex        =   5
         Tag             =   "cbo_Pattern"
         Top             =   2970
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_property 
         Height          =   345
         Index           =   3
         Left            =   2775
         TabIndex        =   4
         Tag             =   "cbo_Colour"
         Top             =   2490
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_property 
         Height          =   345
         Index           =   2
         Left            =   2775
         TabIndex        =   3
         Tag             =   "cbo_Family"
         Top             =   2010
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_property 
         Height          =   345
         Index           =   1
         Left            =   2760
         TabIndex        =   2
         Tag             =   "cbo_SBM"
         Top             =   1560
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_property 
         Height          =   345
         Index           =   0
         Left            =   2775
         TabIndex        =   1
         Tag             =   "cbo_Category"
         Top             =   1050
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   609
      End
      Begin VB.TextBox txt_spare4 
         Height          =   375
         Left            =   6720
         MaxLength       =   50
         TabIndex        =   49
         Tag             =   "txt_SoundAtt"
         Top             =   6960
         Visible         =   0   'False
         Width           =   630
      End
      Begin VB.TextBox txt_spare3 
         Height          =   375
         Left            =   4920
         MaxLength       =   50
         TabIndex        =   47
         Tag             =   "txt_SoundAtt"
         Top             =   6975
         Visible         =   0   'False
         Width           =   630
      End
      Begin VB.TextBox txt_spare2 
         Height          =   375
         Left            =   3150
         MaxLength       =   50
         TabIndex        =   45
         Tag             =   "txt_SoundAtt"
         Top             =   6975
         Visible         =   0   'False
         Width           =   630
      End
      Begin VB.TextBox txt_spare1 
         Height          =   375
         Left            =   1365
         MaxLength       =   50
         TabIndex        =   43
         Tag             =   "txt_SoundAtt"
         Top             =   7170
         Width           =   630
      End
      Begin VB.TextBox txt_property 
         Height          =   375
         Index           =   8
         Left            =   7935
         MaxLength       =   50
         TabIndex        =   19
         Tag             =   "txt_SoundAbs"
         Top             =   4890
         Width           =   2415
      End
      Begin VB.TextBox txt_property 
         Height          =   375
         Index           =   9
         Left            =   7935
         MaxLength       =   50
         TabIndex        =   20
         Tag             =   "txt_SoundAtt"
         Top             =   5370
         Width           =   2415
      End
      Begin VB.TextBox txt_property 
         Height          =   375
         Index           =   7
         Left            =   7935
         MaxLength       =   80
         TabIndex        =   18
         Tag             =   "txt_GridType"
         Top             =   4410
         Width           =   2415
      End
      Begin VB.TextBox txt_property 
         Height          =   375
         Index           =   6
         Left            =   7935
         MaxLength       =   5
         TabIndex        =   17
         Tag             =   "txt_FireClass"
         Top             =   3930
         Width           =   2415
      End
      Begin VB.TextBox txt_property 
         Height          =   375
         Index           =   5
         Left            =   7935
         MaxLength       =   20
         TabIndex        =   16
         Tag             =   "txt_Thickness"
         Top             =   3450
         Width           =   2415
      End
      Begin VB.TextBox txt_property 
         Height          =   375
         Index           =   4
         Left            =   7935
         MaxLength       =   20
         TabIndex        =   15
         Tag             =   "txt_height"
         Top             =   2970
         Width           =   2415
      End
      Begin VB.TextBox txt_property 
         Height          =   375
         Index           =   3
         Left            =   7935
         MaxLength       =   20
         TabIndex        =   14
         Tag             =   "txt_ActWidth"
         Top             =   2490
         Width           =   2415
      End
      Begin VB.TextBox txt_property 
         Height          =   375
         Index           =   2
         Left            =   7935
         MaxLength       =   20
         TabIndex        =   13
         Tag             =   "txt_ActLength"
         Top             =   2010
         Width           =   2415
      End
      Begin VB.TextBox txt_property 
         Height          =   375
         Index           =   1
         Left            =   7935
         MaxLength       =   20
         TabIndex        =   12
         Tag             =   "txt_NomWidth"
         Top             =   1530
         Width           =   2415
      End
      Begin VB.TextBox txt_property 
         Height          =   375
         Index           =   0
         Left            =   7935
         MaxLength       =   20
         TabIndex        =   11
         Tag             =   "txt_NomLength"
         Top             =   1050
         Width           =   2415
      End
      Begin VB.TextBox txt_Desc 
         Enabled         =   0   'False
         Height          =   375
         Left            =   2055
         MaxLength       =   80
         TabIndex        =   21
         Tag             =   "txt_Desc"
         Top             =   210
         Width           =   8520
      End
      Begin VB.Label lbl_Formula 
         Caption         =   "([GEMA] + Super base material + Product family + Product Edge length + Product Pattern + Nominal Width x Nominal Length)"
         Height          =   255
         Left            =   120
         TabIndex        =   51
         Tag             =   "lbl_Formula"
         Top             =   600
         Width           =   8895
      End
      Begin VB.Label lbl_spare4 
         Caption         =   "Spare4"
         Height          =   255
         Left            =   5940
         TabIndex        =   50
         Tag             =   "lbl_SoundAtt"
         Top             =   7095
         Visible         =   0   'False
         Width           =   675
      End
      Begin VB.Label lbl_spare3 
         Caption         =   "Spare3"
         Height          =   255
         Left            =   4245
         TabIndex        =   48
         Tag             =   "lbl_SoundAtt"
         Top             =   7095
         Visible         =   0   'False
         Width           =   675
      End
      Begin VB.Label lbl_sapre2 
         Caption         =   "Spare2"
         Height          =   255
         Left            =   2550
         TabIndex        =   46
         Tag             =   "lbl_SoundAtt"
         Top             =   7095
         Visible         =   0   'False
         Width           =   675
      End
      Begin VB.Label lbl_spare1 
         Caption         =   "Spare1"
         Height          =   255
         Left            =   855
         TabIndex        =   44
         Tag             =   "lbl_SoundAtt"
         Top             =   7095
         Visible         =   0   'False
         Width           =   675
      End
      Begin VB.Label lbl_Desc 
         Caption         =   "#Description"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   135
         TabIndex        =   41
         Tag             =   "lbl_Desc"
         Top             =   330
         Width           =   1815
      End
      Begin VB.Label lbl_Category 
         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          =   255
         Left            =   240
         TabIndex        =   40
         Tag             =   "lbl_Category"
         Top             =   1080
         Width           =   2415
      End
      Begin VB.Label lbl_SBM 
         Caption         =   "#Super base material"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   39
         Tag             =   "lbl_SBM"
         Top             =   1560
         Width           =   2415
      End
      Begin VB.Label lbl_Family 
         Caption         =   "#Family"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   38
         Tag             =   "lbl_Family"
         Top             =   2130
         Width           =   2415
      End
      Begin VB.Label lbl_Segmentation 
         Caption         =   "#Segmentation"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   37
         Tag             =   "lbl_Segmentation"
         Top             =   3570
         Width           =   2415
      End
      Begin VB.Label lbl_PE_Length 
         Caption         =   "#Product edge length"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   36
         Tag             =   "lbl_PE_Length"
         Top             =   3960
         Width           =   2415
      End
      Begin VB.Label lbl_PE_Width 
         Caption         =   "#Product edge width"
         Height          =   255
         Left            =   240
         TabIndex        =   35
         Tag             =   "lbl_PE_Width"
         Top             =   4530
         Width           =   2415
      End
      Begin VB.Label lbl_Pattern 
         Caption         =   "#Pattern"
         Height          =   255
         Left            =   240
         TabIndex        =   34
         Tag             =   "lbl_Pattern"
         Top             =   3090
         Width           =   2535
      End
      Begin VB.Label lbl_Surface 
         Caption         =   "#Surface"
         Height          =   255
         Left            =   240
         TabIndex        =   33
         Tag             =   "lbl_Surface"
         Top             =   5010
         Width           =   2415
      End
      Begin VB.Label lbl_SoundAbs 
         Caption         =   "#Sound Absorption"
         Height          =   255
         Left            =   5520
         TabIndex        =   32
         Tag             =   "lbl_SoundAbs"
         Top             =   4920
         Width           =   2295
      End
      Begin VB.Label lbl_NomLength 
         Caption         =   "#Nominal length"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5520
         TabIndex        =   31
         Tag             =   "lbl_NomLength"
         Top             =   1200
         Width           =   2295
      End
      Begin VB.Label lbl_NomWidth 
         Caption         =   "#Nominal Width"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5520
         TabIndex        =   30
         Tag             =   "lbl_NomWidth"
         Top             =   1650
         Width           =   2295
      End
      Begin VB.Label lbl_ActLength 
         Caption         =   "#Actual Length"
         Height          =   255
         Left            =   5520
         TabIndex        =   29
         Tag             =   "lbl_ActLength"
         Top             =   2130
         Width           =   2295
      End
      Begin VB.Label lbl_height 
         Caption         =   "#Height"
         Height          =   255
         Left            =   5520
         TabIndex        =   28
         Tag             =   "lbl_height"
         Top             =   3090
         Width           =   2295
      End
      Begin VB.Label lbl_Thickness 
         Caption         =   "#Thickness"
         Height          =   255
         Left            =   5520
         TabIndex        =   27
         Tag             =   "lbl_Thickness"
         Top             =   3570
         Width           =   2295
      End
      Begin VB.Label lbl_FireClass 
         Caption         =   "#Fire class"
         Height          =   255
         Left            =   5520
         TabIndex        =   26
         Tag             =   "lbl_FireClass"
         Top             =   4050
         Width           =   2295
      End
      Begin VB.Label lbl_ActWidth 
         Caption         =   "#Actual width"
         Height          =   255
         Left            =   5520
         TabIndex        =   25
         Tag             =   "lbl_ActWidth"
         Top             =   2610
         Width           =   2295
      End
      Begin VB.Label lbl_GridType 
         Caption         =   "#Grid type"
         Height          =   255
         Left            =   5520
         TabIndex        =   24
         Tag             =   "lbl_GridType"
         Top             =   4530
         Width           =   2295
      End
      Begin VB.Label lbl_SoundAtt 
         Caption         =   "#Sound Attenuation"
         Height          =   255
         Left            =   5520
         TabIndex        =   23
         Tag             =   "lbl_SoundAtt"
         Top             =   5400
         Width           =   2295
      End
      Begin VB.Label lbl_Colour 
         Caption         =   "#Colour"
         Height          =   255
         Left            =   240
         TabIndex        =   22
         Tag             =   "lbl_Colour"
         Top             =   2610
         Width           =   2415
      End
   End
End
Attribute VB_Name = "PrdAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Enum ArmErr
    DBCnxFailed = vbObjectError + 1             ' Unable to connect to the database
    CPTAlreadyInitialized = vbObjectError + 2   ' We try to initialize a component that is already initialized
    CPTNotInitialized = vbObjectError + 3       ' We try to use or free that is not initialized yet
    InvalidArgument = vbObjectError + 4
    PropertyNotSet = vbObjectError + 5
    SQLFailure = vbObjectError + 6               ' A SQL runtime error has occured : syntax wrong....
    SQLBadRowAffectedCount = vbObjectError + 7   ' A SQL request has not affected the expected rowcount (ex: one Update do nothing)
    SQLBadRowExpectedCount = vbObjectError + 8   ' A SQL request does not return the expected rowcount : select an item return nothing...
    DrivingError = vbObjectError + 9
    CompFncFailed = vbObjectError + 10           ' when component function fail
    GridLoadFailed = vbObjectError + 11          ' load function failed ... bad sql
    QuietException = vbObjectError + 12          ' do not display error message
    SQLTableReferenceConstraint = vbObjectError + 13 ' A SQL request cannot be executed : Table reference constraint
    DuplicityDetected = vbObjectError + 2301     ' detected row with same unique id
End Enum



'Curseur & données
Private mo_ArmDb As Object
Private mb_Created As Boolean
Private mb_use_framework_connection As Boolean
Private ms_ConnectString As String
Private ms_UID As String

'Curseur & données

Private m_ProductCode As String
Private m_SCCode As String
Private m_Language As String
Private p_iCon As Integer

Private m_Mode As String

'Array of procstock
Private Const MAX_TXT = 10
Private Const MAX_CBO = 9
Private ms_CboProcStoc(MAX_CBO) As String
Private ms_S_Code As String
Private ms_S_Desc As String

Private p_DefaultValues(MAX_VALUE) As DefaultValue
Private p_DefaultValuesCount As Integer
Private p_DefaultValuesLoaded As Boolean

Public Property Set ArmDb(ByRef ao_local_connection As Object)
Dim i As Integer

    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:ArmDb_Set"
    #End If
    CapMouseOff
    
    If Not (ao_local_connection Is Nothing) Then
        Set mo_ArmDb = ao_local_connection
        mb_use_framework_connection = True
        
        Set toolbar.ArmDb = mo_ArmDb
        For i = 0 To MAX_CBO - 1
            Set cbo_property(i).ArmDb = mo_ArmDb
        Next
    End If

Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:ArmDb_Set"
    #End If
    CapMouseOn
End Property

Property Let ConnectString(as_ConnectString As String)
Dim i As Integer

    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:ConnectString_Let", "as_ConnectString=" & as_ConnectString
    #End If
    CapMouseOff
    
    ms_UID = ConnectionStringValidation(as_ConnectString)
    If ms_UID = "" Then GoTo Trace_End
    
    ms_ConnectString = as_ConnectString
    For i = 0 To MAX_CBO - 1
        cbo_property(i).ConnectString = ms_ConnectString
    Next
    'Connection
    toolbar.ConnectString = ms_ConnectString
    
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:ConnectString_Let"
    #End If
    CapMouseOn
End Property

Property Let Language(ALng As String)
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:Language_Let", "ALng=" & ALng
    #End If
    m_Language = ALng
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:Language_Let"
    #End If
End Property

Private Sub AddLock()
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:AddLock"
    #End If
    fra_item.Enabled = True
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:AddLock"
    #End If
End Sub

Property Let ProductCode(AProductCode As String)
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:ProductCode_Let", "AProductCode=" & AProductCode
    #End If
    m_ProductCode = AProductCode
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:ProductCode_Let"
    #End If
End Property

Private Sub AddInitFields()
Dim TheRequest As String
Dim i As Integer

    On Error GoTo Trace_Err
    CapMouseOff
    
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:AddInitFields"
    #End If

    txt_Desc.Text = ""

    ClearCbo
    ClearTxt
    
    AddLock

Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:AddInitFields"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:AddInitFields"
    CapMouseOn
End Sub

Private Sub DeleteLock()
    On Error GoTo Trace_Err
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:DeleteLock"
    #End If
    CapMouseOff

    fra_item.Enabled = False

Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:DeleteLock"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:DeleteLock"
    CapMouseOn
End Sub

Property Let Mode(aMode As String)
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:Mode_Let", "AMode=" & aMode
    #End If
    
    m_Mode = aMode
    
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:Mode_Let"
    #End If
End Property

Function RecordAdd() As Boolean
Dim ls_Request As String
Dim lb_Result As Boolean
Dim ls_Result As String

    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:RecordAdd"
    #End If

    RecordAdd = False

    'Test of SCCode
    If Trim$(m_SCCode = "") Then GoTo Trace_End
    
    ErrorOFF
    
    Dim ls_S_code As String
    ls_S_code = mo_ArmDb.SQLNextID("Cap_System")
    If ls_S_code = "" Then Call Err.Raise(SQLFailure, "", "SQL Error: mo_ArmDb.SQLNextID(""Cap_System"") return nothing.")


    ls_Request = "Exec cap_system_ins "
    ls_Request = ls_Request & "  " & CorrectString(mo_ArmDb, m_Language, txt_Desc, True)
   
    ls_Request = ls_Request & ", " & CorrectCodeStr(mo_ArmDb, m_Language, cbo_property(0), True)
    ls_Request = ls_Request & ", " & CorrectCodeStr(mo_ArmDb, m_Language, cbo_property(1), True)
    ls_Request = ls_Request & ", " & CorrectCodeStr(mo_ArmDb, m_Language, cbo_property(2), True)
    ls_Request = ls_Request & ", " & CorrectCodeStr(mo_ArmDb, m_Language, cbo_property(3))
    ls_Request = ls_Request & ", " & CorrectCodeStr(mo_ArmDb, m_Language, cbo_property(4))
    ls_Request = ls_Request & ", " & CorrectCodeStr(mo_ArmDb, m_Language, cbo_property(5), True)
    ls_Request = ls_Request & ", " & CorrectCodeStr(mo_ArmDb, m_Language, cbo_property(6), True)
    ls_Request = ls_Request & ", " & CorrectCodeStr(mo_ArmDb, m_Language, cbo_property(7))
    ls_Request = ls_Request & ", " & CorrectCodeStr(mo_ArmDb, m_Language, cbo_property(8))
    ls_Request = ls_Request & ", " & "''"
    ls_Request = ls_Request & ", " & "''"
     
    ls_Request = ls_Request & ", " & CorrectDec(mo_ArmDb, m_Language, txt_property(0), True)
    ls_Request = ls_Request & ", " & CorrectDec(mo_ArmDb, m_Language, txt_property(1), True)
    ls_Request = ls_Request & ", " & CorrectDec(mo_ArmDb, m_Language, txt_property(2))
    ls_Request = ls_Request & ", " & CorrectDec(mo_ArmDb, m_Language, txt_property(3))
    ls_Request = ls_Request & ", " & CorrectDec(mo_ArmDb, m_Language, txt_property(4))
    ls_Request = ls_Request & ", " & CorrectDec(mo_ArmDb, m_Language, txt_property(5))
    ls_Request = ls_Request & ", " & CorrectString(mo_ArmDb, m_Language, txt_property(6))
    ls_Request = ls_Request & ", " & CorrectString(mo_ArmDb, m_Language, txt_property(7))
    ls_Request = ls_Request & ", " & CorrectString(mo_ArmDb, m_Language, txt_property(8))
    ls_Request = ls_Request & ", " & CorrectString(mo_ArmDb, m_Language, txt_property(9))
    ls_Request = ls_Request & ", " & "'SPC'"
    
    
    ls_Request = ls_Request & ", " & m_SCCode
    ls_Request = ls_Request & ", " & "''" '@Internet_flag  CHAR(1),
    ls_Request = ls_Request & ", " & "''" '@drop_flag  CHAR(1),
    ls_Request = ls_Request & ", " & "NULL" '@drop_date  CHAR(1),
    ls_Request = ls_Request & ", " & CorrectString(mo_ArmDb, m_Language, txt_spare1) '@spare1     varchar(1),
    ls_Request = ls_Request & ", " & CorrectString(mo_ArmDb, m_Language, txt_spare2) '@spare2     varchar(1),
    ls_Request = ls_Request & ", " & CorrectDec(mo_ArmDb, m_Language, txt_spare3) '@spare3     real,
    ls_Request = ls_Request & ", " & CorrectDec(mo_ArmDb, m_Language, txt_spare4) '@spare4     real
    
    ls_Request = ls_Request & ", '" & ls_S_code & "'"
    
    
    If ErrorFound Then GoTo Trace_End
    
    Dim lb_Transaction As Boolean
    ASC_BeginTransaction mo_ArmDb
    lb_Transaction = True
    
    lb_Result = ASC_RecordExec(mo_ArmDb, ls_Request, ls_Result)
    
    If lb_Result = False Then
        ASC_RollBackTransaction mo_ArmDb
        lb_Transaction = False
        Call ASC_SendMessage(mo_ArmDb, m_Language, 891, "#An error occured during this manipulation, please contact your IT support")
        GoTo Trace_End
    End If
    
    ms_S_Code = ls_Result
    ms_S_Desc = ms_S_Code & " - " & txt_Desc.Text
    
    ASC_CommitTransaction mo_ArmDb
    lb_Transaction = False
    RecordAdd = True
    
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:RecordAdd", "Result=" & RecordAdd
    #End If
    CapMouseOn
    Exit Function
    
Trace_Err:
    ASC_RollBackTransaction mo_ArmDb
    
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:RecordAdd"
    CapMouseOn
End Function


Property Let SCCode(ACode As String)
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:SCCode_Let", "ACode=" & ACode
    #End If
    
    m_SCCode = ACode
    
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:SCCode_Let"
    #End If
End Property

Private Sub SetProcStock()
    
    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:SetProcStock"
    #End If

    ms_CboProcStoc(0) = "exec Categories_cbo '" & m_Language & "'"
    ms_CboProcStoc(1) = "exec Super_Base_Material_cbo $CG$, '" & m_Language & "'"
    ms_CboProcStoc(2) = "exec Products_Families_cbo $CG$, '" & m_Language & "'"
    ms_CboProcStoc(3) = "exec Colours_cbo $CG$, '" & m_Language & "'"
    ms_CboProcStoc(4) = "exec Products_Patterns_cbo $CG$, '" & m_Language & "'"
    ms_CboProcStoc(5) = "exec Products_Segmentation_cbo $CG$, '" & m_Language & "'"
    ms_CboProcStoc(6) = "exec Products_Edges_cbo $CG$, '" & m_Language & "'"
    ms_CboProcStoc(7) = "exec Products_Edges_cbo $CG$, '" & m_Language & "'"
    ms_CboProcStoc(8) = "exec Surfaces_cbo $CG$, '" & m_Language & "'"
    'ms_CboProcStoc(9) = "exec Shapes_cbo $CG$, '" & m_Language & "'"
    'ms_CboProcStoc(10) = "exec Product_Module_cbo $CG$, '" & m_Language & "'"

Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:SetProcStock"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:SetProcStock"
    CapMouseOn
End Sub

Private Sub ReplaceInString(as_searchproc As String)
    
    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:ReplaceInString", "as_searchproc=" & as_searchproc
    #End If

    'replace the $$ in the query
    as_searchproc = Replace(as_searchproc, "$CG$", "'" & GetCodeFromCombo(cbo_property(0)) & "'")
    
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:ReplaceInString"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:ReplaceInString"
    CapMouseOn
End Sub


Private Sub cbo_property_ComboItemSelected(Index As Integer)

    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:cbo_property_ComboItemSelected", "Index=" & Index
    #End If

    Select Case Index
    Case 0
'        ClearCbo 1
        EnableCbo True, 1
    Case 1, 2, 4, 6
        Call UpdateDescription
    End Select

Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:cbo_property_ComboItemSelected"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:cbo_property_ComboItemSelected"
    CapMouseOn
End Sub

Private Sub EnableCbo(ab_Enabled As Boolean, Optional ai_firstIndex As Integer = 0)
Dim i As Integer
Dim ls_CboCriteriaProcStoc As String
    
    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:EnableCbo", "ab_enabled=" & ab_Enabled, "ai_firstIndex=" & ai_firstIndex
    #End If

    If Not (ai_firstIndex >= 0 And ai_firstIndex < MAX_CBO) Then GoTo Trace_End
    
    For i = ai_firstIndex To MAX_CBO - 1
        cbo_property(i).Enabled = ab_Enabled
        ls_CboCriteriaProcStoc = ms_CboProcStoc(i)
        ReplaceInString ls_CboCriteriaProcStoc
        If i = 1 Or i = 2 Or i = 5 Or i = 6 Then
            cbo_property(i).FirstBlankItem = False
        Else
            cbo_property(i).FirstBlankItem = True
        End If
        cbo_property(i).Request = ls_CboCriteriaProcStoc
    Next i
    
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:EnableCbo"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:EnableCbo"
    CapMouseOn
End Sub

Private Sub ClearCbo(Optional ai_firstIndex As Integer = 0)
Dim i As Integer
Dim ls_CboCriteriaProcStoc As String

    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:ClearCbo", "ai_firstIndex=" & ai_firstIndex
    #End If

    If Not (ai_firstIndex >= 0 And ai_firstIndex < MAX_CBO) Then GoTo Trace_End
    
    For i = ai_firstIndex To MAX_CBO - 1
        cbo_property(i).Clear
    Next i
    
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:ClearCbo"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:ClearCbo"
    CapMouseOn
End Sub

Private Sub ClearTxt(Optional ai_firstIndex As Integer = 0)
Dim i As Integer
    
    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:ClearTxt", "ai_firstIndex=" & ai_firstIndex
    #End If

    If Not (ai_firstIndex >= 0 And ai_firstIndex < MAX_CBO) Then GoTo Trace_End
    
    For i = ai_firstIndex To MAX_TXT - 1
        txt_property(i).Text = ""
    Next i
    
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:ClearTxt"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:ClearTxt"
    CapMouseOn
End Sub

Sub UpdateInitFields()

    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:UpdateInitFields"
    #End If

    'idem
    ViewInitFields

    UpdateLock

Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:UpdateInitFields"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:UpdateInitFields"
    CapMouseOn
End Sub

Private Sub UpdateLock()

    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:UpdateLock"
    #End If

   fra_item.Enabled = True

Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:UpdateLock"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:UpdateLock"
    CapMouseOn
End Sub

Private Sub ViewInitFields()
Dim ll_Cursor As Long
Dim TheRequest As String
Dim Thekey1 As String
Dim Thekey2 As String

    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:ViewInitFields"
    #End If

    'On construit la requête
    Thekey1 = m_ProductCode
    Thekey2 = m_Language
    
    'Si pas de clé en cours, ie pas de ligne en grille sélectionnée alors bye
    If Thekey1 = "" Or Thekey2 = "" Then GoTo Trace_End
    
    'Try connexion
    If Not ASC_ConnectToDB(mo_ArmDb, ms_ConnectString, mb_Created) Then GoTo Trace_End
        
    TheRequest = "exec ..._t_sel '" & Thekey1 & "','" & Thekey2 & "'"
    ll_Cursor = mo_ArmDb.OpenSQL(TheRequest, -1, 0)
    If ll_Cursor = 0 Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceSQLError mo_ArmDb, "PrdAdd:ViewInitFields", "Request=" & TheRequest
        GoTo Trace_End
    End If
  
    p_iCon = mo_ArmDb.GetFields(ll_Cursor, "iConcurrency")
    
    txt_Desc.Text = mo_ArmDb.GetFields(ll_Cursor, "...")
    
    cbo_property(0).AddItem Array(mo_ArmDb.GetFields(ll_Cursor, "xx_code"), mo_ArmDb.GetFields(ll_Cursor, "xx_desc")), True
    cbo_property_ComboItemSelected 0
    cbo_property(1).AddItem Array(mo_ArmDb.GetFields(ll_Cursor, "xx_code"), mo_ArmDb.GetFields(ll_Cursor, "xx_desc")), True
    cbo_property(2).AddItem Array(mo_ArmDb.GetFields(ll_Cursor, "xx_code"), mo_ArmDb.GetFields(ll_Cursor, "xx_desc")), True
    cbo_property(3).AddItem Array(mo_ArmDb.GetFields(ll_Cursor, "xx_code"), mo_ArmDb.GetFields(ll_Cursor, "xx_desc")), True
    cbo_property(4).AddItem Array(mo_ArmDb.GetFields(ll_Cursor, "xx_code"), mo_ArmDb.GetFields(ll_Cursor, "xx_desc")), True
    cbo_property(5).AddItem Array(mo_ArmDb.GetFields(ll_Cursor, "xx_code"), mo_ArmDb.GetFields(ll_Cursor, "xx_desc")), True
    cbo_property(6).AddItem Array(mo_ArmDb.GetFields(ll_Cursor, "xx_code"), mo_ArmDb.GetFields(ll_Cursor, "xx_desc")), True
    cbo_property(7).AddItem Array(mo_ArmDb.GetFields(ll_Cursor, "xx_code"), mo_ArmDb.GetFields(ll_Cursor, "xx_desc")), True
    cbo_property(8).AddItem Array(mo_ArmDb.GetFields(ll_Cursor, "xx_code"), mo_ArmDb.GetFields(ll_Cursor, "xx_desc")), True
    cbo_property(9).AddItem Array(mo_ArmDb.GetFields(ll_Cursor, "xx_code"), mo_ArmDb.GetFields(ll_Cursor, "xx_desc")), True
    cbo_property(10).AddItem Array(mo_ArmDb.GetFields(ll_Cursor, "xx_code"), mo_ArmDb.GetFields(ll_Cursor, "xx_desc")), True
    
    'txt_Qty.Text = p_DA.GetFields(ll_Cursor, "asd_qty")
   
    DeleteLock
   
Trace_End:
    mo_ArmDb.Close ll_Cursor
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:ViewInitFields"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    mo_ArmDb.Close ll_Cursor
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:ViewInitFields"
    CapMouseOn
End Sub

Public Sub Load_A_Com()
Dim i As Integer
Dim ls_CboCriteriaProcStoc As String

    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:Load_A_Com"
    #End If

    toolbar.Language = m_Language
    
    VerifyInitialization mo_ArmDb, ms_ConnectString, m_Language, Me
    
    toolbar.Load_A_Com
    toolbar.DrivenByCapture = True
    toolbar.ClearAllIcons
    toolbar.PictureDisplayed = "P_Valid=1 P_Undo=2 P_Quit=-1"
    For i = 0 To MAX_CBO - 1
        cbo_property(i).Load_A_Com
    Next

    'Mode
    Select Case UCase$(m_Mode)
        Case UCase$("Add")
            AddInitFields
        
        Case UCase$("Upd")
            UpdateInitFields
        
        Case UCase$("Del")
            ViewInitFields
            
        
        Case Else
            Call ASC_SendMessage(mo_ArmDb, m_Language, 891, "#An error occured during this manipulation, please contact your IT support")
            AddInitFields
    
    End Select

    LoadLabels mo_ArmDb, Me, "Cap_Product_Add", m_Language

    If p_DefaultValuesLoaded = False Then
        p_DefaultValuesCount = GetScreenDefaultValues(mo_ArmDb, ms_UID, m_Language, "Cap_Product_Add", p_DefaultValues)
        p_DefaultValuesLoaded = True
    End If
    DisplayScreenDefaultValues Me.Controls, p_DefaultValues, p_DefaultValuesCount
    
    SetProcStock
    
    ls_CboCriteriaProcStoc = ms_CboProcStoc(0)
    ReplaceInString ls_CboCriteriaProcStoc
    cbo_property(0).FirstBlankItem = False
    cbo_property(0).Request = ls_CboCriteriaProcStoc
    cbo_property(0).Enabled = False
    
    cbo_property_ComboItemSelected 0

Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:Load_A_Com"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:Load_A_Com"
    CapMouseOn
End Sub

Public Sub Unload_A_Com()
Dim i As Integer

    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:Unload_A_Com"
    #End If

    toolbar.Unload_A_Com
    For i = 0 To MAX_CBO - 1
        cbo_property(i).Unload_A_Com
    Next

    ASC_DisconnectFromDB mo_ArmDb, ms_UID, mb_Created
    
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:Unload_A_Com"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:Unload_A_Com"
    CapMouseOn
End Sub

Private Sub Form_Activate()
    cbo_property(1).SetFocus
End Sub

Private Sub toolbar_action(ByVal as_ActionType As String)

    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:toolbar_action", "as_ActionType=" & as_ActionType
    #End If

    Select Case as_ActionType
        Case "Quit"
            Unload Me
                
        Case "Undo"
            'Me.Hide
            If m_Mode = "Add" Then
                AddInitFields
            Else
                ViewInitFields
            End If
         
        Case "Valid"
            'Valid Add
            If RecordAdd Then Unload Me
            
    End Select

Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:toolbar_action"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:toolbar_action"
    CapMouseOn
End Sub

Private Function GetDescription() As String

    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:GetDescription"
    #End If


    Dim ls_Desc As String
    
    ls_Desc = ""
    
    If chk_GEMA.value = 1 Then
        ls_Desc = chk_GEMA.Caption + " "
    End If
    
    If Not cbo_property(1).SelectedItem Is Nothing Then
        ls_Desc = ls_Desc + cbo_property(1).SelectedItem.DisplayText
    End If

    If Not cbo_property(2).SelectedItem Is Nothing Then
        ls_Desc = ls_Desc + " " + cbo_property(2).SelectedItem.DisplayText
    End If
    
    If Not cbo_property(6).SelectedItem Is Nothing Then
        ls_Desc = ls_Desc + " " + cbo_property(6).SelectedItem.DisplayText
    End If
    
    If Not cbo_property(4).SelectedItem Is Nothing Then
        ls_Desc = ls_Desc + " " + cbo_property(4).SelectedItem.DisplayText
    End If
    
    ls_Desc = Trim(ls_Desc) + " " + Trim(txt_property(0).Text + " x " + txt_property(1).Text)

    GetDescription = ls_Desc
    
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:GetDescription"
    #End If
    CapMouseOn
    Exit Function
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:GetDescription"
    CapMouseOn
End Function

Private Sub chk_GEMA_Click()
     
    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:chk_GEMA_Click"
    #End If
   
    Call UpdateDescription
    
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:chk_GEMA_Click"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:chk_GEMA_Click"
    CapMouseOn
End Sub

Private Sub UpdateDescription()
    
    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:UpdateDescription"
    #End If
   
    txt_Desc = GetDescription
        
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:UpdateDescription"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:UpdateDescription"
    CapMouseOn
End Sub

Private Sub txt_property_LostFocus(Index As Integer)
    
    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:txt_property_LostFocus"
    #End If
  
    Select Case Index
        Case 0, 1
            Call UpdateDescription
    End Select
    
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:txt_property_LostFocus"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrdAdd:txt_property_LostFocus"
    CapMouseOn
End Sub

Public Property Get Code() As String
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:Code_Get"
    #End If

    Code = ms_S_Code

    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:Code_Get"
    #End If
End Property

Public Property Get Desc() As String
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrdAdd:Desc_Get"
    #End If

    Desc = ms_S_Desc

    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrdAdd:Desc_Get"
    #End If
End Property
