VERSION 5.00
Begin VB.Form C_InOut_Mtnc 
   ClientHeight    =   5910
   ClientLeft      =   1965
   ClientTop       =   1035
   ClientWidth     =   6765
   ClipControls    =   0   'False
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   5910
   ScaleWidth      =   6765
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton SSC_dropped 
      Height          =   276
      Left            =   3000
      Style           =   1  'Graphical
      TabIndex        =   6
      Top             =   5400
      Width           =   252
   End
   Begin VB.CommandButton spp_save 
      Default         =   -1  'True
      Height          =   612
      Left            =   4980
      Style           =   1  'Graphical
      TabIndex        =   9
      Top             =   5220
      Width           =   612
   End
   Begin VB.CommandButton ssp_quit 
      Height          =   612
      Left            =   5700
      Style           =   1  'Graphical
      TabIndex        =   10
      Top             =   5220
      Width           =   612
   End
   Begin VB.TextBox Txt_code 
      Height          =   285
      Left            =   1020
      MaxLength       =   4
      TabIndex        =   24
      Top             =   240
      Visible         =   0   'False
      Width           =   615
   End
   Begin VB.TextBox txt_ShortDesc 
      Height          =   288
      Left            =   1800
      MaxLength       =   3
      TabIndex        =   21
      Top             =   4200
      Width           =   1812
   End
   Begin VB.ComboBox cbo_CurrCode 
      Height          =   288
      Left            =   3000
      Style           =   2  'Dropdown List
      TabIndex        =   19
      Top             =   4620
      Visible         =   0   'False
      Width           =   396
   End
   Begin VB.Frame Frame1 
      Height          =   3492
      Left            =   120
      TabIndex        =   12
      Top             =   600
      Width           =   6492
      Begin VB.ListBox lst_CountryOut 
         Height          =   2205
         Left            =   240
         Sorted          =   -1  'True
         TabIndex        =   1
         Top             =   720
         Width           =   2004
      End
      Begin VB.ListBox lst_ToDelete 
         Height          =   645
         Left            =   2520
         Sorted          =   -1  'True
         TabIndex        =   16
         Top             =   2580
         Visible         =   0   'False
         Width           =   1524
      End
      Begin VB.ListBox lst_ToInsert 
         Height          =   645
         Left            =   2460
         Sorted          =   -1  'True
         TabIndex        =   15
         Top             =   240
         Visible         =   0   'False
         Width           =   1524
      End
      Begin VB.PictureBox pic_In 
         AutoSize        =   -1  'True
         Height          =   408
         Left            =   3060
         ScaleHeight     =   345
         ScaleWidth      =   345
         TabIndex        =   14
         Top             =   1320
         Width           =   408
      End
      Begin VB.PictureBox pic_Out 
         AutoSize        =   -1  'True
         Height          =   408
         Left            =   3060
         ScaleHeight     =   345
         ScaleWidth      =   345
         TabIndex        =   13
         Top             =   2040
         Width           =   408
      End
      Begin VB.ListBox lst_CountryIn 
         Height          =   2205
         Left            =   4320
         Sorted          =   -1  'True
         TabIndex        =   2
         Top             =   720
         Width           =   2004
      End
      Begin VB.Label lbl_Selected 
         Alignment       =   2  'Center
         Caption         =   "Selected"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   252
         Left            =   4320
         TabIndex        =   18
         Top             =   420
         Width           =   1992
      End
      Begin VB.Label lbl_Available 
         Alignment       =   2  'Center
         Caption         =   "Available"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   252
         Left            =   240
         TabIndex        =   17
         Top             =   420
         Width           =   1992
      End
   End
   Begin VB.TextBox Txt_desc 
      Height          =   285
      Left            =   2460
      MaxLength       =   50
      TabIndex        =   0
      Top             =   240
      Width           =   3135
   End
   Begin VB.TextBox txt_dropped 
      ForeColor       =   &H00FF0000&
      Height          =   288
      Left            =   1800
      Locked          =   -1  'True
      TabIndex        =   5
      Top             =   5400
      Width           =   1212
   End
   Begin VB.CheckBox chk_Int 
      Caption         =   "Check1"
      Height          =   252
      Left            =   1800
      TabIndex        =   4
      Top             =   5040
      Width           =   252
   End
   Begin VB.ComboBox Cbo_curr 
      Height          =   288
      Left            =   1800
      Style           =   2  'Dropdown List
      TabIndex        =   3
      Top             =   4620
      Width           =   1812
   End
   Begin VB.Label Lbl_code 
      Caption         =   "Code"
      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            =   120
      TabIndex        =   23
      Top             =   240
      Visible         =   0   'False
      Width           =   855
   End
   Begin VB.Label lbl_ShortDesc 
      Caption         =   "Short 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          =   252
      Left            =   240
      TabIndex        =   22
      Top             =   4200
      Width           =   1512
   End
   Begin VB.Label Lbl_curr 
      Caption         =   "Currency"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   240
      TabIndex        =   20
      Top             =   4620
      Width           =   1452
   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          =   252
      Left            =   660
      TabIndex        =   11
      Top             =   240
      Width           =   1752
   End
   Begin VB.Label lbl_Int 
      Caption         =   "Internet flag"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   240
      TabIndex        =   8
      Top             =   5040
      Width           =   1452
   End
   Begin VB.Label lbl_Drop 
      Caption         =   "Drop date"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   240
      TabIndex        =   7
      Top             =   5400
      Width           =   1452
   End
End
Attribute VB_Name = "C_InOut_Mtnc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim ms_MarketCode As String
Dim ms_IntFlag As String

Private Sub Form_Load()

Dim ls_Req As String

On Error GoTo suite

MouseOff

If gl_CodePage <> 1252 And gl_CodePage <> 0 Then ChangeCharset Me

spp_save.Picture = LoadResPicture(RES_OK, 1)
ssp_quit.Picture = LoadResPicture(RES_QUIT, 1)
pic_In.Picture = LoadResPicture(RES_RIGHT, 1)
pic_Out.Picture = LoadResPicture(RES_LEFT, 1)
SSC_dropped.Picture = LoadResPicture(RES_DOWN2, vbResIcon)

GetScCsts
If gut_Param.Str11 = "Show field" Then
    lbl_ShortDesc.Visible = OK
    txt_ShortDesc.Visible = OK
Else
    lbl_ShortDesc.Visible = KO
    txt_ShortDesc.Visible = KO
End If
If gut_Param.Str12 = "Don't Show Currency" Then
    Cbo_curr.Visible = KO
    Lbl_curr.Visible = KO
Else
    Cbo_curr.Visible = OK
    Lbl_curr.Visible = OK
End If
If gut_Param.Str13 = "Show code" Then
    Lbl_code.Visible = OK
    Txt_code.Visible = OK
    lbl_desc.left = 1800
    Txt_desc.left = 3560
    Txt_code.Enabled = OK
    Txt_code = "" '
Else
    Lbl_code.Visible = KO
    Txt_code.Visible = KO
    lbl_desc.left = 660
    Txt_desc.left = 2460
End If
Select Case gs_Action
Case "Add":
    ls_Req = gut_Param.Str10 & " '" _
        & gut_LangWork.Code & "'"
    FillLstSingle ls_Req, lst_CountryOut
    FillCbo "Currencies", cbo_CurrCode, Cbo_curr
Case "Update":
    txt_ShortDesc.Enabled = KO
    ms_MarketCode = gs_TableCode
    ls_Req = gut_Param.Str9 & " '" _
        & gs_TableCode & "', '" _
        & gut_LangWork.Code & "'"
    FillLstSingle ls_Req, lst_CountryIn
    ls_Req = gut_Param.Str10 & " '" _
        & gut_LangWork.Code & "'"
    FillLstSingle ls_Req, lst_CountryOut
    FillCbo "Currencies", cbo_CurrCode, Cbo_curr
    Txt_desc = gs_TableCode3
    If gut_Param.Str13 = "Show code" Then
        Txt_code = gs_TableCode
        Txt_code.Enabled = KO
    End If
    If gut_Param.Str11 = "Show field" Then
        txt_ShortDesc = gs_TableCode5
        If gs_TableCode6 = "X" Then
            chk_Int.value = 1
        End If
        txt_dropped = gs_TableCode7
        Cbo_curr.ListIndex = ComboFindItem(cbo_CurrCode, gs_TableCode8)
    Else
        If gs_TableCode5 = "X" Then
            chk_Int.value = 1
        End If
        txt_dropped = gs_TableCode6
        Cbo_curr.ListIndex = ComboFindItem(cbo_CurrCode, gs_TableCode7)
    End If
Case "Delete":
    Txt_desc.Enabled = KO
    txt_ShortDesc.Enabled = KO
    chk_Int.Enabled = KO
    SSC_dropped.Visible = KO
    pic_In.Enabled = KO
    pic_Out.Enabled = KO
    Cbo_curr.Enabled = KO
    ms_MarketCode = gs_TableCode
    Txt_desc = gs_TableCode3
    ls_Req = gut_Param.Str9 & " '" _
        & gs_TableCode & "', '" _
        & gut_LangWork.Code & "'"
    FillLstSingle ls_Req, lst_CountryIn
    Cbo_curr.AddItem gs_TableCode4
    Cbo_curr.ListIndex = 0
    If gut_Param.Str13 = "Show code" Then
        Txt_code = gs_TableCode
        Txt_code.Enabled = KO
    End If
    If gut_Param.Str11 = "Show field" Then
        txt_ShortDesc = gs_TableCode5
        If gs_TableCode6 = "X" Then
            chk_Int.value = 1
        End If
        txt_dropped = gs_TableCode7
    Else
        txt_ShortDesc = gs_TableCode5
        If gs_TableCode5 = "X" Then
            chk_Int.value = 1
        End If
        txt_dropped = gs_TableCode6
    End If
Case "MoreInfo":
    Txt_desc.Locked = OK
    txt_ShortDesc.Locked = OK
    chk_Int.Enabled = KO
    SSC_dropped.Visible = KO
    pic_In.Enabled = KO
    pic_Out.Enabled = KO
    Cbo_curr.Enabled = KO
    ms_MarketCode = gs_TableCode
    Txt_desc = gs_TableCode3
    ls_Req = gut_Param.Str9 & " '" _
        & gs_TableCode & "', '" _
        & gut_LangWork.Code & "'"
    FillLstSingle ls_Req, lst_CountryIn
    Cbo_curr.AddItem gs_TableCode4
    Cbo_curr.ListIndex = 0
    spp_save.Visible = KO
    If gut_Param.Str13 = "Show code" Then
        Txt_code = gs_TableCode
        Txt_code.Enabled = KO
    End If
    If gut_Param.Str11 = "Show field" Then
        txt_ShortDesc = gs_TableCode5
        If gs_TableCode6 = "X" Then
            chk_Int.value = 1
        End If
        txt_dropped = gs_TableCode7
    Else
        If gs_TableCode5 = "X" Then
            chk_Int.value = 1
        End If
        txt_dropped = gs_TableCode6
    End If
End Select
MouseOn
Exit Sub

suite:
StdError
End Sub
Private Sub pic_In_Click()

If lst_CountryOut.ListIndex <> -1 Then
    If Not RemoveItemLst(lst_ToDelete, lst_CountryOut.Text) Then
        lst_ToInsert.AddItem lst_CountryOut.Text
    End If
    lst_CountryIn.AddItem lst_CountryOut.Text
    lst_CountryOut.RemoveItem lst_CountryOut.ListIndex
End If

End Sub

Private Sub pic_Out_Click()

If lst_CountryIn.ListIndex <> -1 Then
    If Not RemoveItemLst(lst_ToInsert, lst_CountryIn.Text) Then
        lst_ToDelete.AddItem lst_CountryIn.Text
    End If
    lst_CountryOut.AddItem lst_CountryIn.Text
    lst_CountryIn.RemoveItem lst_CountryIn.ListIndex
End If

End Sub




Private Sub spp_save_Click()

Dim ls_Line As String

On Error GoTo suite

MouseOff
gb_Return = OK
Select Case gs_Action
Case "Add"
    If Control Then
        If BeginTran(gl_Environment, gl_Database) Then
            If AddMarket Then
                If CommitTran(gl_Environment, gl_Database) Then
                    If gut_Param.Str11 = "Show field" Then
                        ls_Line = ms_MarketCode & Chr(9) & 1 & Chr(9) & Txt_desc & Chr(9) & Cbo_curr & Chr(9) & txt_ShortDesc & Chr(9) & ms_IntFlag & Chr(9) & txt_dropped & Chr(9) & cbo_CurrCode.List(Cbo_curr.ListIndex)
                    Else
                        ls_Line = ms_MarketCode & Chr(9) & 1 & Chr(9) & Txt_desc & Chr(9) & Cbo_curr & Chr(9) & ms_IntFlag & Chr(9) & txt_dropped & Chr(9) & cbo_CurrCode.List(Cbo_curr.ListIndex)
                    End If
                    C_main.Grid.AddItem ls_Line
                    C_main.Grid.Row = C_main.Grid.Rows - 1
                    Txt_desc = ""

                    Txt_code = ""
                    chk_Int.value = 0
                    txt_dropped = ""
                    lst_CountryIn.Clear
                    lst_CountryOut.Clear
                    lst_ToInsert.Clear
                    FillLstSingle "Countries", lst_CountryOut
                    Cbo_curr.ListIndex = -1
                    txt_ShortDesc = ""
                    Txt_desc.SetFocus
                Else
                    RollbackTran gl_Environment, gl_Database
                    SendMessage 4, "Insert failed", gut_LangLogin.Code
                End If
            Else
                RollbackTran gl_Environment, gl_Database
            End If
        Else
            SendMessage 4, "Insert failed", gut_LangLogin.Code
        End If
    End If
Case "Update"
    If Control Then
        If BeginTran(gl_Environment, gl_Database) Then
            If UpdMarket Then
                If CommitTran(gl_Environment, gl_Database) Then
                    C_main.Grid.RemoveItem C_main.Grid.Row
                    If gut_Param.Str11 = "Show field" Then
                        ls_Line = ms_MarketCode & Chr(9) & CInt(gs_TableCode2) + 1 & Chr(9) & Txt_desc & Chr(9) & Cbo_curr & Chr(9) & txt_ShortDesc & Chr(9) & ms_IntFlag & Chr(9) & txt_dropped & Chr(9) & cbo_CurrCode.List(Cbo_curr.ListIndex)
                    Else
                        ls_Line = ms_MarketCode & Chr(9) & CInt(gs_TableCode2) + 1 & Chr(9) & Txt_desc & Chr(9) & Cbo_curr & Chr(9) & ms_IntFlag & Chr(9) & txt_dropped & Chr(9) & cbo_CurrCode.List(Cbo_curr.ListIndex)
                    End If
                    C_main.Grid.AddItem ls_Line, C_main.Grid.Row
                    Unload Me
                Else
                    RollbackTran gl_Environment, gl_Database
                    SendMessage 3, "Update failed", gut_LangLogin.Code
                End If
            Else
                RollbackTran gl_Environment, gl_Database
            End If
        Else
            SendMessage 3, "Update failed", gut_LangLogin.Code
        End If
    End If
Case "Delete"
    MouseOn
    If SendMessage(5, "Delete record ?", gut_LangLogin.Code, vbQuestion + vbYesNo, "Delete ") = vbYes Then
        MouseOff
        If DltMarket Then
            C_main.Grid.RemoveItem C_main.Grid.Row
            Unload Me
        End If
    End If
End Select
MouseOn
Exit Sub

suite:
Select Case Err
Case 30015
    C_main.FillGrid
    Unload Me
Case Else
    StdError
    MouseOn
End Select
End Sub
Private Sub SSC_dropped_Click()

On Error GoTo suite

MouseOff
gb_Return = KO
gs_Date = txt_dropped
Dates.show 1
If gb_Return Then
    txt_dropped = gs_Date
End If
MouseOn
Exit Sub

suite:
StdError
End Sub
Private Sub ssp_quit_Click()
MouseOff
Unload Me
End Sub


Private Function UpdMarket() As Boolean
Dim ls_Req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ll_lngrows As Long
Dim ls_Line As String
Dim li_Count As Integer
Dim ls_DropFlag As String
Dim ls_DropDate As String

On Error GoTo suite

UpdMarket = KO
If chk_Int.value = 1 Then
    ms_IntFlag = "X"
Else
    ms_IntFlag = ""
End If
If txt_dropped <> "" Then
    ls_DropFlag = "X"
    ls_DropDate = FormatD(txt_dropped, "mm/dd/yyyy")
End If
If gut_Param.Str12 = "Don't Show Currency" Then
ls_Req = gut_Param.Str6 & " '" _
    & ms_MarketCode & "', '" _
    & QuoteParam(Txt_desc) & "', '" _
     & ms_IntFlag & "', '" _
    & ls_DropFlag & "', '" _
    & ls_DropDate & "', " _
    & gs_TableCode2
Else
ls_Req = gut_Param.Str6 & " '" _
    & ms_MarketCode & "', '" _
    & QuoteParam(Txt_desc) & "', '" _
    & QuoteParam(cbo_CurrCode.List(Cbo_curr.ListIndex)) & "', '" _
    & ms_IntFlag & "', '" _
    & ls_DropFlag & "', '" _
    & ls_DropDate & "', " _
    & gs_TableCode2
End If
If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_Req) Then
    li_Status = SQLRowCount(ll_Statement, ll_lngrows)
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    If ll_lngrows = 0 Then
        SendMessage 2, "Another user changed the record", gut_LangLogin.Code
        Exit Function
    End If
Else
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    SendMessage 3, "Update failed", gut_LangLogin.Code
    Exit Function
End If

For li_Count = 0 To lst_ToInsert.ListCount - 1
    ls_Req = gut_Param.Str7 & " '" _
        & ms_MarketCode & "', '" _
        & gut_LangWork.Code & "', '" _
        & lst_ToInsert.List(li_Count) & "'"
    
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_Req) Then
        li_Status = SQLRowCount(ll_Statement, ll_lngrows)
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        If ll_lngrows = 0 Then
            SendMessage 3, "Update failed", gut_LangLogin.Code
            Exit Function
        End If
    Else
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        SendMessage 3, "Update failed", gut_LangLogin.Code
        Exit Function
    End If
Next li_Count

For li_Count = 0 To lst_ToDelete.ListCount - 1
    ls_Req = gut_Param.Str8 & " '" _
        & ms_MarketCode & "', '" _
        & gut_LangWork.Code & "', '" _
        & lst_ToDelete.List(li_Count) & "'"
        
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_Req) Then
        li_Status = SQLRowCount(ll_Statement, ll_lngrows)
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        If ll_lngrows = 0 Then
            SendMessage 3, "Update failed", gut_LangLogin.Code
            Exit Function
        End If
    Else
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        SendMessage 3, "Update failed", gut_LangLogin.Code
        Exit Function
    End If
Next li_Count
UpdMarket = OK
Exit Function

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Function
Private Function AddMarket() As Boolean

Dim ls_Req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ll_lngrows As Long
Dim li_Count As Integer
Dim ls_DropFlag As String
Dim ls_DropDate As String

On Error GoTo suite

AddMarket = KO
If chk_Int.value = 1 Then
    ms_IntFlag = "X"
Else
    ms_IntFlag = ""
End If
If txt_dropped <> "" Then
    ls_DropFlag = "X"
    ls_DropDate = FormatD(txt_dropped, "mm/dd/yyyy")
End If
If gut_Param.Str11 = "Show field" Then
    ls_Req = gut_Param.Str3 & " '" & QuoteParam(Txt_desc) & "', '" _
        & QuoteParam(cbo_CurrCode.List(Cbo_curr.ListIndex)) & "','" _
        & QuoteParam(txt_ShortDesc) & "', '" _
        & ms_IntFlag & "', '" _
        & ls_DropFlag & "', '" _
        & ls_DropDate & "'"
Else
    If gut_Param.Str13 = "Show code" Then
        ls_Req = gut_Param.Str3 & " '" & QuoteParam(Txt_code) & "','" & QuoteParam(Txt_desc) & "', '" _
        & ms_IntFlag & "', '" _
        & ls_DropFlag & "', '" _
        & ls_DropDate & "'"
    Else
    ls_Req = gut_Param.Str3 & " '" & QuoteParam(Txt_desc) & "', '" _
        & QuoteParam(cbo_CurrCode.List(Cbo_curr.ListIndex)) & "','" _
        & ms_IntFlag & "', '" _
        & ls_DropFlag & "', '" _
        & ls_DropDate & "'"
    End If
End If
If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_Req) Then
    li_Status = SQLRowCount(ll_Statement, ll_lngrows)
    If ll_lngrows = 0 Then
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        SendMessage 4, "Insert failed", gut_LangLogin.Code
        Exit Function
    Else
        li_Status = SQLFetch(ll_Statement)
        If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
            ms_MarketCode = ODBCData(ll_Statement, 1)
            li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        Else
            li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
            SendMessage 4, "Insert failed", gut_LangLogin.Code
            Exit Function
        End If
    End If
Else
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    SendMessage 4, "Insert failed", gut_LangLogin.Code
    Exit Function
End If
For li_Count = 0 To lst_ToInsert.ListCount - 1
    ls_Req = gut_Param.Str4 & " '" _
        & ms_MarketCode & "', '" _
        & gut_LangWork.Code & "', '" _
        & lst_ToInsert.List(li_Count) & "'"
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_Req) Then
        li_Status = SQLRowCount(ll_Statement, ll_lngrows)
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        If ll_lngrows = 0 Then
            SendMessage 4, "Insert failed", gut_LangLogin.Code
            Exit Function
        End If
    Else
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        SendMessage 4, "Insert failed", gut_LangLogin.Code
        Exit Function
    End If
Next li_Count
AddMarket = OK
Exit Function

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Function
Private Function DltMarket() As Boolean

Dim ls_Req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ll_lngrows As Long

DltMarket = KO

On Error GoTo suite

ls_Req = gut_Param.Str5 & " '" _
    & gs_TableCode & "', " _
    & gs_TableCode2
If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_Req) Then
    li_Status = SQLRowCount(ll_Statement, ll_lngrows)
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    If ll_lngrows = 0 Then
        SendMessage 7, "Delete failed : concurrency problem ?", gut_LangLogin.Code
        Exit Function
    End If
Else
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    SendMessage 6, "Delete failed", gut_LangLogin.Code
    Exit Function
End If
DltMarket = OK
Exit Function

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Function
Private Sub GetScCsts()
Dim ls_Req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ls_Field As String
Dim ls_Text As String

On Error GoTo suite

ls_Req = gut_Param.Str2 & "'" & gut_LangLogin.Code & "'"

If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_Req) Then
    li_Status = SQL_SUCCESS
Else
    li_Status = SQL_ERROR
End If

Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
    li_Status = SQLFetch(ll_Statement)
    If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
        ls_Field = ODBCData(ll_Statement, 1)
        ls_Text = left(ODBCData(ll_Statement, 2), 30)
        Select Case ls_Field
            Case "title": Caption = ls_Text
            Case "titleA": If gs_Action = "Add" Then Caption = Caption & " - " & ls_Text
            Case "titleU": If gs_Action = "Update" Then Caption = Caption & " - " & ls_Text
            Case "titleD": If gs_Action = "Delete" Then Caption = Caption & " - " & ls_Text
            Case "lbl_Code": Lbl_code = ls_Text
            Case "lbl_Descr": lbl_desc = ls_Text
            Case "lbl_Int": lbl_Int = ls_Text
            Case "lbl_Drop": lbl_Drop = ls_Text
            Case "lbl_curr": Lbl_curr = ls_Text
            Case "lbl_Available": lbl_Available = ls_Text
            Case "lbl_Selected": lbl_Selected = ls_Text
            Case "lbl_Short": lbl_ShortDesc = ls_Text
        End Select
    End If
Loop
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
Exit Sub

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Sub
Private Function Control() As Boolean

Control = KO
If Txt_desc.Text = "" Then
    Txt_desc.SetFocus
    SendMessage 8, "Value must be filled in", gut_LangLogin.Code
    Exit Function
End If

If lst_CountryIn.ListCount = 0 Then
    lst_CountryIn.SetFocus
    SendMessage 8, "Value must be filled in", gut_LangLogin.Code
    Exit Function
End If
If Txt_code.Text = "" And gut_Param.Str13 = "Show code" Then
    Txt_code.SetFocus
    SendMessage 8, "Value must be filled in", gut_LangLogin.Code
    Exit Function
End If
If Cbo_curr = "" And gut_Param.Str12 <> "Don't Show Currency" Then
    Cbo_curr.SetFocus
    SendMessage 8, "Value must be filled in", gut_LangLogin.Code
    Exit Function
End If
If gut_Param.Str11 = "Show field" And txt_ShortDesc = "" Then
    txt_ShortDesc.SetFocus
    SendMessage 8, "Value must be filled in", gut_LangLogin.Code
    Exit Function
End If
Control = OK

End Function




