Imports System.Data.SqlClient
Public Class frm_dataentry
    Dim conn As New SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("SO_Conn"))
    Dim conn1 As New SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("SO_Conn"))
    Dim cmd As SqlCommand = Nothing

    'Dim im_location As String = "C:\r_image\"
    Dim im_location As String = "\\PINNACLE-SO\NCFiles"
    'Dim im_location As String = "\\PINNACLEDELL1\Low Country\Beaufort Office\Part 1\"
    'Dim im_location As String = "\\system-1\scana\"

    Dim im_loc As String = ""
    Dim division As String = ""
    Private Sub frm_dataentry_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Panel_100b.Visible = True
        'AxPdf1.LoadFile("C:\Page 3.pdf")
        Fill_ComboFields(cmb_loccd_1, "SO_FrmqafillCombo")
        ' Fill_ComboFields(cmb_loccd_1, "select distinct   isnull(STREET_LOCATION_1_CD,' ') as t_values from address order by t_values")
        Fill_All_ComboBoxes()
        getfiledetail(getminfile_notprocessed())
    End Sub
    Function getminfile_notprocessed()
        Dim fileid As Integer
        If conn.State = 0 Then
            conn.Open()
        End If
        Dim dr As SqlDataReader = Nothing
        cmd = New SqlCommand("SO_FrmDataentryMinfile_Notprocessed", conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@assignedto", commonUser.Common.uID)
        dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        If (dr.Read) Then
            fileid = CInt(dr(0).ToString)
        Else
            fileid = getminfile_processed()
        End If
        dr.Close()
        If fileid = 0 Then
            fileid = getminfile_processed()
        End If
        Return fileid
    End Function
    Function getminfile_processed()
        Dim fileid As Integer
        If conn.State = 0 Then
            conn.Open()
        End If
        Dim dr As SqlDataReader = Nothing
        cmd = New SqlCommand("SO_FrmDataentryMinfile_Processed", conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@assignedto", commonUser.Common.uID)
        dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        If (dr.Read) Then
            fileid = CInt(dr(0).ToString)
        Else
            fileid = 0
        End If
        dr.Close()
        Return fileid
    End Function
    Function getnext_fileid(ByVal file_id As Integer)
        Dim fileid As Integer
        If conn.State = 0 Then
            conn.Open()
        End If
        Dim dr As SqlDataReader = Nothing
        cmd = New SqlCommand("SO_FrmDataentry_NextFileid", conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@fileid", file_id)
        cmd.Parameters.AddWithValue("@assignedto", commonUser.Common.uID)
        'cmd = New SqlCommand("select ISNULL(min(file_id),0) from tbl_parent  where (status = 'A' or status = 'E') and file_id > " & file_id & " and assigned_to = " & commonUser.Common.uID, conn)
        dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        If (dr.Read) Then
            fileid = CInt(dr(0).ToString)
        Else
            fileid = 0
        End If
        dr.Close()
        Return fileid
    End Function
    Function getlast_fileid(ByVal file_id As Integer)
        Dim fileid As Integer
        If conn.State = 0 Then
            conn.Open()
        End If
        Dim dr As SqlDataReader = Nothing
        cmd = New SqlCommand("SO_FrmDataentry_LastFileid", conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@fileid", file_id)
        cmd.Parameters.AddWithValue("@assignedto", commonUser.Common.uID)
        'cmd = New SqlCommand("select ISNULL(max(file_id),0) from tbl_parent  where (status = 'A' or status = 'E') and file_id > " & file_id & " and assigned_to = " & commonUser.Common.uID, conn)
        dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        If (dr.Read) Then
            fileid = CInt(dr(0).ToString)
        Else
            fileid = 0
        End If
        dr.Close()
        Return fileid
    End Function
    'Function get_premiseno(ByVal HOUSE_NO As String, ByVal ADDR_PREFIX_1 As String, ByVal ADDR_PREFIX_2 As String, ByVal STREET_NM As String, ByVal STREET_SUFFIX_CD As String)
    Function get_premiseno(ByVal HOUSE_NO As String, ByVal ADDR_PREFIX_1 As String, ByVal ADDR_PREFIX_2 As String, ByVal STREET_NM As String, ByVal STREET_SUFFIX_CD As String, ByVal ADDR_SUFFIX_CD As String, ByVal STREET_LOCATION_1_CD As String, ByVal STREET_LOCATION_2_CD As String)
        Dim PREMISE_NO As String = ""
        If conn.State = 0 Then
            conn.Open()
        End If
        Dim house As String
        Dim add_prefix1 As String
        Dim add_prefix2 As String
        Dim street As String
        Dim street_suf As String

        If HOUSE_NO.Trim.Length = 0 Then
            MsgBox("Address does not matches. Check it again.", MsgBoxStyle.Information, "Address Exception")
            PREMISE_NO = ""
            Return PREMISE_NO
            Exit Function
            house = ""
            '    house = " HOUSE_NO is NULL "
            'Else
            '    house = " HOUSE_NO = '" & HOUSE_NO & "'"
            'End If

            'Dim cities As String
            'If txt_div.Text.Trim = "CENTRAL" Then
            '    cities = "LOCAL_OFFICE_NO IN ('002' ,'005' ,'010', '008' ,'012' ,'014' ,'020' ,'053' ,'054' ,'083', '050' ) "
            'ElseIf txt_div.Text.Trim = "EASTERN" Then
            '    cities = "LOCAL_OFFICE_NO IN ('073', '075', '076', '084', '085', '086' )"
            'ElseIf txt_div.Text.Trim = "COASTAL" Then
            '    cities = "LOCAL_OFFICE_NO IN ('087','088','094')"
            'ElseIf txt_div.Text.Trim = "LOW COUNTRY" Then
            '    cities = "LOCAL_OFFICE_NO IN ('042', '060', '061', '065','080')"
            'ElseIf txt_div.Text.Trim = "SOUTHERN" Then
            '    cities = "LOCAL_OFFICE_NO IN ('023','070', '071', '080','090','020' ,'091','092','095')"
            'ElseIf txt_div.Text.Trim = "WESTERN" Then
            '    cities = "LOCAL_OFFICE_NO IN ('010', '011', '030', '031', '032', '033', '035', '050','052','055', '089')"
            'End If

            'If ADDR_PREFIX_1.Trim.Length = 0 Then
            '    add_prefix1 = " ADDR_PREFIX_1 is NULL "
            'Else
            '    add_prefix1 = " ADDR_PREFIX_1 = '" & ADDR_PREFIX_1 & "'"
            'End If
            'If ADDR_PREFIX_2.Trim.Length = 0 Then
            '    add_prefix2 = " ADDR_PREFIX_2 is NULL "
            'Else
            '    add_prefix2 = " ADDR_PREFIX_2 = '" & ADDR_PREFIX_2 & "'"
            'End If
            'If STREET_NM.Trim.Length = 0 Then
            '    street = " STREET_NM is NULL "
            'Else
            '    street = " STREET_NM = '" & STREET_NM & "'"
            'End If
            'If STREET_SUFFIX_CD.Trim.Length = 0 Then
            '    street_suf = " STREET_SUFFIX_CD is NULL "
            'Else
            '    street_suf = " STREET_SUFFIX_CD = '" & STREET_SUFFIX_CD & "'"
            'End If
            'Dim dr As SqlDataReader = Nothing
            'Dim sql1 As String = "select distinct TOWN_NM as t_values from Address  where " & house & " and " & add_prefix1 & " and " & add_prefix2 & "  and " & street & " and " & street_suf & " and " & cities
            ''cmd = New SqlCommand("select ISNULL(max(PREMISE_NO),0) from Address  where " & house & " and " & add_prefix1 & " and " & add_prefix2 & "  and " & street & " and " & street_suf & " and " & cities, conn)
            'cmd = New SqlCommand("select ISNULL(max(PREMISE_NO),0), TOWN_NM from Address  where " & house & " and " & add_prefix1 & " and " & add_prefix2 & "  and " & street & " and " & street_suf & " and " & cities & " group by TOWN_NM ", conn)
        Else
            house = HOUSE_NO
        End If

        Dim cities As String = ""
        If txt_div.Text.Trim = "Durham" Then
            cities = "DURHAM"
        ElseIf txt_div.Text.Trim = "Asheville" Then
            cities = "ASHEVILLE"
        ElseIf txt_div.Text.Trim = "Gastonia" Then
            cities = "GASTONIA"
        ElseIf txt_div.Text.Trim = "Raleigh" Then
            cities = "RALEIGH"

        ElseIf txt_div.Text.Trim = "CENTRAL" Then
            'cities = "LOCAL_OFFICE_NO IN ('002' ,'005' ,'010', '008' ,'012' ,'014' ,'020' ,'053' ,'054' ,'083', '050' ) "
            cities = "CENTRAL"
        ElseIf txt_div.Text.Trim = "EASTERN" Then
            'cities = "LOCAL_OFFICE_NO IN ('073', '075', '076', '084', '085', '086' )"
            cities = "EASTERN"
        ElseIf txt_div.Text.Trim = "COASTAL" Then
            'cities = "LOCAL_OFFICE_NO IN ('087','088','094')"
            cities = "COASTAL"
        ElseIf txt_div.Text.Trim = "LOW COUNTRY" Then
            'cities = "LOCAL_OFFICE_NO IN ('042', '060', '061', '065','080')"
            cities = "LOW COUNTRY"
        ElseIf txt_div.Text.Trim = "SOUTHERN" Then
            'cities = "LOCAL_OFFICE_NO IN ('023','070', '071', '080','090','091', '020' ,'092','095')"
            cities = "SOUTHERN"
        ElseIf txt_div.Text.Trim = "WESTERN" Then
            'cities = "LOCAL_OFFICE_NO IN ('010', '011', '030', '031', '032', '033', '035', '050','052','055', '089')"
            cities = "WESTERN"
        End If


        If ADDR_PREFIX_1.Trim.Length = 0 Then
            add_prefix1 = ""
        Else
            add_prefix1 = ADDR_PREFIX_1
        End If
        If ADDR_PREFIX_2.Trim.Length = 0 Then
            add_prefix2 = ""
        Else
            add_prefix2 = ADDR_PREFIX_2
        End If
        If STREET_NM.Trim.Length = 0 Then
            street = ""
        Else
            street = STREET_NM
        End If
        If STREET_SUFFIX_CD.Trim.Length = 0 Then
            street_suf = ""
        Else
            street_suf = STREET_SUFFIX_CD
        End If

        Dim add_suf As String
        If ADDR_SUFFIX_CD.Trim.Length = 0 Then
            add_suf = ""
        Else
            add_suf = ADDR_SUFFIX_CD
        End If

        Dim st_loc_1_cd As String
        If STREET_LOCATION_1_CD.Trim.Length = 0 Then
            st_loc_1_cd = ""
        Else
            st_loc_1_cd = STREET_LOCATION_1_CD
        End If

        Dim st_loc_2_cd As String
        If STREET_LOCATION_2_CD.Trim.Length = 0 Then
            st_loc_2_cd = ""
        Else
            st_loc_2_cd = STREET_LOCATION_2_CD
        End If


        Dim dr As SqlDataReader = Nothing
        'Dim sql1 As String = "select distinct TOWN_NM as t_values from Address  where " & house & " and " & add_prefix1 & " and " & add_prefix2 & "  and " & street & " and " & street_suf & " and " & cities
        Dim sql1 As String = "SO_FrmQagettownname"
        'Dim sql1 As String = "Get_city_filter"
        'cmd = New SqlCommand("select ISNULL(max(PREMISE_NO),0) from Address  where " & house & " and " & add_prefix1 & " and " & add_prefix2 & "  and " & street & " and " & street_suf & " and " & cities, conn)
        ' cmd = New SqlCommand("select ISNULL(max(PREMISE_NO),0), TOWN_NM from Address  where " & house & " and " & add_prefix1 & " and " & add_prefix2 & "  and " & street & " and " & street_suf & " and " & cities & " group by TOWN_NM ", conn)
        cmd = New SqlCommand("Get_premise_no", conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@HOUSE_NO", house)
        cmd.Parameters.AddWithValue("@ADDR_PREFIX_1", add_prefix1)
        cmd.Parameters.AddWithValue("@ADDR_PREFIX_2", add_prefix2)
        cmd.Parameters.AddWithValue("@STREET_NM", street)
        cmd.Parameters.AddWithValue("@STREET_SUFFIX_CD", street_suf)
        cmd.Parameters.AddWithValue("@divison", cities)
        cmd.Parameters.AddWithValue("@ADDR_SUFFIX_CD", add_suf)
        'cmd.Parameters.AddWithValue("@STREET_LOCATION_1_CD", st_loc_1_cd)
        'cmd.Parameters.AddWithValue("@STREET_LOCATION_2_CD", st_loc_2_cd)
        dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)

        Dim COUNT As Integer = 0
        If dr.HasRows Then
            While (dr.Read)
                If COUNT = 0 Then
                    PREMISE_NO = dr(0).ToString
                    set_city(dr(1).ToString)
                    ' MsgBox(dr(1).ToString, MsgBoxStyle.Information, "Address Exception")
                End If
                COUNT = COUNT + 1
                If COUNT = 2 Then
                    Exit While
                End If
            End While

            If COUNT > 1 Then
                PREMISE_NO = ""
                MsgBox("Multiple Address, Choose correct city .", MsgBoxStyle.Information, "Address Exception")
                filter_cities(sql1)
            End If
            'If dr(0).ToString = 0 Then
            '    MsgBox("Address does not matches. Check it again.", MsgBoxStyle.Information, "Address Exception")
            '    PREMISE_NO = ""
            'Else
            '    PREMISE_NO = dr(0).ToString
            'End If
        Else
            PREMISE_NO = ""
            filter_cities("SO_frmQaGetcombovalue")
            MsgBox("Address does not matches. Check it again.", MsgBoxStyle.Information, "Address Exception")
        End If
        dr.Close()
        Return PREMISE_NO
    End Function

    Private Sub set_city(ByVal city As String)
        'If cmb_formtype.Text.Trim = "Yellow" Then
        '    cmb_y_city.SelectedValue = city
        'ElseIf cmb_formtype.Text.Trim = "MISC" Then
        '    cmb_l_city.SelectedValue = city
        'ElseIf cmb_formtype.Text.Trim = "ORIGINAL" Then
        '    cmb_q_city.SelectedValue = city
        'ElseIf cmb_formtype.Text.Trim = "ORIGINAL-R" Then
        '    cmb_r_city.SelectedValue = city
        'ElseIf cmb_formtype.Text.Trim = "ABANDON-II" Then
        '    cmb_a_city.SelectedValue = city
        'ElseIf cmb_formtype.Text.Trim = "Form-X" Then
        '    cmb_x_city.SelectedValue = city
        'ElseIf cmb_formtype.Text.Trim = "FORM-IX" Then
        '    cmb_9_city.SelectedValue = city
        'ElseIf cmb_formtype.Text.Trim = "ABANDON-I" Then
        '    cmb_8_city.SelectedValue = city
        'ElseIf cmb_formtype.Text.Trim = "Form-954" Then
        '    cmb_7_city.SelectedValue = city
        'ElseIf cmb_formtype.Text.Trim = "Form-80I" Then
        '    cmb_6_city.SelectedValue = city
        'ElseIf cmb_formtype.Text.Trim = "White" Then
        '    cmb_w_city.SelectedValue = city
        'ElseIf cmb_formtype.Text.Trim = "Orange" Then
        '    cmb_3_city.SelectedValue = city
        'ElseIf cmb_formtype.Text.Trim = "Form235-B-702" Then
        '    cmb_4_city.SelectedValue = city
        'ElseIf cmb_formtype.Text.Trim = "OD-9-6-38" Then
        '    cmb_5_add2.SelectedValue = city
        'End If

        '--100blk
        If cmb_formtype.Text.Trim = "FORM-100BLK" Then
            cmb_100b_city.Text = city
            '--100blk misc
        ElseIf cmb_formtype.Text.Trim = "FORM-100BLK-MISC" Then
            cmb_100b_m_city.Text = city
        '--200 block
        ElseIf cmb_formtype.Text.Trim = "FORM-200BLK" Then
            cmb_200b_city.Text = city
        ElseIf cmb_formtype.Text.Trim = "FORM-200BLK_PAGE1" Then
            cmb_200b_city_p1.Text = city

        ElseIf cmb_formtype.Text.Trim = "Yellow" Then
            cmb_y_city.Text = city
        ElseIf cmb_formtype.Text.Trim = "MISC" Then
            cmb_l_city.Text = city
        ElseIf cmb_formtype.Text.Trim = "ORIGINAL" Then
            cmb_q_city.Text = city
        ElseIf cmb_formtype.Text.Trim = "ORIGINAL-R" Then
            cmb_r_city.Text = city
        ElseIf cmb_formtype.Text.Trim = "ABANDON-II" Then
            cmb_a_city.Text = city
        ElseIf cmb_formtype.Text.Trim = "Form-X" Then
            cmb_x_city.Text = city
        ElseIf cmb_formtype.Text.Trim = "FORM-IX" Then
            cmb_9_city.Text = city
        ElseIf cmb_formtype.Text.Trim = "ABANDON-I" Then
            cmb_8_city.Text = city
        ElseIf cmb_formtype.Text.Trim = "Form-954" Then
            cmb_7_city.Text = city
        ElseIf cmb_formtype.Text.Trim = "Form-80I" Then
            cmb_6_city.Text = city
        ElseIf cmb_formtype.Text.Trim = "White" Then
            cmb_w_city.Text = city
        ElseIf cmb_formtype.Text.Trim = "Orange" Then
            cmb_3_city.Text = city
        ElseIf cmb_formtype.Text.Trim = "Form235-B-702" Then
            cmb_4_city.Text = city
        ElseIf cmb_formtype.Text.Trim = "OD-9-6-38" Then
            cmb_5_city.Text = city
        End If
    End Sub
    Private Sub filter_cities(ByVal sqls As String)
        '--100 block
        If cmb_formtype.Text.Trim = "FORM-100BLK" Then
            Fill_ComboFields(cmb_100b_city, sqls)
            '--FORM-100BLK-MISC
        ElseIf cmb_formtype.Text.Trim = "FORM-100BLK-MISC" Then
            Fill_ComboFields(cmb_100b_m_city, sqls)
        '--200 block
        ElseIf cmb_formtype.Text.Trim = "FORM-200BLK" Then
            Fill_ComboFields(cmb_200b_city, sqls)
        ElseIf cmb_formtype.Text.Trim = "FORM-200BLK_PAGE1" Then
            Fill_ComboFields(cmb_200b_city_p1, sqls)

        ElseIf cmb_formtype.Text.Trim = "Yellow" Then
            Fill_ComboFields(cmb_y_city, sqls)
        ElseIf cmb_formtype.Text.Trim = "MISC" Then
            Fill_ComboFields(cmb_l_city, sqls)
        ElseIf cmb_formtype.Text.Trim = "ORIGINAL" Then
            Fill_ComboFields(cmb_q_city, sqls)
        ElseIf cmb_formtype.Text.Trim = "ORIGINAL-R" Then
            Fill_ComboFields(cmb_r_city, sqls)
        ElseIf cmb_formtype.Text.Trim = "ABANDON-II" Then
            Fill_ComboFields(cmb_a_city, sqls)
        ElseIf cmb_formtype.Text.Trim = "Form-X" Then
            Fill_ComboFields(cmb_x_city, sqls)
        ElseIf cmb_formtype.Text.Trim = "FORM-IX" Then
            Fill_ComboFields(cmb_9_city, sqls)
        ElseIf cmb_formtype.Text.Trim = "ABANDON-I" Then
            Fill_ComboFields(cmb_8_city, sqls)
        ElseIf cmb_formtype.Text.Trim = "Form-954" Then
            Fill_ComboFields(cmb_7_city, sqls)
        ElseIf cmb_formtype.Text.Trim = "Form-80I" Then
            Fill_ComboFields(cmb_6_city, sqls)
        ElseIf cmb_formtype.Text.Trim = "White" Then
            Fill_ComboFields(cmb_w_city, sqls)
        ElseIf cmb_formtype.Text.Trim = "Orange" Then
            Fill_ComboFields(cmb_3_city, sqls)
        ElseIf cmb_formtype.Text.Trim = "Form235-B-702" Then
            Fill_ComboFields(cmb_4_city, sqls)
        ElseIf cmb_formtype.Text.Trim = "OD-9-6-38" Then
            Fill_ComboFields(cmb_5_city, sqls)

        End If

    End Sub
    Function getprev_fileid(ByVal file_id As Integer)
        Dim fileid As Integer
        If conn.State = 0 Then
            conn.Open()
        End If
        Dim dr As SqlDataReader = Nothing
        cmd = New SqlCommand("SO_FrmDataentry_PrevFileid", conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@fileid", file_id)
        cmd.Parameters.AddWithValue("@assignedto", commonUser.Common.uID)
        'cmd = New SqlCommand("select ISNULL(max(file_id),0) from tbl_parent  where (status = 'A' or status = 'E') and file_id < " & file_id & " and assigned_to = " & commonUser.Common.uID, conn)
        dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        If (dr.Read) Then
            fileid = CInt(dr(0).ToString)
        Else
            fileid = 0
        End If
        dr.Close()
        Return fileid
    End Function
    Function getfirst_fileid(ByVal file_id As Integer)
        Dim fileid As Integer
        If conn.State = 0 Then
            conn.Open()
        End If
        Dim dr As SqlDataReader = Nothing
        cmd = New SqlCommand("SO_FrmDataentry_FirstFileid", conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@fileid", file_id)
        cmd.Parameters.AddWithValue("@assignedto", commonUser.Common.uID)
        'cmd = New SqlCommand("select ISNULL(min(file_id),0) from tbl_parent  where (status = 'A' or status = 'E') and file_id < " & file_id & " and assigned_to = " & commonUser.Common.uID, conn)
        dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        If (dr.Read) Then
            fileid = CInt(dr(0).ToString)
        Else
            fileid = 0
        End If
        dr.Close()
        Return fileid
    End Function
    Private Sub get_folder_str(ByVal file_id As Integer)
        If conn.State = 0 Then
            conn.Open()
        End If
        Dim dr2 As SqlDataReader = Nothing
        cmd = New SqlCommand("get_folder_str", conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@file_id", file_id)
        'cmd = New SqlCommand("select  p3.foldername [OFFICE], p2.foldername [CITY], p1.foldername [PARENT FOLDER], p0.foldername [CHILD FOLDER] from tbl_parent pt, dbo.tbl_servicecards ts, dbo.tbl_relations tr ,dbo.tbl_folders p0, dbo.tbl_folders p1, dbo.tbl_folders p2 , dbo.tbl_folders p3 where tr.head_objectid = TS.id and TS.service_order = pt.service_order and p0.id = TR.tail_objectid and p0.parent_objectid = p1.id and p1.parent_objectid = p2.id and p2.parent_objectid = p3.id and pt.file_id =  " & file_id, conn)
        dr2 = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        If (dr2.Read) Then
            Me.txt_folderstr.Text = " > " & dr2(0).ToString & " > " & dr2(1).ToString & " > " & dr2(2).ToString & " > " & dr2(3).ToString
        End If
        dr2.Close()
    End Sub

    Private Sub getfiledetail(ByVal file_id As Integer)
        If conn.State = 0 Then
            conn.Open()
        End If
        Try
            If file_id = 0 Then

                AxPdf1.LoadFile(im_location & "no_image.pdf")
                Me.txt_fileid.Text = ""
                Me.txt_filedesc.Text = ""
                Exit Sub
            End If
        Catch ex As Exception
        End Try
        'Dim dr1 As SqlDataReader = Nothing
        'cmd = New SqlCommand("select file_id, File_name, status, file_type from tbl_parent  where file_id = " & file_id & " and assigned_to = " & commonUser.Common.uID, conn)
        'dr1 = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        'If (dr1.Read) Then
        '    Me.txt_fileid.Text = CInt(dr1(0).ToString)
        '    Me.txt_filedesc.Text = dr1(1).ToString
        '    If dr1(3).ToString.Trim.Length > 0 Then
        '        division = dr1(3).ToString.Trim
        '        im_loc = im_location & dr1(3).ToString.Trim & "\"
        '    End If
        '    AxPdf1.LoadFile(im_loc & dr1(1).ToString)
        'End If
        Dim dr1 As SqlDataReader = Nothing
        cmd = New SqlCommand("SO_FrmDataentry_getfiledetails", conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@imglocation", im_location)
        cmd.Parameters.AddWithValue("@fileid", file_id)
        cmd.Parameters.AddWithValue("@assignedto", commonUser.Common.uID)
        ' cmd = New SqlCommand("select tp.file_id, tp.File_name, tp.status, tp.file_type, replace(replace(replace(ti.externalref,'.tif','.pdf'),'C:\export test\','" & im_location & "'), '\\scana\shares\apps\apps\filenet\efi\Gas Project Files\','" & im_location & "') as externalref from tbl_parent tp, ( select replace(substring(externalref,charindex('Page',externalref),25),'.tif','.pdf') as file_name, externalref, service_order from dbo.tbl_so_imagefiles ) ti where tp.service_order = ti.service_order and tp.file_name = ti.file_name and tp.file_id = " & file_id & " and tp.assigned_to = " & commonUser.Common.uID, conn)
        dr1 = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        If (dr1.Read) Then
            Me.txt_fileid.Text = CInt(dr1(0).ToString)
            Me.txt_filedesc.Text = dr1(1).ToString
            'AxPdf1.LoadFile("C:\Low Country\Beaufort Office\Part 1\content\Page 3.pdf")
            AxPdf1.LoadFile(im_location + dr1(4).ToString)
            AxPdf1.gotoFirstPage()
            AxPdf1.setZoom(50)
            'AxPdf1.setPageMode("none")
            'AxPdf1.setShowToolbar(False)
            lblAddRef.Text = "Add Ref: " + dr1(5).ToString + " - " + dr1(6).ToString
            'lblAddRef.Text = "Add Ref:" + dr1(4).ToString.Substring(dr1(4).ToString.IndexOf("-"))
            txt_div.Text = dr1(3).ToString
        End If
        dr1.Close()
        If txt_filedesc.Text.Trim <> "" Then
            check_dual_pdf(txt_filedesc.Text)
        End If
        getfiledata(file_id)
        get_folder_str(file_id)

        If cmb_formtype.Text.Trim = "FORM-100BLK" Then
            txt_100b_add1.Focus()
        ElseIf cmb_formtype.Text.Trim = "FORM-100BLK-MISC" Then
            txt_100b_m_add1.Focus()
        Else
            txthouseNo1.Focus()
        End If
    End Sub
    Private Sub check_dual_pdf(ByVal file_desc As String)
        If conn.State = 0 Then
            conn.Open()
        End If
        Dim drpdf As SqlDataReader = Nothing
        'cmd = New SqlCommand("select replace(substring(externalref,charindex('Page',externalref),25),'.tif','.pdf') from tbl_so_imagefiles where service_order = (select service_order from tbl_parent where file_id = " & Me.txt_fileid.Text.Trim & " ) and substring(externalref,charindex('Page',externalref),25) <> replace('" & file_desc & "','.pdf','.tif')", conn)
        cmd = New SqlCommand("SO_FrmQacheckdualpdf", conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@fileid", Me.txt_fileid.Text.Trim)
        cmd.Parameters.AddWithValue("@file_desc", file_desc)

        drpdf = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        If (drpdf.Read) Then
            btn_flip.Enabled = True
            btn_flip2.Enabled = True
        Else
            btn_flip.Enabled = False
            btn_flip2.Enabled = False
        End If
        drpdf.Close()
    End Sub
    Private Sub btn_next_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_next.Click
        If (getnext_fileid(CInt(Me.txt_fileid.Text.Trim)) > 0) Then
            getfiledetail(getnext_fileid(CInt(Me.txt_fileid.Text.Trim)))
        Else
            MsgBox("No More image files available.", MsgBoxStyle.Information, "Next Image")
        End If
    End Sub
    Private Sub btn_prev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_prev.Click
        If (getprev_fileid(CInt(Me.txt_fileid.Text.Trim)) > 0) Then
            getfiledetail(getprev_fileid(CInt(Me.txt_fileid.Text.Trim)))
        Else
            MsgBox("No More image files available.", MsgBoxStyle.Information, "Previous Image")
        End If
    End Sub
    Private Sub btn_last_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_last.Click
        Dim a As DialogResult = MsgBox("Are you sure, you want to go to last record?", MsgBoxStyle.OkCancel, "Data Entry")
        If a = Windows.Forms.DialogResult.Cancel Then Exit Sub
        If (getlast_fileid(CInt(Me.txt_fileid.Text.Trim)) > 0) Then
            getfiledetail(getlast_fileid(CInt(Me.txt_fileid.Text.Trim)))
        Else
            MsgBox("No More image files available.", MsgBoxStyle.Information, "Last Image")
        End If
    End Sub
    Private Sub btn_first_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_first.Click
        Dim a As DialogResult = MsgBox("Are you sure, you want to go to first record?", MsgBoxStyle.OkCancel, "Data Entry")
        If a = Windows.Forms.DialogResult.Cancel Then Exit Sub

        If (getfirst_fileid(CInt(Me.txt_fileid.Text.Trim)) > 0) Then
            getfiledetail(getfirst_fileid(CInt(Me.txt_fileid.Text.Trim)))
        Else
            MsgBox("No More image files available.", MsgBoxStyle.Information, "First Image")
        End If
    End Sub
    Private Sub cmb_formtype_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_formtype.SelectedIndexChanged
        If cmb_formtype.Text.Trim = "Yellow" Then
            pnl_yellow.Visible = True
            pnl_white.Visible = False
            pnl_orange.Visible = False
            Panel4.Visible = False
            Panel5.Visible = False
            Panel6.Visible = False
            Panel7.Visible = False
            Panel8.Visible = False
            Panel9.Visible = False
            Panel10.Visible = False
            Panela.Visible = False
            Panelq.Visible = False
            Panelr.Visible = False
            Panell.Visible = False
            Panel_100b.Visible = False
            Panel_200b.Visible = False
            Panel_100b_Misc.Visible = False
            Panel_200b_Page1.Visible = False

            'Panel visibilty for FORM-100BLK
        ElseIf cmb_formtype.Text.Trim = "FORM-100BLK" Then
            Panel_100b.Visible = True
            pnl_yellow.Visible = False
            pnl_white.Visible = False
            pnl_orange.Visible = False
            Panel4.Visible = False
            Panel5.Visible = False
            Panel6.Visible = False
            Panel7.Visible = False
            Panel8.Visible = False
            Panel9.Visible = False
            Panel10.Visible = False
            Panela.Visible = False
            Panelq.Visible = False
            Panelr.Visible = False
            Panell.Visible = False
            Panel_200b.Visible = False
            Panel_100b_Misc.Visible = False
            Panel_200b_Page1.Visible = False
            txt_100b_add1.Focus()

        ElseIf cmb_formtype.Text.Trim = "FORM-100BLK-MISC" Then
            Panel_100b_Misc.Visible = True
            pnl_yellow.Visible = False
            pnl_white.Visible = False
            pnl_orange.Visible = False
            Panel4.Visible = False
            Panel5.Visible = False
            Panel6.Visible = False
            Panel7.Visible = False
            Panel8.Visible = False
            Panel9.Visible = False
            Panel10.Visible = False
            Panela.Visible = False
            Panelq.Visible = False
            Panelr.Visible = False
            Panell.Visible = False
            Panel_100b.Visible = False
            Panel_200b.Visible = False
            Panel_200b_Page1.Visible = False
            txt_100b_m_add1.Focus()
            ''Dinesh Behera
        ElseIf cmb_formtype.Text.Trim = "FORM-200BLK" Then
            Panel_200b.Visible = True
            Panell.Visible = False
            Panelr.Visible = False
            Panelq.Visible = False
            Panela.Visible = False
            Panel10.Visible = False
            Panel9.Visible = False
            Panel8.Visible = False
            Panel7.Visible = False
            Panel6.Visible = False
            Panel5.Visible = False
            Panel4.Visible = False
            pnl_yellow.Visible = False
            pnl_white.Visible = False
            pnl_orange.Visible = False
            Panel_100b.Visible = False
            Panel_100b_Misc.Visible = False
            Panel_200b_Page1.Visible = False
            txthouseNo1.Focus()

        ElseIf cmb_formtype.Text.Trim = "FORM-200BLK_PAGE1" Then
            Panel_200b_Page1.Visible = True
            Panel_200b.Visible = False
            Panell.Visible = False
            Panelr.Visible = False
            Panelq.Visible = False
            Panela.Visible = False
            Panel10.Visible = False
            Panel9.Visible = False
            Panel8.Visible = False
            Panel7.Visible = False
            Panel6.Visible = False
            Panel5.Visible = False
            Panel4.Visible = False
            pnl_yellow.Visible = False
            pnl_white.Visible = False
            pnl_orange.Visible = False
            Panel_100b.Visible = False
            Panel_100b_Misc.Visible = False
            txthouseNo.Focus()

        ElseIf cmb_formtype.Text.Trim = "White" Then
            pnl_white.Visible = True
            pnl_yellow.Visible = False
            pnl_orange.Visible = False
            Panel4.Visible = False
            Panel5.Visible = False
            Panel6.Visible = False
            Panel7.Visible = False
            Panel8.Visible = False
            Panel9.Visible = False
            Panel10.Visible = False
            Panela.Visible = False
            Panelq.Visible = False
            Panelr.Visible = False
            Panell.Visible = False
            Panel_100b.Visible = False
            Panel_200b.Visible = False
            Panel_100b_Misc.Visible = False
            Panel_200b_Page1.Visible = False
        ElseIf cmb_formtype.Text.Trim = "Orange" Then
            pnl_orange.Visible = True
            pnl_yellow.Visible = False
            pnl_white.Visible = False
            Panel4.Visible = False
            Panel5.Visible = False
            Panel6.Visible = False
            Panel7.Visible = False
            Panel8.Visible = False
            Panel9.Visible = False
            Panel10.Visible = False
            Panela.Visible = False
            Panelq.Visible = False
            Panelr.Visible = False
            Panell.Visible = False
            Panel_100b.Visible = False
            Panel_200b.Visible = False
            Panel_100b_Misc.Visible = False
            Panel_200b_Page1.Visible = False
        ElseIf cmb_formtype.Text.Trim = "Form235-B-702" Then
            Panel4.Visible = True
            Me.pnl_yellow.Visible = False
            Me.pnl_white.Visible = False
            Me.pnl_orange.Visible = False
            Panel5.Visible = False
            Panel6.Visible = False
            Panel7.Visible = False
            Panel8.Visible = False
            Panel9.Visible = False
            Panel10.Visible = False
            Panela.Visible = False
            Panelq.Visible = False
            Panelr.Visible = False
            Panell.Visible = False
            Panel_100b.Visible = False
            Panel_200b.Visible = False
            Panel_100b_Misc.Visible = False
            Panel_200b_Page1.Visible = False
        ElseIf cmb_formtype.Text.Trim = "OD-9-6-38" Then
            Panel5.Visible = True
            Panel4.Visible = False
            Me.pnl_yellow.Visible = False
            Me.pnl_white.Visible = False
            Me.pnl_orange.Visible = False
            Panel6.Visible = False
            Panel7.Visible = False
            Panel8.Visible = False
            Panel9.Visible = False
            Panel10.Visible = False
            Panela.Visible = False
            Panelq.Visible = False
            Panelr.Visible = False
            Panell.Visible = False
            Panel_100b.Visible = False
            Panel_200b.Visible = False
            Panel_100b_Misc.Visible = False
            Panel_200b_Page1.Visible = False
        ElseIf cmb_formtype.Text.Trim = "Form-80I" Then
            Panel6.Visible = True
            Panel5.Visible = False
            Panel4.Visible = False
            pnl_yellow.Visible = False
            pnl_white.Visible = False
            pnl_orange.Visible = False
            Panel7.Visible = False
            Panel8.Visible = False
            Panel9.Visible = False
            Panel10.Visible = False
            Panela.Visible = False
            Panelq.Visible = False
            Panelr.Visible = False
            Panell.Visible = False
            Panel_100b.Visible = False
            Panel_200b.Visible = False
            Panel_100b_Misc.Visible = False
            Panel_200b_Page1.Visible = False
        ElseIf cmb_formtype.Text.Trim = "Form-954" Then
            Panel7.Visible = True
            Panel6.Visible = False
            Panel5.Visible = False
            Panel4.Visible = False
            pnl_yellow.Visible = False
            pnl_white.Visible = False
            pnl_orange.Visible = False
            Panel8.Visible = False
            Panel9.Visible = False
            Panel10.Visible = False
            Panela.Visible = False
            Panelq.Visible = False
            Panelr.Visible = False
            Panell.Visible = False
            Panel_100b.Visible = False
            Panel_200b.Visible = False
            Panel_100b_Misc.Visible = False
            Panel_200b_Page1.Visible = False
        ElseIf cmb_formtype.Text.Trim = "ABANDON-I" Then
            Panel8.Visible = True
            Panel7.Visible = False
            Panel6.Visible = False
            Panel5.Visible = False
            Panel4.Visible = False
            pnl_yellow.Visible = False
            pnl_white.Visible = False
            pnl_orange.Visible = False
            Panel9.Visible = False
            Panel10.Visible = False
            Panela.Visible = False
            Panelq.Visible = False
            Panelr.Visible = False
            Panell.Visible = False
            Panel_100b.Visible = False
            Panel_200b.Visible = False
            Panel_100b_Misc.Visible = False
            Panel_200b_Page1.Visible = False
        ElseIf cmb_formtype.Text.Trim = "FORM-IX" Then
            Panel9.Visible = True
            Panel8.Visible = False
            Panel7.Visible = False
            Panel6.Visible = False
            Panel5.Visible = False
            Panel4.Visible = False
            pnl_yellow.Visible = False
            pnl_white.Visible = False
            pnl_orange.Visible = False
            Panel10.Visible = False
            Panela.Visible = False
            Panelq.Visible = False
            Panelr.Visible = False
            Panell.Visible = False
            Panel_100b.Visible = False
            Panel_200b.Visible = False
            Panel_100b_Misc.Visible = False
            Panel_200b_Page1.Visible = False
        ElseIf cmb_formtype.Text.Trim = "Form-X" Then
            Panel10.Visible = True
            Panel9.Visible = False
            Panel8.Visible = False
            Panel7.Visible = False
            Panel6.Visible = False
            Panel5.Visible = False
            Panel4.Visible = False
            pnl_yellow.Visible = False
            pnl_white.Visible = False
            pnl_orange.Visible = False
            Panela.Visible = False
            Panelq.Visible = False
            Panelr.Visible = False
            Panell.Visible = False
            Panel_100b.Visible = False
            Panel_200b.Visible = False
            Panel_100b_Misc.Visible = False
            Panel_200b_Page1.Visible = False
        ElseIf cmb_formtype.Text.Trim = "ABANDON-II" Then
            Panela.Visible = True
            Panel10.Visible = False
            Panel9.Visible = False
            Panel8.Visible = False
            Panel7.Visible = False
            Panel6.Visible = False
            Panel5.Visible = False
            Panel4.Visible = False
            pnl_yellow.Visible = False
            pnl_white.Visible = False
            pnl_orange.Visible = False
            Panelq.Visible = False
            Panelr.Visible = False
            Panell.Visible = False
            Panel_100b.Visible = False
            Panel_200b.Visible = False
            Panel_100b_Misc.Visible = False
            Panel_200b_Page1.Visible = False
        ElseIf cmb_formtype.Text.Trim = "ORIGINAL" Then
            Panelq.Visible = True
            Panela.Visible = False
            Panel10.Visible = False
            Panel9.Visible = False
            Panel8.Visible = False
            Panel7.Visible = False
            Panel6.Visible = False
            Panel5.Visible = False
            Panel4.Visible = False
            pnl_yellow.Visible = False
            pnl_white.Visible = False
            pnl_orange.Visible = False
            Panelr.Visible = False
            Panell.Visible = False
            Panel_100b.Visible = False
            Panel_200b.Visible = False
            Panel_100b_Misc.Visible = False
            Panel_200b_Page1.Visible = False
        ElseIf cmb_formtype.Text.Trim = "ORIGINAL-R" Then
            Panelr.Visible = True
            Panelq.Visible = False
            Panela.Visible = False
            Panel10.Visible = False
            Panel9.Visible = False
            Panel8.Visible = False
            Panel7.Visible = False
            Panel6.Visible = False
            Panel5.Visible = False
            Panel4.Visible = False
            pnl_yellow.Visible = False
            pnl_white.Visible = False
            pnl_orange.Visible = False
            Panell.Visible = False
            Panel_100b.Visible = False
            Panel_200b.Visible = False
            Panel_100b_Misc.Visible = False
            Panel_200b_Page1.Visible = False
        ElseIf cmb_formtype.Text.Trim = "MISC" Then
            Panell.Visible = True
            Panelr.Visible = False
            Panelq.Visible = False
            Panela.Visible = False
            Panel10.Visible = False
            Panel9.Visible = False
            Panel8.Visible = False
            Panel7.Visible = False
            Panel6.Visible = False
            Panel5.Visible = False
            Panel4.Visible = False
            pnl_yellow.Visible = False
            pnl_white.Visible = False
            pnl_orange.Visible = False
            Panel_100b.Visible = False
            Panel_200b.Visible = False
            Panel_100b_Misc.Visible = False
            Panel_200b_Page1.Visible = False
        End If
        Fill_All_ComboBoxes()
        resetfiledata()
    End Sub
    Private Sub getfiledata(ByVal file_id As Integer)
        If conn.State = 0 Then
            conn.Open()
        End If
        Dim dr As SqlDataReader = Nothing
        cmd = New SqlCommand("SO_FrmDataentry_getfiledata", conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@fileid", file_id)
        dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        If (dr.Read) Then
            Me.btn_submit.Text = "UPDATE"
            Me.cmb_formtype.Text = dr(2).ToString

            ''Assign 100BLK
            If dr(2).ToString = "FORM-100BLK" Then
                txt_100b_add1.Text = dr(3).ToString
                cmb_100b_add2.Text = dr(4).ToString
                cmb_100b_add2_1.Text = dr(5).ToString
                cmb_100b_add3.Text = dr(6).ToString
                cmb_100b_add4_1.Text = dr(7).ToString
                cmb_100b_add4.Text = dr(8).ToString
                'txt_100b_name.Text = dr(9).ToString

                If CDate(dr(10).ToString) = #1/1/1900# Then
                    txt_100b_dated.Text = ""
                Else
                    txt_100b_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                End If
                If CDate(dr(50).ToString) = #1/1/1900# Then
                    txt_100b_dateabandon.Text = ""
                Else
                    txt_100b_dateabandon.Text = Format(dr(50), "MM/dd/yyyy").ToString()
                End If

                cmb_100b_city.Text = dr(11).ToString
                'txt_100b_subdiv.Text = dr(12).ToString
                'txt_100b_serno.Text = dr(13).ToString
                cmb_100b_pipesize.SelectedValue = dr(14).ToString
                cmb_100b_pipekind.SelectedValue = dr(15).ToString
                cmb_100b_pressure.SelectedValue = dr(16).ToString
                cmb_100b_tapsize.SelectedValue = dr(17).ToString
                'txt_100b_ser_ft.Text = dr(18).ToString
                'txt_100b_ser_in.Text = dr(19).ToString
                'txt_100b_depser_ft.Text = dr(20).ToString
                'txt_100b_depser_in.Text = dr(21).ToString
                txt_100b_mainln_ft.Text = dr(22).ToString
                'txt_100b_mainln_in.Text = dr(23).ToString
                txt_100b_propln_ft.Text = dr(24).ToString
                'txt_100b_propln_in.Text = dr(25).ToString
                cmb_100b_mainsize.SelectedValue = dr(26).ToString
                cmb_100b_maintype.SelectedValue = dr(27).ToString
                txt_100b_deptmain.Text = dr(28).ToString
                cmb_100b_testedwith.SelectedValue = dr(29).ToString
                cmb_100b_testedto.SelectedValue = dr(30).ToString
                txt_100b_psigmin.Text = dr(31).ToString
                'txt_100b_installedby.Text = dr(32).ToString
                'txt_100b_foreman.Text = dr(33).ToString
                txt_100b_remark.Text = dr(34).ToString
                txt_100b_premiseno.Text = dr(35).ToString
                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString
                txt_100b_lenmtrtomain.Text = dr(42).ToString
                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString

                txt_100b_installedyear.Text = dr(75).ToString
                txt_100b_a_ps_reading.Text = dr(76).ToString
                txt_100b_tot_anodes_1.Text = dr(77).ToString
                txt_100b_tot_anodes_17.Text = dr(78).ToString
                txt_100b_lr.Text = dr(79).ToString
                txt_100b_incheswc.Text = dr(85).ToString
                txt_100b_add1.Focus()

                ''Assign FORM-100BLK-MISC
            ElseIf dr(2).ToString = "FORM-100BLK-MISC" Then
                txt_100b_m_add1.Text = dr(3).ToString
                cmb_100b_m_add2.Text = dr(4).ToString
                cmb_100b_m_add2_1.Text = dr(5).ToString
                cmb_100b_m_add3.Text = dr(6).ToString
                cmb_100b_m_add4_1.Text = dr(7).ToString
                cmb_100b_m_add4.Text = dr(8).ToString
                'txt_100b_m_name.Text = dr(9).ToString

                If CDate(dr(10).ToString) = #1/1/1900# Then
                    txt_100b_m_dated.Text = ""
                Else
                    txt_100b_m_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                End If
                If CDate(dr(50).ToString) = #1/1/1900# Then
                    txt_100b_m_dateabandon.Text = ""
                Else
                    txt_100b_m_dateabandon.Text = Format(dr(50), "MM/dd/yyyy").ToString()
                End If

                cmb_100b_m_city.Text = dr(11).ToString
                'txt_100b_m_subdiv.Text = dr(12).ToString
                'txt_100b_m_serno.Text = dr(13).ToString
                cmb_100b_m_pipesize.SelectedValue = dr(14).ToString
                cmb_100b_m_pipekind.SelectedValue = dr(15).ToString
                cmb_100b_m_pressure.SelectedValue = dr(16).ToString
                cmb_100b_m_tapsize.SelectedValue = dr(17).ToString
                'txt_100b_m_ser_ft.Text = dr(18).ToString
                'txt_100b_m_ser_in.Text = dr(19).ToString
                'txt_100b_m_depser_ft.Text = dr(20).ToString
                'txt_100b_m_depser_in.Text = dr(21).ToString
                txt_100b_m_mainln_ft.Text = dr(22).ToString
                'txt_100b_m_mainln_in.Text = dr(23).ToString
                txt_100b_m_propln_ft.Text = dr(24).ToString
                'txt_100b_m_propln_in.Text = dr(25).ToString
                cmb_100b_m_mainsize.SelectedValue = dr(26).ToString
                cmb_100b_m_maintype.SelectedValue = dr(27).ToString
                txt_100b_m_deptmain.Text = dr(28).ToString
                cmb_100b_m_testedwith.SelectedValue = dr(29).ToString
                cmb_100b_m_testedto.SelectedValue = dr(30).ToString
                txt_100b_m_psigmin.Text = dr(31).ToString
                'txt_100b_m_installedby.Text = dr(32).ToString
                'txt_100b_m_foreman.Text = dr(33).ToString
                txt_100b_m_remark.Text = dr(34).ToString
                txt_100b_m_premiseno.Text = dr(35).ToString
                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString
                txt_100b_m_lenmtrtomain.Text = dr(42).ToString
                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString

                txt_100b_m_installedyear.Text = dr(75).ToString
                txt_100b_m_a_ps_reading.Text = dr(76).ToString
                txt_100b_m_tot_anodes_1.Text = dr(77).ToString
                txt_100b_m_tot_anodes_17.Text = dr(78).ToString
                txt_100b_m_lr.Text = dr(79).ToString
                txt_100b_m_incheswc.Text = dr(85).ToString
                txt_100b_m_add1.Focus()

            ElseIf dr(2).ToString = "FORM-200BLK" Then
                'txt_fileid.Text = ""
                'txt_filedesc.Text = ""
                'cmb_formtype.Text = ""
                txthouseNo1.Text = dr(3).ToString
                cmbPrefix11.Text = dr(4).ToString
                cmbPrefix22.Text = dr(5).ToString
                cmbStreetname1.Text = dr(6).ToString
                cmbsuffix12.Text = dr(7).ToString
                cmbsuffix22.Text = dr(8).ToString
                'txt_y_name.Text = dr(9).ToString

                If CDate(dr(10).ToString) = #1/1/1900# Then
                    txtDate1.Text = ""
                Else
                    txtDate1.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                End If
                If CDate(dr(50).ToString) = #1/1/1900# Then
                    txt_Retired_date.Text = ""
                Else
                    txt_Retired_date.Text = Format(dr(50), "MM/dd/yyyy").ToString()
                End If

                cmb_200b_city.Text = dr(11).ToString
                cmb_pipe_size.SelectedValue = dr(14).ToString
                cmb_typeofservice.SelectedValue = dr(15).ToString
                cmbTapSize.SelectedValue = dr(17).ToString
                txtmainToBackOfCurb.Text = dr(18).ToString
                cmb_main_size.SelectedValue = dr(26).ToString
                cmb_main_type.SelectedValue = dr(27).ToString
                Me.txtDepthMain.Text = dr(28).ToString
                cmbMedium.SelectedValue = dr(29).ToString
                cmbPressure.SelectedValue = dr(30).ToString
                txt_length1.Text = dr(31).ToString
                txt_Remarks.Text = dr(34).ToString

                txt_Remarks.Text = dr(34).ToString
                txt_200b_premiseno.Text = dr(35).ToString

                txt_pipesize_length.Text = dr(42).ToString

                chk2lbSystem.Checked = dr(80).ToString
                'chk2lbSystemNo1.Checked = dr(112).ToString
                txtPS_Reading.Text = dr(76).ToString
                cmbRetiredSize.SelectedValue = dr(81).ToString
                txtUnitsRetired.Text = dr(82).ToString
                txtLengthRetired.Text = dr(83).ToString
                txtRetiredQnty.Text = dr(84).ToString

                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString
                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString
                txthouseNo1.Focus()

            ElseIf dr(2).ToString = "FORM-200BLK_PAGE1" Then
                txthouseNo.Text = dr(3).ToString
                cmbPrefix1.Text = dr(4).ToString
                cmbPrefix2.Text = dr(5).ToString
                cmbStreetname.Text = dr(6).ToString
                cmbsuffix1.Text = dr(7).ToString
                cmbsuffix2.Text = dr(8).ToString

                If CDate(dr(10).ToString) = #1/1/1900# Then
                    txtDate_p1.Text = ""
                Else
                    txtDate_p1.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                End If
                If CDate(dr(50).ToString) = #1/1/1900# Then
                    txt_Retired_date_p1.Text = ""
                Else
                    txt_Retired_date_p1.Text = Format(dr(50), "MM/dd/yyyy").ToString()
                End If

                cmb_200b_city_p1.Text = dr(11).ToString
                cmb_pipe_size_p1.SelectedValue = dr(14).ToString
                cmb_typeofservice_p1.SelectedValue = dr(15).ToString
                cmbTapSize_p1.SelectedValue = dr(17).ToString
                txtmainToBackOfCurb_p1.Text = dr(18).ToString
                cmb_main_size_p1.SelectedValue = dr(26).ToString
                cmb_main_type_p1.SelectedValue = dr(27).ToString
                Me.txtDepthMain_p1.Text = dr(28).ToString
                cmbMedium_p1.SelectedValue = dr(29).ToString
                cmbPressure_p1.SelectedValue = dr(30).ToString
                txt_length1_p1.Text = dr(31).ToString
                txt_Remarks_p1.Text = dr(34).ToString

                txt_Remarks_p1.Text = dr(34).ToString
                txt_200b_premiseno_p1.Text = dr(35).ToString

                txt_pipesize_length_p1.Text = dr(42).ToString

                chk2lbSystem_p1.Checked = dr(80).ToString
                'chk2lbSystemNo1.Checked = dr(112).ToString
                txtPS_Reading_p1.Text = dr(76).ToString
                cmbRetiredSize_p1.SelectedValue = dr(81).ToString
                txtUnitsRetired_p1.Text = dr(82).ToString
                txtLengthRetired_p1.Text = dr(83).ToString
                txtRetiredQnty_p1.Text = dr(84).ToString

                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString
                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString
                txthouseNo.Focus()

            ElseIf dr(2).ToString = "Yellow" Then
                'txt_fileid.Text = ""
                'txt_filedesc.Text = ""
                'cmb_formtype.Text = ""
                txt_y_add1.Text = dr(3).ToString
                cmb_y_add2.Text = dr(4).ToString
                cmb_y_add2_1.Text = dr(5).ToString

                cmb_y_add3.Text = dr(6).ToString
                cmb_y_add4_1.Text = dr(7).ToString
                cmb_y_add4.Text = dr(8).ToString
                'txt_y_name.Text = dr(9).ToString
                txt_y_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                cmb_y_city.Text = dr(11).ToString
                txt_y_subdiv.Text = dr(12).ToString
                txt_y_serno.Text = dr(13).ToString
                cmb_y_pipesize.SelectedValue = dr(14).ToString
                cmb_y_pipekind.SelectedValue = dr(15).ToString
                cmb_y_pressure.SelectedValue = dr(16).ToString
                cmb_y_tapzize.SelectedValue = dr(17).ToString
                txt_y_ser_ft.Text = dr(18).ToString
                txt_y_ser_in.Text = dr(19).ToString
                txt_y_depser_ft.Text = dr(20).ToString
                txt_y_depser_in.Text = dr(21).ToString
                txt_y_mainln_ft.Text = dr(22).ToString
                txt_y_mainln_in.Text = dr(23).ToString
                txt_y_propln_ft.Text = dr(24).ToString
                txt_y_propln_in.Text = dr(25).ToString
                cmb_y_mainsize.SelectedValue = dr(26).ToString
                cmb_y_maintype.SelectedValue = dr(27).ToString
                txt_y_deptmain.Text = dr(28).ToString
                cmb_y_testedwith.SelectedValue = dr(29).ToString
                cmb_y_testedto.SelectedValue = dr(30).ToString
                txt_y_psigmin.Text = dr(31).ToString
                txt_y_installedby.Text = dr(32).ToString
                txt_y_foreman.Text = dr(33).ToString
                txt_y_remark.Text = dr(34).ToString
                txt_y_premiseno.Text = dr(35).ToString
                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString
                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString

            ElseIf dr(2).ToString = "ORIGINAL" Then

                txt_q_add1.Text = dr(3).ToString
                cmb_q_add2.Text = dr(4).ToString
                cmb_q_add2_1.Text = dr(5).ToString
                cmb_q_add3.Text = dr(6).ToString
                cmb_q_add4_1.Text = dr(7).ToString
                cmb_q_add4.Text = dr(8).ToString

                txt_q_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                cmb_q_city.Text = dr(11).ToString

                cmb_q_pipesize.SelectedValue = dr(14).ToString
                cmb_q_pipekind.SelectedValue = dr(15).ToString

                cmb_q_mainsize.SelectedValue = dr(26).ToString
                cmb_q_maintype.SelectedValue = dr(27).ToString

                cmb_q_testedwith.SelectedValue = dr(29).ToString
                cmb_q_testedto.SelectedValue = dr(30).ToString
                txt_q_psigmin.Text = dr(31).ToString

                txt_q_remark.Text = dr(34).ToString
                txt_q_premiseno.Text = dr(35).ToString
                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString
                txt_q_lenmtrtomain.Text = dr(42).ToString
                cmb_q_coating.Text = dr(49).ToString

                chk_q_noblow.Checked = dr(52).ToString

                chk_q_defcoatcor.Checked = dr(56).ToString
                chk_q_multimeter.Checked = dr(57).ToString

                chk_q_serstop.Checked = dr(58).ToString
                chk_q_cathodpro.Checked = dr(59).ToString
                chk_q_tee.Checked = dr(60).ToString
                chk_q_taptee.Checked = dr(61).ToString
                chk_q_galvanized.Checked = dr(62).ToString
                txt_q_ttsize.Text = dr(63).ToString
                txt_q_ttinlet.Text = dr(64).ToString
                txt_q_ttoutlet.Text = dr(65).ToString
                chk_q_insulated.Checked = dr(66).ToString
                chk_q_anoderiser.Checked = dr(67).ToString
                txt_q_otheranode.Text = dr(68).ToString

                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString
            ElseIf dr(2).ToString = "MISC" Then

                txt_l_add1.Text = dr(3).ToString
                cmb_l_add2.Text = dr(4).ToString
                cmb_l_add2_1.Text = dr(5).ToString
                cmb_l_add3.Text = dr(6).ToString
                cmb_l_add4_1.Text = dr(7).ToString
                cmb_l_add4.Text = dr(8).ToString


                cmb_l_city.Text = dr(11).ToString



                txt_l_remark.Text = dr(34).ToString
                txt_l_premiseno.Text = dr(35).ToString
                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString
                cmb_l_misCtype.Text = dr(70).ToString

                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString
            ElseIf dr(2).ToString = "ORIGINAL-R" Then

                txt_r_add1.Text = dr(3).ToString
                cmb_r_add2.Text = dr(4).ToString
                cmb_r_add2_1.Text = dr(5).ToString
                cmb_r_add3.Text = dr(6).ToString
                cmb_r_add4_1.Text = dr(7).ToString
                cmb_r_add4.Text = dr(8).ToString

                txt_r_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                cmb_r_city.Text = dr(11).ToString

                cmb_r_pipesize.SelectedValue = dr(14).ToString
                cmb_r_pipekind.SelectedValue = dr(15).ToString

                cmb_r_mainsize.SelectedValue = dr(26).ToString
                cmb_r_maintype.SelectedValue = dr(27).ToString

                cmb_r_testedwith.SelectedValue = dr(29).ToString
                cmb_r_testedto.SelectedValue = dr(30).ToString
                txt_r_psigmin.Text = dr(31).ToString

                txt_r_remark.Text = dr(34).ToString
                txt_r_premiseno.Text = dr(35).ToString
                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString
                txt_r_lenmtrtomain.Text = dr(42).ToString


                chk_r_noblow.Checked = dr(52).ToString

                chk_r_defcoatcor.Checked = dr(56).ToString


                chk_r_serstop.Checked = dr(58).ToString
                chk_r_cathodpro.Checked = dr(59).ToString

                txt_r_ttsize.Text = dr(63).ToString
                txt_r_ttinlet.Text = dr(64).ToString
                txt_r_ttoutlet.Text = dr(65).ToString
                chk_r_insulated.Checked = dr(66).ToString
                chk_r_anoderiser.Checked = dr(67).ToString
                txt_r_otheranode.Text = dr(68).ToString
                cmb_r_connection_data.Text = dr(69).ToString
                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString
            ElseIf dr(2).ToString = "ABANDON-II" Then

                txt_a_add1.Text = dr(3).ToString
                cmb_a_add2.Text = dr(4).ToString
                cmb_a_add2_1.Text = dr(5).ToString
                cmb_a_add3.Text = dr(6).ToString
                cmb_a_add4_1.Text = dr(7).ToString
                cmb_a_add4.Text = dr(8).ToString

                cmb_a_city.Text = dr(11).ToString

                cmb_a_mainsize.SelectedValue = dr(26).ToString
                cmb_a_maintype.SelectedValue = dr(27).ToString

                cmb_a_testedwith.SelectedValue = dr(29).ToString

                txt_a_installedby.Text = dr(32).ToString

                txt_a_remark.Text = dr(34).ToString
                txt_a_premiseno.Text = dr(35).ToString
                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString
                txt_a_lenmtrtomain.Text = dr(42).ToString
                txt_a_dateabandon.Text = Format(dr(50), "MM/dd/yyyy").ToString()
                cmb_a_reasonabandon.SelectedValue = dr(51).ToString
                chk_a_noblow.Checked = dr(52).ToString
                chk_a_gassource.Checked = dr(53).ToString
                chk_a_tappingtee.Checked = dr(54).ToString
                chk_a_linesealed.Checked = dr(55).ToString
                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString
            ElseIf dr(2).ToString = "Form-X" Then
                'txt_fileid.Text = ""
                'txt_filedesc.Text = ""
                'cmb_formtype.Text = ""
                txt_x_add1.Text = dr(3).ToString
                cmb_x_add2.Text = dr(4).ToString
                cmb_x_add2_1.Text = dr(5).ToString
                cmb_x_add3.Text = dr(6).ToString
                cmb_x_add4_1.Text = dr(7).ToString
                cmb_x_add4.Text = dr(8).ToString

                txt_x_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                cmb_x_city.Text = dr(11).ToString

                cmb_x_pipesize.SelectedValue = dr(14).ToString
                cmb_x_pipekind.SelectedValue = dr(15).ToString
                txt_x_mainln_ft.Text = dr(22).ToString
                txt_x_mainln_in.Text = dr(23).ToString
                txt_x_propln_ft.Text = dr(24).ToString
                txt_x_propln_in.Text = dr(25).ToString
                cmb_x_mainsize.SelectedValue = dr(26).ToString
                cmb_x_maintype.SelectedValue = dr(27).ToString

                cmb_x_testedwith.SelectedValue = dr(29).ToString
                cmb_x_testedto.SelectedValue = dr(30).ToString

                txt_x_installedby.Text = dr(32).ToString

                txt_x_remark.Text = dr(34).ToString
                txt_x_premiseno.Text = dr(35).ToString
                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString
                txt_x_lenmtrtomain.Text = dr(42).ToString
                cmb_x_coating.Text = dr(49).ToString
                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString
            ElseIf dr(2).ToString = "FORM-IX" Then

                txt_9_add1.Text = dr(3).ToString
                cmb_9_add2.Text = dr(4).ToString
                cmb_9_add2_1.Text = dr(5).ToString
                cmb_9_add3.Text = dr(6).ToString
                cmb_9_add4_1.Text = dr(7).ToString
                cmb_9_add4.Text = dr(8).ToString

                txt_9_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                cmb_9_city.Text = dr(11).ToString

                txt_9_serno.Text = dr(13).ToString
                cmb_9_pipesize.SelectedValue = dr(14).ToString
                cmb_9_pipekind.SelectedValue = dr(15).ToString

                cmb_9_tapzize.SelectedValue = dr(17).ToString

                cmb_9_mainsize.SelectedValue = dr(26).ToString
                cmb_9_maintype.SelectedValue = dr(27).ToString

                txt_9_foreman.Text = dr(33).ToString
                txt_9_remark.Text = dr(34).ToString
                txt_9_premiseno.Text = dr(35).ToString
                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString

                txt_9_lenmtrtomain.Text = dr(42).ToString
                cmb_9_coating.Text = dr(49).ToString
                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString
            ElseIf cmb_formtype.Text.Trim = "Form-954" Then

                txt_7_add1.Text = dr(3).ToString
                cmb_7_add2.Text = dr(4).ToString
                cmb_7_add2_1.Text = dr(5).ToString
                cmb_7_add3.Text = dr(6).ToString
                cmb_7_add4_1.Text = dr(7).ToString
                cmb_7_add4.Text = dr(8).ToString

                txt_7_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                cmb_7_city.Text = dr(11).ToString

                cmb_7_pipesize.SelectedValue = dr(14).ToString
                cmb_7_pipekind.SelectedValue = dr(15).ToString

                cmb_7_tapzize.SelectedValue = dr(17).ToString

                txt_7_mainln_ft.Text = dr(22).ToString
                txt_7_mainln_in.Text = dr(23).ToString

                cmb_7_mainsize.SelectedValue = dr(26).ToString
                cmb_7_maintype.SelectedValue = dr(27).ToString

                txt_7_remark.Text = dr(34).ToString
                txt_7_premiseno.Text = dr(35).ToString
                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString
                txt_7_lenmtrtomain.Text = dr(42).ToString
                cmb_7_naturework.SelectedValue = dr(44).ToString
                cmb_7_kindjoint.SelectedValue = dr(45).ToString
                txt_7_splitsleeve.Text = dr(46).ToString
                txt_7_loccock.Text = dr(47).ToString
                txt_7_kindbox.Text = dr(48).ToString
                cmb_7_coating.Text = dr(49).ToString
                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString
            ElseIf cmb_formtype.Text.Trim = "ABANDON-I" Then
                txt_8_add1.Text = dr(3).ToString
                cmb_8_add2.Text = dr(4).ToString
                cmb_8_add2_1.Text = dr(5).ToString
                cmb_8_add3.Text = dr(6).ToString
                cmb_8_add4_1.Text = dr(7).ToString
                cmb_8_add4.Text = dr(8).ToString

                txt_8_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                cmb_8_city.Text = dr(11).ToString

                cmb_8_mainsize.SelectedValue = dr(26).ToString
                cmb_8_maintype.SelectedValue = dr(27).ToString

                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString

                txt_8_remark.Text = dr(34).ToString
                txt_8_premiseno.Text = dr(35).ToString

                cmb_8_coating.SelectedValue = dr(49).ToString
                txt_8_dateabandon.Text = Format(dr(50), "MM/dd/yyyy").ToString()
                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString
            ElseIf dr(2).ToString = "Form-80I" Then
                'txt_fileid.Text = ""
                'txt_filedesc.Text = ""
                'cmb_formtype.Text = ""
                txt_6_add1.Text = dr(3).ToString
                cmb_6_add2.Text = dr(4).ToString
                cmb_6_add2_1.Text = dr(5).ToString
                cmb_6_add3.Text = dr(6).ToString
                cmb_6_add4_1.Text = dr(7).ToString
                cmb_6_add4.Text = dr(8).ToString

                txt_6_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                cmb_6_city.Text = dr(11).ToString


                cmb_6_pipesize.SelectedValue = dr(14).ToString
                cmb_6_pipekind.SelectedValue = dr(15).ToString

                txt_6_ser_ft.Text = dr(18).ToString
                txt_6_ser_in.Text = dr(19).ToString
                txt_6_depser_ft.Text = dr(20).ToString
                txt_6_depser_in.Text = dr(21).ToString

                cmb_6_mainsize.SelectedValue = dr(26).ToString
                cmb_6_maintype.SelectedValue = dr(27).ToString
                txt_6_deptmain.Text = dr(28).ToString
                cmb_6_testedwith.SelectedValue = dr(29).ToString
                cmb_6_testedto.SelectedValue = dr(30).ToString
                txt_6_psigmin.Text = dr(31).ToString

                txt_6_remark.Text = dr(34).ToString
                txt_6_premiseno.Text = dr(35).ToString
                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString
                txt_6_lenmtrtomain.Text = dr(42).ToString
                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString
            ElseIf dr(2).ToString = "OD-9-6-38" Then
                'txt_fileid.Text = ""
                'txt_filedesc.Text = ""
                'cmb_formtype.Text = ""
                txt_5_add1.Text = dr(3).ToString
                cmb_5_add2.Text = dr(4).ToString
                cmb_5_add2_1.Text = dr(5).ToString
                cmb_5_add3.Text = dr(6).ToString
                cmb_5_add4_1.Text = dr(7).ToString
                cmb_5_add4.Text = dr(8).ToString

                txt_5_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                cmb_5_city.Text = dr(11).ToString

                txt_5_serno.Text = dr(13).ToString
                cmb_5_pipesize.SelectedValue = dr(14).ToString
                cmb_5_pipekind.SelectedValue = dr(15).ToString

                txt_5_ser_ft.Text = dr(18).ToString

                txt_5_depser_ft.Text = dr(20).ToString


                txt_5_propln_ft.Text = dr(24).ToString

                txt_5_remark.Text = dr(34).ToString
                txt_5_premiseno.Text = dr(35).ToString
                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString
                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString
            ElseIf dr(2).ToString = "Form235-B-702" Then
                'txt_fileid.Text = ""
                'txt_filedesc.Text = ""
                'cmb_formtype.Text = ""
                txt_4_add1.Text = dr(3).ToString
                cmb_4_add2.Text = dr(4).ToString
                cmb_4_add2_1.Text = dr(5).ToString
                cmb_4_add3.Text = dr(6).ToString
                cmb_4_add4_1.Text = dr(7).ToString
                cmb_4_add4.Text = dr(8).ToString
                'txt_4_name.Text = dr(9).ToString
                txt_4_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                cmb_4_city.Text = dr(11).ToString

                cmb_4_pipesize.SelectedValue = dr(14).ToString
                cmb_4_pipekind.SelectedValue = dr(15).ToString
                cmb_4_pressure.SelectedValue = dr(16).ToString

                cmb_4_mainsize.SelectedValue = dr(26).ToString
                cmb_4_maintype.SelectedValue = dr(27).ToString
                txt_4_deptmain.Text = dr(28).ToString
                cmb_4_testedwith.SelectedValue = dr(29).ToString
                cmb_4_testedto.SelectedValue = dr(30).ToString
                txt_4_psigmin.Text = dr(31).ToString
                txt_4_installedby.Text = dr(32).ToString
                txt_4_foreman.Text = dr(33).ToString
                txt_4_remark.Text = dr(34).ToString
                txt_4_premiseno.Text = dr(35).ToString
                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString
                cmb_4_condition.Text = dr(41).ToString
                txt_4_lenmtrtomain.Text = dr(42).ToString
                txt_4_sceginspect.Text = dr(43).ToString
                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString
            ElseIf dr(2).ToString = "Orange" Then
                'txt_fileid.Text = ""
                'txt_filedesc.Text = ""
                'cmb_formtype.Text = ""
                txt_3_add1.Text = dr(3).ToString
                cmb_3_add2.Text = dr(4).ToString
                cmb_3_add2_1.Text = dr(5).ToString
                cmb_3_add3.Text = dr(6).ToString
                cmb_3_add4_1.Text = dr(7).ToString
                cmb_3_add4.Text = dr(8).ToString
                'txt_3_name.Text = dr(9).ToString
                txt_3_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                cmb_3_city.Text = dr(11).ToString
                'txt_3_subdiv.Text = dr(12).ToString
                txt_3_serno.Text = dr(13).ToString
                cmb_3_pipesize.SelectedValue = dr(14).ToString
                cmb_3_pipekind.SelectedValue = dr(15).ToString
                cmb_3_pressure.SelectedValue = dr(16).ToString
                cmb_3_tapzize.SelectedValue = dr(17).ToString
                txt_3_ser_ft.Text = dr(18).ToString
                'txt_3_ser_in.Text = dr(19).ToString
                txt_3_depser_ft.Text = dr(20).ToString
                'txt_3_depser_in.Text = dr(21).ToString
                txt_3_mainln_ft.Text = dr(22).ToString
                'txt_3_mainln_in.Text = dr(23).ToString
                txt_3_propln_ft.Text = dr(24).ToString
                'txt_3_propln_in.Text = dr(25).ToString
                cmb_3_mainsize.SelectedValue = dr(26).ToString
                cmb_3_maintype.SelectedValue = dr(27).ToString
                'txt_3_deptmain.Text = dr(28).ToString
                'cmb_3_testedwith.SelectedValue = dr(29).ToString
                'cmb_3_testedto.SelectedValue = dr(30).ToString
                'txt_3_psigmin.Text = dr(31).ToString
                txt_3_installedby.Text = dr(32).ToString
                'txt_3_foreman.Text = dr(33).ToString
                txt_3_remark.Text = dr(34).ToString
                txt_3_premiseno.Text = dr(35).ToString
                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString
                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString
            ElseIf dr(2).ToString = "White" Then
                'txt_fileid.Text = ""
                'txt_filedesc.Text = ""
                'cmb_formtype.Text = ""
                txt_w_add1.Text = dr(3).ToString
                cmb_w_add2.Text = dr(4).ToString
                cmb_w_add2_1.Text = dr(5).ToString
                cmb_w_add3.Text = dr(6).ToString
                cmb_w_add4_1.Text = dr(7).ToString
                cmb_w_add4.Text = dr(8).ToString
                ' txt_w_name.Text = dr(9).ToString
                txt_w_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                cmb_w_city.Text = dr(11).ToString
                txt_w_subdiv.Text = dr(12).ToString
                txt_w_serno.Text = dr(13).ToString
                cmb_w_pipesize.SelectedValue = dr(14).ToString
                cmb_w_pipekind.SelectedValue = dr(15).ToString
                cmb_w_pressure.SelectedValue = dr(16).ToString
                cmb_w_tapzize.SelectedValue = dr(17).ToString
                txt_w_ser_ft.Text = dr(18).ToString
                txt_w_ser_in.Text = dr(19).ToString
                txt_w_depser_ft.Text = dr(20).ToString
                cmb_w_mainsize.SelectedValue = dr(26).ToString
                cmb_w_maintype.SelectedValue = dr(27).ToString
                txt_w_deptmain.Text = dr(28).ToString
                cmb_w_testedwith.SelectedValue = dr(29).ToString
                cmb_w_testedto.SelectedValue = dr(30).ToString
                txt_w_psigmin.Text = dr(31).ToString
                txt_w_installedby.Text = dr(32).ToString
                txt_w_foreman.Text = dr(33).ToString
                txt_w_remark.Text = dr(34).ToString
                txt_w_premiseno.Text = dr(35).ToString
                chk_stub.Checked = dr(36).ToString
                chk_inserted.Checked = dr(37).ToString
                chk_retired.Checked = dr(38).ToString
                ckh_leak.Checked = dr(39).ToString
                chk_split.Checked = dr(40).ToString
                chk_relocate.Checked = dr(71).ToString
                chk_replace.Checked = dr(72).ToString
                cmb_loccd_1.Text = dr(73).ToString
                txt_loccd_2.Text = dr(74).ToString


            End If
        Else
            Me.btn_submit.Text = "SUBMIT"
            resetfiledata()
        End If
        dr.Close()
    End Sub
    Private Sub Fill_All_ComboBoxes()
        'Combo Fill FORM-100BLK
        If cmb_formtype.Text.Trim = "FORM-100BLK" Then
            If cmb_100b_add2.Items.Count = 0 Then
                'Fill_ComboFields(cmb_100b_add3, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_100b_add2, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmb_100b_add2_1, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmb_100b_add4_1, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmb_100b_add4, "SO_FrmQaSTREET_SUFFIX_CD")
                Fill_ComboFields(cmb_100b_city, "SO_frmQaGetcombovalue")

                Fill_ComboFields(cmb_100b_pipesize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_100b_pipekind, "SO_frmQaGetcombovalue")

                Fill_ComboFields(cmb_100b_tapsize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_100b_pressure, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_100b_testedto, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_100b_testedwith, "SO_frmQaGetcombovalue")

                Fill_ComboFields(cmb_100b_mainsize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_100b_maintype, "SO_frmQaGetcombovalue")
            End If

            'Combo Fill FORM-100BLK-MISC
        ElseIf cmb_formtype.Text.Trim = "FORM-100BLK-MISC" Then
            If cmb_100b_m_add2.Items.Count = 0 Then
                'Fill_ComboFields(cmb_100b_m_add3, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_100b_m_add2, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmb_100b_m_add2_1, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmb_100b_m_add4_1, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmb_100b_m_add4, "SO_FrmQaSTREET_SUFFIX_CD")
                Fill_ComboFields(cmb_100b_m_city, "SO_frmQaGetcombovalue")

                Fill_ComboFields(cmb_100b_m_pipesize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_100b_m_pipekind, "SO_frmQaGetcombovalue")

                Fill_ComboFields(cmb_100b_m_tapsize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_100b_m_pressure, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_100b_m_testedto, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_100b_m_testedwith, "SO_frmQaGetcombovalue")

                Fill_ComboFields(cmb_100b_m_mainsize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_100b_m_maintype, "SO_frmQaGetcombovalue")
            End If

            ''By Dinesh Behera
        ElseIf cmb_formtype.Text.Trim = "FORM-200BLK" Then
            If cmbPrefix11.Items.Count = 0 Then
                Fill_ComboFields(cmb_typeofservice, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_pipe_size, "SO_frmQaGetcombovalue")
                'Fill_ComboFields(cmbDepthMain, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_main_type, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_main_size, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmbTapSize, "SO_frmQaGetcombovalue")
                '' '' ''Fill_ComboFields(cmbRetiredSize1, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmbMedium, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmbPressure, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_200b_city, "SO_frmQaGetcombovalue")
                ''Fill_ComboFields(cmbAppliancesUse, "SO_frmQaGetcombovalue")
                ''Fill_ComboFields(cmbTapLocation, "SO_frmQaGetcombovalue")
                ''Fill_ComboFields(cmbDepthMain, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmbRetiredSize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmbPrefix11, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmbPrefix22, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmbsuffix12, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmbsuffix22, "SO_FrmQaSTREET_SUFFIX_CD")
            End If
            'end by Dinesh

        ElseIf cmb_formtype.Text.Trim = "FORM-200BLK_PAGE1" Then
            If cmbPrefix1.Items.Count = 0 Then
                Fill_ComboFields(cmb_typeofservice_p1, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_pipe_size_p1, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_main_type_p1, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_main_size_p1, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmbTapSize_p1, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmbMedium_p1, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmbPressure_p1, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_200b_city_p1, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmbRetiredSize_p1, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmbPrefix1, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmbPrefix2, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmbsuffix1, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmbsuffix2, "SO_FrmQaSTREET_SUFFIX_CD")
            End If

        ElseIf cmb_formtype.Text.Trim = "Yellow" Then
            If cmb_y_add2.Items.Count = 0 Then
                Fill_ComboFields(cmb_y_pipesize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_y_pipekind, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_y_tapzize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_y_mainsize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_y_maintype, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_y_testedwith, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_y_testedto, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_y_city, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_y_pressure, "SO_frmQaGetcombovalue")

                Fill_ComboFields(cmb_y_add2, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmb_y_add2_1, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmb_y_add4_1, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmb_y_add4, "SO_FrmQaSTREET_SUFFIX_CD")


                'Fill_ComboFields(cmb_y_pipesize, "select t_values from tbl_setup where s_types = 'PIPE SIZE'")
                'Fill_ComboFields(cmb_y_pipekind, "select t_values from tbl_setup where s_types = 'PIPE TYPE'")
                'Fill_ComboFields(cmb_y_tapzize, "select t_values from tbl_setup where s_types = 'TAP SIZE'")
                'Fill_ComboFields(cmb_y_mainsize, "select t_values from tbl_setup where s_types = 'MAIN SIZE'")
                'Fill_ComboFields(cmb_y_maintype, "select t_values from tbl_setup where s_types = 'MAIN TYPE'")
                'Fill_ComboFields(cmb_y_testedwith, "select t_values from tbl_setup where s_types = 'TESTED WITH'")
                'Fill_ComboFields(cmb_y_testedto, "select t_values from tbl_setup where s_types = 'TESTED TO'")
                'Fill_ComboFields(cmb_y_city, "select t_values from tbl_setup where s_types = 'CITY'")
                'Fill_ComboFields(cmb_y_pressure, "select t_values from tbl_setup where s_types = 'PRESSURE'")

                'Fill_ComboFields(cmb_y_add2, "select distinct   isnull(ADDR_PREFIX_1,' ') as t_values from address")
                'Fill_ComboFields(cmb_y_add2_1, "select distinct  isnull(ADDR_PREFIX_2,' ') as t_values  from address")
                'Fill_ComboFields(cmb_y_add4_1, "select distinct  isnull(ADDR_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_y_add4, "select distinct  isnull(STREET_SUFFIX_CD,' ') as t_values  from address")
            End If



        ElseIf cmb_formtype.Text.Trim = "MISC" Then
            If cmb_l_add2.Items.Count = 0 Then
                Fill_ComboFields(cmb_l_city, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_l_misCtype, "SO_frmQaGetcombovalue")
                'Fill_ComboFields(cmb_l_city, "select t_values from tbl_setup where s_types = 'CITY'")
                Fill_ComboFields(cmb_l_add2, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmb_l_add2_1, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmb_l_add4_1, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmb_l_add4, "SO_FrmQaSTREET_SUFFIX_CD")
                'Fill_ComboFields(cmb_l_city, "select t_values from tbl_setup where s_types = 'CITY'")

                'Fill_ComboFields(cmb_l_add2, "select distinct   isnull(ADDR_PREFIX_1,' ') as t_values from address")
                'Fill_ComboFields(cmb_l_add2_1, "select distinct  isnull(ADDR_PREFIX_2,' ') as t_values  from address")
                'Fill_ComboFields(cmb_l_add4_1, "select distinct  isnull(ADDR_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_l_add4, "select distinct  isnull(STREET_SUFFIX_CD,' ') as t_values  from address")

                'Fill_ComboFields(cmb_l_misCtype, "select t_values from tbl_setup where s_types = 'Misc_Card_Type'")

            End If

        ElseIf cmb_formtype.Text.Trim = "ORIGINAL" Then

            If cmb_q_add2.Items.Count = 0 Then
                Fill_ComboFields(cmb_q_pipesize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_q_pipekind, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_y_tapzize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_q_mainsize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_q_maintype, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_q_testedwith, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_q_testedto, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_q_city, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_q_coating, "SO_frmQaGetcombovalue")

                Fill_ComboFields(cmb_q_add2, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmb_q_add2_1, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmb_q_add4_1, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmb_q_add4, "SO_FrmQaSTREET_SUFFIX_CD")


                'Fill_ComboFields(cmb_q_pipesize, "select t_values from tbl_setup where s_types = 'PIPE SIZE'")
                'Fill_ComboFields(cmb_q_pipekind, "select t_values from tbl_setup where s_types = 'PIPE TYPE'")

                'Fill_ComboFields(cmb_q_mainsize, "select t_values from tbl_setup where s_types = 'MAIN SIZE'")
                'Fill_ComboFields(cmb_q_maintype, "select t_values from tbl_setup where s_types = 'MAIN TYPE'")
                'Fill_ComboFields(cmb_q_testedwith, "select t_values from tbl_setup where s_types = 'TESTED WITH'")
                'Fill_ComboFields(cmb_q_testedto, "select t_values from tbl_setup where s_types = 'TESTED TO'")
                'Fill_ComboFields(cmb_q_city, "select t_values from tbl_setup where s_types = 'CITY'")

                'Fill_ComboFields(cmb_q_add2, "select distinct   isnull(ADDR_PREFIX_1,' ') as t_values from address")
                'Fill_ComboFields(cmb_q_add2_1, "select distinct  isnull(ADDR_PREFIX_2,' ') as t_values  from address")
                'Fill_ComboFields(cmb_q_add4_1, "select distinct  isnull(ADDR_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_q_add4, "select distinct  isnull(STREET_SUFFIX_CD,' ') as t_values  from address")


                'Fill_ComboFields(cmb_q_coating, "select t_values from tbl_setup where s_types = 'Type_of_coating'")
            End If



        ElseIf cmb_formtype.Text.Trim = "ORIGINAL-R" Then

            If cmb_r_add2.Items.Count = 0 Then
                Fill_ComboFields(cmb_r_pipesize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_r_pipekind, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_r_mainsize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_r_maintype, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_r_testedwith, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_r_testedto, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_r_city, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_r_connection_data, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_r_add2, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmb_r_add2_1, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmb_r_add4_1, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmb_r_add4, "SO_FrmQaSTREET_SUFFIX_CD")

                'Fill_ComboFields(cmb_r_pipesize, "select t_values from tbl_setup where s_types = 'PIPE SIZE'")
                'Fill_ComboFields(cmb_r_pipekind, "select t_values from tbl_setup where s_types = 'PIPE TYPE'")

                'Fill_ComboFields(cmb_r_mainsize, "select t_values from tbl_setup where s_types = 'MAIN SIZE'")
                'Fill_ComboFields(cmb_r_maintype, "select t_values from tbl_setup where s_types = 'MAIN TYPE'")
                'Fill_ComboFields(cmb_r_testedwith, "select t_values from tbl_setup where s_types = 'TESTED WITH'")
                'Fill_ComboFields(cmb_r_testedto, "select t_values from tbl_setup where s_types = 'TESTED TO'")
                'Fill_ComboFields(cmb_r_city, "select t_values from tbl_setup where s_types = 'CITY'")

                'Fill_ComboFields(cmb_r_add2, "select distinct   isnull(ADDR_PREFIX_1,' ') as t_values from address")
                'Fill_ComboFields(cmb_r_add2_1, "select distinct  isnull(ADDR_PREFIX_2,' ') as t_values  from address")
                'Fill_ComboFields(cmb_r_add4_1, "select distinct  isnull(ADDR_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_r_add4, "select distinct  isnull(STREET_SUFFIX_CD,' ') as t_values  from address")


                'Fill_ComboFields(cmb_r_connection_data, "select t_values from tbl_setup where s_types = 'connection_data'")
            End If


        ElseIf cmb_formtype.Text.Trim = "ABANDON-II" Then
            If cmb_a_add2.Items.Count = 0 Then

                Fill_ComboFields(cmb_a_mainsize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_a_maintype, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_a_testedwith, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_a_city, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_a_reasonabandon, "SO_frmQaGetcombovalue")

                Fill_ComboFields(cmb_a_add2, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmb_a_add2_1, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmb_a_add4_1, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmb_a_add4, "SO_FrmQaSTREET_SUFFIX_CD")


                'Fill_ComboFields(cmb_a_mainsize, "select t_values from tbl_setup where s_types = 'MAIN SIZE'")
                'Fill_ComboFields(cmb_a_maintype, "select t_values from tbl_setup where s_types = 'MAIN TYPE'")
                'Fill_ComboFields(cmb_a_testedwith, "select t_values from tbl_setup where s_types = 'TESTED WITH'")

                'Fill_ComboFields(cmb_a_city, "select t_values from tbl_setup where s_types = 'CITY'")

                'Fill_ComboFields(cmb_a_add2, "select distinct   isnull(ADDR_PREFIX_1,' ') as t_values from address")
                'Fill_ComboFields(cmb_a_add2_1, "select distinct  isnull(ADDR_PREFIX_2,' ') as t_values  from address")
                'Fill_ComboFields(cmb_a_add4_1, "select distinct  isnull(ADDR_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_a_add4, "select distinct  isnull(STREET_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_a_reasonabandon, "select t_values from tbl_setup where s_types = 'Reason_of_abandon'")

            End If


        ElseIf cmb_formtype.Text.Trim = "Form-X" Then
            If cmb_x_add2.Items.Count = 0 Then
                Fill_ComboFields(cmb_x_pipesize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_x_pipekind, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_x_mainsize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_x_maintype, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_x_testedwith, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_x_testedto, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_x_city, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_x_coating, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_x_add2, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmb_x_add2_1, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmb_x_add4_1, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmb_x_add4, "SO_FrmQaSTREET_SUFFIX_CD")


                'Fill_ComboFields(cmb_x_pipesize, "select t_values from tbl_setup where s_types = 'PIPE SIZE'")
                'Fill_ComboFields(cmb_x_pipekind, "select t_values from tbl_setup where s_types = 'PIPE TYPE'")

                'Fill_ComboFields(cmb_x_mainsize, "select t_values from tbl_setup where s_types = 'MAIN SIZE'")
                'Fill_ComboFields(cmb_x_maintype, "select t_values from tbl_setup where s_types = 'MAIN TYPE'")
                'Fill_ComboFields(cmb_x_testedwith, "select t_values from tbl_setup where s_types = 'TESTED WITH'")
                'Fill_ComboFields(cmb_x_testedto, "select t_values from tbl_setup where s_types = 'TESTED TO'")
                'Fill_ComboFields(cmb_x_city, "select t_values from tbl_setup where s_types = 'CITY'")

                'Fill_ComboFields(cmb_x_add2, "select distinct   isnull(ADDR_PREFIX_1,' ') as t_values from address")
                'Fill_ComboFields(cmb_x_add2_1, "select distinct  isnull(ADDR_PREFIX_2,' ') as t_values  from address")
                'Fill_ComboFields(cmb_x_add4_1, "select distinct  isnull(ADDR_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_x_add4, "select distinct  isnull(STREET_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_x_coating, "select t_values from tbl_setup where s_types = 'Type_of_coating'")
            End If


        ElseIf cmb_formtype.Text.Trim = "FORM-IX" Then
            If cmb_9_add2.Items.Count = 0 Then

                Fill_ComboFields(cmb_9_pipesize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_9_pipekind, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_9_tapzize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_9_mainsize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_9_maintype, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_9_city, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_9_coating, "SO_frmQaGetcombovalue")

                Fill_ComboFields(cmb_9_add2, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmb_9_add2_1, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmb_9_add4_1, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmb_9_add4, "SO_FrmQaSTREET_SUFFIX_CD")


                'Fill_ComboFields(cmb_9_pipesize, "select t_values from tbl_setup where s_types = 'PIPE SIZE'")
                'Fill_ComboFields(cmb_9_pipekind, "select t_values from tbl_setup where s_types = 'PIPE TYPE'")
                'Fill_ComboFields(cmb_9_tapzize, "select t_values from tbl_setup where s_types = 'TAP SIZE'")
                'Fill_ComboFields(cmb_9_mainsize, "select t_values from tbl_setup where s_types = 'MAIN SIZE'")
                'Fill_ComboFields(cmb_9_maintype, "select t_values from tbl_setup where s_types = 'MAIN TYPE'")
                'Fill_ComboFields(cmb_9_city, "select t_values from tbl_setup where s_types = 'CITY'")
                'Fill_ComboFields(cmb_9_add2, "select distinct   isnull(ADDR_PREFIX_1,' ') as t_values from address")
                'Fill_ComboFields(cmb_9_add2_1, "select distinct  isnull(ADDR_PREFIX_2,' ') as t_values  from address")
                'Fill_ComboFields(cmb_9_add4_1, "select distinct  isnull(ADDR_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_9_add4, "select distinct  isnull(STREET_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_9_coating, "select t_values from tbl_setup where s_types = 'Type_of_coating'")
            End If

        ElseIf cmb_formtype.Text.Trim = "ABANDON-I" Then
            If cmb_8_add2.Items.Count = 0 Then

                Fill_ComboFields(cmb_8_mainsize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_8_maintype, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_8_city, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_8_coating, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_8_add2, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmb_8_add2_1, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmb_8_add4_1, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmb_8_add4, "SO_FrmQaSTREET_SUFFIX_CD")

                'Fill_ComboFields(cmb_8_mainsize, "select t_values from tbl_setup where s_types = 'MAIN SIZE'")
                'Fill_ComboFields(cmb_8_maintype, "select t_values from tbl_setup where s_types = 'MAIN TYPE'")
                'Fill_ComboFields(cmb_8_city, "select t_values from tbl_setup where s_types = 'CITY'")
                'Fill_ComboFields(cmb_8_add2, "select distinct   isnull(ADDR_PREFIX_1,' ') as t_values from address")
                'Fill_ComboFields(cmb_8_add2_1, "select distinct  isnull(ADDR_PREFIX_2,' ') as t_values  from address")
                'Fill_ComboFields(cmb_8_add4_1, "select distinct  isnull(ADDR_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_8_add4, "select distinct  isnull(STREET_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_8_coating, "select t_values from tbl_setup where s_types = 'Type_of_coating'")
            End If

        ElseIf cmb_formtype.Text.Trim = "Form-954" Then
            If cmb_7_add2.Items.Count = 0 Then
                Fill_ComboFields(cmb_7_pipesize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_7_pipekind, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_7_tapzize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_7_mainsize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_7_maintype, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_7_city, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_7_coating, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_7_naturework, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_7_kindjoint, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_7_add2, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmb_7_add2_1, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmb_7_add4_1, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmb_7_add4, "SO_FrmQaSTREET_SUFFIX_CD")


                'Fill_ComboFields(cmb_7_pipesize, "select t_values from tbl_setup where s_types = 'PIPE SIZE'")
                'Fill_ComboFields(cmb_7_pipekind, "select t_values from tbl_setup where s_types = 'PIPE TYPE'")
                'Fill_ComboFields(cmb_7_tapzize, "select t_values from tbl_setup where s_types = 'TAP SIZE'")
                'Fill_ComboFields(cmb_7_mainsize, "select t_values from tbl_setup where s_types = 'MAIN SIZE'")
                'Fill_ComboFields(cmb_7_maintype, "select t_values from tbl_setup where s_types = 'MAIN TYPE'")
                'Fill_ComboFields(cmb_7_city, "select t_values from tbl_setup where s_types = 'CITY'")
                'Fill_ComboFields(cmb_7_add2, "select distinct   isnull(ADDR_PREFIX_1,' ') as t_values from address")
                'Fill_ComboFields(cmb_7_add2_1, "select distinct  isnull(ADDR_PREFIX_2,' ') as t_values  from address")
                'Fill_ComboFields(cmb_7_add4_1, "select distinct  isnull(ADDR_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_7_add4, "select distinct  isnull(STREET_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_7_naturework, "select t_values from tbl_setup where s_types = 'Nature_of_work'")
                'Fill_ComboFields(cmb_7_kindjoint, "select t_values from tbl_setup where s_types = 'Kind_of_joint'")
                'Fill_ComboFields(cmb_7_coating, "select t_values from tbl_setup where s_types = 'Type_of_coating'")
            End If

        ElseIf cmb_formtype.Text.Trim = "Form-80I" Then
            If cmb_6_add2.Items.Count = 0 Then



                Fill_ComboFields(cmb_6_pipesize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_6_pipekind, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_6_mainsize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_6_maintype, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_6_testedwith, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_6_testedto, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_6_city, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_6_add2, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmb_6_add2_1, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmb_6_add4_1, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmb_6_add4, "SO_FrmQaSTREET_SUFFIX_CD")

                'Fill_ComboFields(cmb_6_pipesize, "select t_values from tbl_setup where s_types = 'PIPE SIZE'")
                'Fill_ComboFields(cmb_6_pipekind, "select t_values from tbl_setup where s_types = 'PIPE TYPE'")

                'Fill_ComboFields(cmb_6_mainsize, "select t_values from tbl_setup where s_types = 'MAIN SIZE'")
                'Fill_ComboFields(cmb_6_maintype, "select t_values from tbl_setup where s_types = 'MAIN TYPE'")
                'Fill_ComboFields(cmb_6_testedwith, "select t_values from tbl_setup where s_types = 'TESTED WITH'")
                'Fill_ComboFields(cmb_6_testedto, "select t_values from tbl_setup where s_types = 'TESTED TO'")
                'Fill_ComboFields(cmb_6_city, "select t_values from tbl_setup where s_types = 'CITY'")

                'Fill_ComboFields(cmb_6_add2, "select distinct   isnull(ADDR_PREFIX_1,' ') as t_values from address")
                'Fill_ComboFields(cmb_6_add2_1, "select distinct  isnull(ADDR_PREFIX_2,' ') as t_values  from address")
                'Fill_ComboFields(cmb_6_add4_1, "select distinct  isnull(ADDR_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_6_add4, "select distinct  isnull(STREET_SUFFIX_CD,' ') as t_values  from address")
            End If


        ElseIf cmb_formtype.Text.Trim = "White" Then
            If cmb_w_add2.Items.Count = 0 Then
                Fill_ComboFields(cmb_w_pipesize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_w_pipekind, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_w_tapzize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_w_mainsize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_w_maintype, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_w_testedwith, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_w_testedto, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_w_pressure, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_w_city, "SO_frmQaGetcombovalue")

                Fill_ComboFields(cmb_w_add2, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmb_w_add2_1, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmb_w_add4_1, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmb_w_add4, "SO_FrmQaSTREET_SUFFIX_CD")



                'Fill_ComboFields(cmb_w_pipesize, "select t_values from tbl_setup where s_types = 'PIPE SIZE'")
                'Fill_ComboFields(cmb_w_pipekind, "select t_values from tbl_setup where s_types = 'PIPE TYPE'")
                'Fill_ComboFields(cmb_w_tapzize, "select t_values from tbl_setup where s_types = 'TAP SIZE'")
                'Fill_ComboFields(cmb_w_mainsize, "select t_values from tbl_setup where s_types = 'MAIN SIZE'")
                'Fill_ComboFields(cmb_w_maintype, "select t_values from tbl_setup where s_types = 'MAIN TYPE'")
                'Fill_ComboFields(cmb_w_testedwith, "select t_values from tbl_setup where s_types = 'TESTED WITH'")
                'Fill_ComboFields(cmb_w_testedto, "select t_values from tbl_setup where s_types = 'TESTED TO'")
                'Fill_ComboFields(cmb_w_pressure, "select t_values from tbl_setup where s_types = 'PRESSURE'")
                'Fill_ComboFields(cmb_w_add2, "select distinct   isnull(ADDR_PREFIX_1,' ') as t_values from address")
                'Fill_ComboFields(cmb_w_add2_1, "select distinct  isnull(ADDR_PREFIX_2,' ') as t_values  from address")
                'Fill_ComboFields(cmb_w_add4_1, "select distinct  isnull(ADDR_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_w_add4, "select distinct  isnull(STREET_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_w_city, "select t_values from tbl_setup where s_types = 'CITY'")
            End If

        ElseIf cmb_formtype.Text.Trim = "Orange" Then
            If cmb_3_add2.Items.Count = 0 Then
                Fill_ComboFields(cmb_3_pipesize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_3_pipekind, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_3_tapzize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_3_mainsize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_3_maintype, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_3_pressure, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_3_city, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_3_add2, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmb_3_add2_1, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmb_3_add4_1, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmb_3_add4, "SO_FrmQaSTREET_SUFFIX_CD")

                'Fill_ComboFields(cmb_3_pipesize, "select t_values from tbl_setup where s_types = 'PIPE SIZE'")
                'Fill_ComboFields(cmb_3_pipekind, "select t_values from tbl_setup where s_types = 'PIPE TYPE'")
                'Fill_ComboFields(cmb_3_tapzize, "select t_values from tbl_setup where s_types = 'TAP SIZE'")
                'Fill_ComboFields(cmb_3_mainsize, "select t_values from tbl_setup where s_types = 'MAIN SIZE'")
                'Fill_ComboFields(cmb_3_maintype, "select t_values from tbl_setup where s_types = 'MAIN TYPE'")
                'Fill_ComboFields(cmb_3_pressure, "select t_values from tbl_setup where s_types = 'PRESSURE'")
                'Fill_ComboFields(cmb_3_city, "select t_values from tbl_setup where s_types = 'CITY'")
                'Fill_ComboFields(cmb_3_add2, "select distinct   isnull(ADDR_PREFIX_1,' ') as t_values from address")
                'Fill_ComboFields(cmb_3_add2_1, "select distinct  isnull(ADDR_PREFIX_2,' ') as t_values  from address")
                'Fill_ComboFields(cmb_3_add4_1, "select distinct  isnull(ADDR_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_3_add4, "select distinct  isnull(STREET_SUFFIX_CD,' ') as t_values  from address")
            End If

        ElseIf cmb_formtype.Text.Trim = "Form235-B-702" Then
            If cmb_4_add2.Items.Count = 0 Then
                Fill_ComboFields(cmb_4_pipesize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_4_pipekind, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_4_mainsize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_4_maintype, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_4_testedwith, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_4_testedto, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_4_city, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_4_pressure, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_4_add2, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmb_4_add2_1, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmb_4_add4_1, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmb_4_add4, "SO_FrmQaSTREET_SUFFIX_CD")



                'Fill_ComboFields(cmb_4_pipesize, "select t_values from tbl_setup where s_types = 'PIPE SIZE'")
                'Fill_ComboFields(cmb_4_pipekind, "select t_values from tbl_setup where s_types = 'PIPE TYPE'")
                'Fill_ComboFields(cmb_4_mainsize, "select t_values from tbl_setup where s_types = 'MAIN SIZE'")
                'Fill_ComboFields(cmb_4_maintype, "select t_values from tbl_setup where s_types = 'MAIN TYPE'")
                'Fill_ComboFields(cmb_4_testedwith, "select t_values from tbl_setup where s_types = 'TESTED WITH'")
                'Fill_ComboFields(cmb_4_testedto, "select t_values from tbl_setup where s_types = 'TESTED TO'")
                'Fill_ComboFields(cmb_4_city, "select t_values from tbl_setup where s_types = 'CITY'")
                'Fill_ComboFields(cmb_4_pressure, "select t_values from tbl_setup where s_types = 'PRESSURE'")
                'Fill_ComboFields(cmb_4_add2, "select distinct   isnull(ADDR_PREFIX_1,' ') as t_values from address")
                'Fill_ComboFields(cmb_4_add2_1, "select distinct  isnull(ADDR_PREFIX_2,' ') as t_values  from address")
                'Fill_ComboFields(cmb_4_add4_1, "select distinct  isnull(ADDR_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_4_add4, "select distinct  isnull(STREET_SUFFIX_CD,' ') as t_values  from address")
            End If

        ElseIf cmb_formtype.Text.Trim = "OD-9-6-38" Then
            If cmb_5_add2.Items.Count = 0 Then
                Fill_ComboFields(cmb_5_pipesize, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_5_pipekind, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_5_city, "SO_frmQaGetcombovalue")
                Fill_ComboFields(cmb_5_add2, "SO_FrmQaADDR_PREFIX_1")
                Fill_ComboFields(cmb_5_add2_1, "SO_FrmQaADDR_PREFIX_2")
                Fill_ComboFields(cmb_5_add4_1, "SO_FrmQaADDR_SUFFIX_CD")
                Fill_ComboFields(cmb_5_add4, "SO_FrmQaSTREET_SUFFIX_CD")




                'Fill_ComboFields(cmb_5_pipesize, "select t_values from tbl_setup where s_types = 'PIPE SIZE'")
                'Fill_ComboFields(cmb_5_pipekind, "select t_values from tbl_setup where s_types = 'PIPE TYPE'")
                'Fill_ComboFields(cmb_5_city, "select t_values from tbl_setup where s_types = 'CITY'")
                'Fill_ComboFields(cmb_5_add2, "select distinct   isnull(ADDR_PREFIX_1,' ') as t_values from address")
                'Fill_ComboFields(cmb_5_add2_1, "select distinct  isnull(ADDR_PREFIX_2,' ') as t_values  from address")
                'Fill_ComboFields(cmb_5_add4_1, "select distinct  isnull(ADDR_SUFFIX_CD,' ') as t_values  from address")
                'Fill_ComboFields(cmb_5_add4, "select distinct  isnull(STREET_SUFFIX_CD,' ') as t_values  from address")
            End If

        End If
    End Sub
    Private Sub Fill_ComboFields(ByVal comboField As ComboBox, ByVal cmdText As String)
        'comboField.Items.Clear()
        cmd = Nothing
        Try
            cmd = New SqlCommand(cmdText, conn1)
            cmd.CommandType = CommandType.StoredProcedure
            If cmdText = "SO_frmQaGetcombovalue" Then
                If comboField.Name = "cmb_100b_m_pipesize" Or comboField.Name = "cmb_100b_pipesize" Or comboField.Name = "cmb_pipe_size" Or comboField.Name = "cmb_pipe_size_p1" Or comboField.Name = "cmb_y_pipesize" Or comboField.Name = "cmb_q_pipesize" Or comboField.Name = "cmb_5_pipesize" Or comboField.Name = "cmb_4_pipesize" Or comboField.Name = "cmb_3_pipesize" Or comboField.Name = "cmb_w_pipesize" Or comboField.Name = "cmb_6_pipesize" Or comboField.Name = "cmb_7_pipesize" Or comboField.Name = "cmb_9_pipesize" Or comboField.Name = "cmb_x_pipesize" Or comboField.Name = "cmb_r_pipesize" Then
                    cmd.Parameters.AddWithValue("@stypes", "PIPE SIZE")
                End If
                If comboField.Name = "cmb_100b_m_pipekind" Or comboField.Name = "cmb_typeofservice" Or comboField.Name = "cmb_typeofservice_p1" Or comboField.Name = "cmb_100b_pipekind" Or comboField.Name = "cmb_y_pipekind" Or comboField.Name = "cmb_q_pipekind" Or comboField.Name = "cmb_r_pipekind" Or comboField.Name = "cmb_x_pipekind" Or comboField.Name = "cmb_9_pipekind" Or comboField.Name = "cmb_7_pipekind" Or comboField.Name = "cmb_6_pipekind" Or comboField.Name = "cmb_w_pipekind" Or comboField.Name = "cmb_3_pipekind" Or comboField.Name = "cmb_4_pipekind" Or comboField.Name = "cmb_5_pipekind" Then
                    cmd.Parameters.AddWithValue("@stypes", "PIPE TYPE")
                End If
                If comboField.Name = "cmb_100b_m_tapsize" Or comboField.Name = "cmbTapSize" Or comboField.Name = "cmbTapSize_p1" Or comboField.Name = "cmb_100b_tapsize" Or comboField.Name = "cmb_y_tapzize" Or comboField.Name = "cmb_9_tapzize" Or comboField.Name = "cmb_7_tapzize" Or comboField.Name = "cmb_w_tapzize" Or comboField.Name = "cmb_3_tapzize" Then
                    cmd.Parameters.AddWithValue("@stypes", "TAP SIZE")
                End If
                If comboField.Name = "cmb_100b_m_mainsize" Or comboField.Name = "cmb_main_size" Or comboField.Name = "cmb_main_size_p1" Or comboField.Name = "cmbRetiredSize" Or comboField.Name = "cmbRetiredSize_p1" Or comboField.Name = "cmb_100b_mainsize" Or comboField.Name = "cmb_y_mainsize" Or comboField.Name = "cmb_q_mainsize" Or comboField.Name = "cmb_r_mainsize" Or comboField.Name = "cmb_a_mainsize" Or comboField.Name = "cmb_x_mainsize" Or comboField.Name = "cmb_9_mainsize" Or comboField.Name = "cmb_8_mainsize" Or comboField.Name = "cmb_7_mainsize" Or comboField.Name = "cmb_6_mainsize" Or comboField.Name = "cmb_w_mainsize" Or comboField.Name = "cmb_3_mainsize" Or comboField.Name = "cmb_4_mainsize" Then
                    cmd.Parameters.AddWithValue("@stypes", "MAIN SIZE")
                End If
                If comboField.Name = "cmb_100b_m_maintype" Or comboField.Name = "cmb_main_type" Or comboField.Name = "cmb_main_type_p1" Or comboField.Name = "cmb_100b_maintype" Or comboField.Name = "cmb_100b_maintype" Or comboField.Name = "cmb_y_maintype" Or comboField.Name = "cmb_q_maintype" Or comboField.Name = "cmb_r_maintype" Or comboField.Name = "cmb_a_maintype" Or comboField.Name = "cmb_x_maintype" Or comboField.Name = "cmb_9_maintype" Or comboField.Name = "cmb_8_maintype" Or comboField.Name = "cmb_7_maintype" Or comboField.Name = "cmb_6_maintype" Or comboField.Name = "cmb_w_maintype" Or comboField.Name = "cmb_3_maintype" Or comboField.Name = "cmb_4_maintype" Then
                    cmd.Parameters.AddWithValue("@stypes", "MAIN TYPE")
                End If
                If comboField.Name = "cmb_100b_m_testedwith" Or comboField.Name = "cmbMedium" Or comboField.Name = "cmbMedium_p1" Or comboField.Name = "cmb_100b_testedwith" Or comboField.Name = "cmb_y_testedwith" Or comboField.Name = "cmb_q_testedwith" Or comboField.Name = "cmb_r_testedwith" Or comboField.Name = "cmb_a_testedwith" Or comboField.Name = "cmb_x_testedwith" Or comboField.Name = "cmb_6_testedwith" Or comboField.Name = "cmb_w_testedwith" Or comboField.Name = "cmb_4_testedwith" Then
                    cmd.Parameters.AddWithValue("@stypes", "TESTED WITH")
                End If
                If comboField.Name = "cmb_100b_m_testedto" Or comboField.Name = "cmbPressure" Or comboField.Name = "cmbPressure_p1" Or comboField.Name = "cmb_100b_testedto" Or comboField.Name = "cmb_y_testedto" Or comboField.Name = "cmb_q_testedto" Or comboField.Name = "cmb_r_testedto" Or comboField.Name = "cmb_x_testedto" Or comboField.Name = "cmb_6_testedto" Or comboField.Name = "cmb_w_testedto" Or comboField.Name = "cmb_4_testedto" Then
                    cmd.Parameters.AddWithValue("@stypes", "TESTED TO")
                End If
                If comboField.Name = "cmb_100b_m_city" Or comboField.Name = "cmb_200b_city" Or comboField.Name = "cmb_200b_city_p1" Or comboField.Name = "cmb_100b_city" Or comboField.Name = "cmb_y_city" Or comboField.Name = "cmb_l_city" Or comboField.Name = "cmb_q_city" Or comboField.Name = "cmb_r_city" Or comboField.Name = "cmb_a_city" Or comboField.Name = "cmb_x_city" Or comboField.Name = "cmb_9_city" Or comboField.Name = "cmb_8_city" Or comboField.Name = "cmb_7_city" Or comboField.Name = "cmb_6_city" Or comboField.Name = "cmb_w_city" Or comboField.Name = "cmb_3_city" Or comboField.Name = "cmb_4_city" Or comboField.Name = "cmb_5_city" Then
                    cmd.Parameters.AddWithValue("@stypes", "CITY")
                End If
                If comboField.Name = "cmb_100b_m_pressure" Or comboField.Name = "cmb_100b_pressure" Or comboField.Name = "cmb_y_pressure" Or comboField.Name = "cmb_w_pressure" Or comboField.Name = "cmb_3_pressure" Or comboField.Name = "cmb_4_pressure" Then
                    cmd.Parameters.AddWithValue("@stypes", "PRESSURE")
                End If
                If comboField.Name = "cmb_q_coating" Or comboField.Name = "cmb_x_coating" Or comboField.Name = "cmb_9_coating" Or comboField.Name = "cmb_8_coating" Or comboField.Name = "cmb_7_coating" Then
                    cmd.Parameters.AddWithValue("@stypes", "Type_of_coating")
                End If
                If comboField.Name = "cmb_r_connection_data" Then
                    cmd.Parameters.AddWithValue("@stypes", "connection_data")
                End If
                If comboField.Name = "cmb_a_reasonabandon" Then
                    cmd.Parameters.AddWithValue("@stypes", "Reason_of_abandon")
                End If
                If comboField.Name = "cmb_l_misCtype" Then
                    cmd.Parameters.AddWithValue("@stypes", "Misc_Card_Type")
                End If
                If comboField.Name = "cmb_7_naturework" Then
                    cmd.Parameters.AddWithValue("@stypes", "Nature_of_work")
                End If
                If comboField.Name = "cmb_7_kindjoint" Then
                    cmd.Parameters.AddWithValue("@stypes", "Kind_of_joint")
                End If
            End If
            If cmdText = "SO_FrmQagettownname" Then
                Dim house_no As String = ""
                Dim ADDR_PREFIX_1 As String = ""
                Dim ADDR_PREFIX_2 As String = ""
                Dim STREET_NM As String = ""
                Dim ADDR_SUFFIX_CD As String = ""
                Dim STREET_SUFFIX_CD As String = ""
                Dim cities As String = ""
                
                If cmb_formtype.Text.Trim = "FORM-100BLK" Then
                    house_no = txt_100b_add1.Text
                    ADDR_PREFIX_1 = cmb_100b_add2.Text
                    ADDR_PREFIX_2 = cmb_100b_add2_1.Text
                    STREET_NM = cmb_100b_add3.Text
                    ADDR_SUFFIX_CD = cmb_100b_add4_1.Text
                    STREET_SUFFIX_CD = cmb_100b_add4.Text
                    cities = txt_div.Text

                ElseIf cmb_formtype.Text.Trim = "FORM-100BLK-MISC" Then
                    house_no = txt_100b_m_add1.Text
                    ADDR_PREFIX_1 = cmb_100b_m_add2.Text
                    ADDR_PREFIX_2 = cmb_100b_m_add2_1.Text
                    STREET_NM = cmb_100b_m_add3.Text
                    ADDR_SUFFIX_CD = cmb_100b_m_add4_1.Text
                    STREET_SUFFIX_CD = cmb_100b_m_add4.Text
                    cities = txt_div.Text

                ElseIf cmb_formtype.Text.Trim = "FORM-200BLK" Then
                    house_no = txthouseNo1.Text
                    ADDR_PREFIX_1 = cmbPrefix11.Text
                    ADDR_PREFIX_2 = cmbPrefix22.Text
                    STREET_NM = cmbStreetname1.Text
                    ADDR_SUFFIX_CD = cmbsuffix12.Text
                    STREET_SUFFIX_CD = cmbsuffix22.Text
                    cities = txt_div.Text

                ElseIf cmb_formtype.Text.Trim = "FORM-200BLK_PAGE1" Then
                    house_no = txthouseNo.Text
                    ADDR_PREFIX_1 = cmbPrefix1.Text
                    ADDR_PREFIX_2 = cmbPrefix2.Text
                    STREET_NM = cmbStreetname.Text
                    ADDR_SUFFIX_CD = cmbsuffix1.Text
                    STREET_SUFFIX_CD = cmbsuffix2.Text
                    cities = txt_div.Text

                ElseIf cmb_formtype.Text.Trim = "Yellow" Then
                    house_no = txt_y_add1.Text
                    ADDR_PREFIX_1 = cmb_y_add2.Text
                    ADDR_PREFIX_2 = cmb_y_add2_1.Text
                    STREET_NM = cmb_y_add3.Text
                    ADDR_SUFFIX_CD = cmb_y_add4_1.Text
                    STREET_SUFFIX_CD = cmb_y_add4.Text
                    cities = txt_div.Text

                ElseIf cmb_formtype.Text.Trim = "ORIGINAL" Then
                    house_no = txt_q_add1.Text
                    ADDR_PREFIX_1 = cmb_q_add2.Text
                    ADDR_PREFIX_2 = cmb_q_add2_1.Text
                    STREET_NM = cmb_q_add3.Text
                    ADDR_SUFFIX_CD = cmb_q_add4_1.Text
                    STREET_SUFFIX_CD = cmb_q_add4.Text
                    cities = txt_div.Text
                    ' Me.txt_q_premiseno.Text = ""
                ElseIf cmb_formtype.Text.Trim = "MISC" Then
                    house_no = txt_l_add1.Text
                    ADDR_PREFIX_1 = cmb_l_add2.Text
                    ADDR_PREFIX_2 = cmb_l_add2_1.Text
                    STREET_NM = cmb_l_add3.Text
                    ADDR_SUFFIX_CD = cmb_l_add4_1.Text
                    STREET_SUFFIX_CD = cmb_l_add4.Text
                    cities = txt_div.Text
                    'Me.txt_l_premiseno.Text = ""
                ElseIf cmb_formtype.Text.Trim = "ORIGINAL-R" Then
                    house_no = txt_r_add1.Text
                    ADDR_PREFIX_1 = cmb_r_add2.Text
                    ADDR_PREFIX_2 = cmb_r_add2_1.Text
                    STREET_NM = cmb_r_add3.Text
                    ADDR_SUFFIX_CD = cmb_r_add4_1.Text
                    STREET_SUFFIX_CD = cmb_r_add4.Text
                    cities = txt_div.Text
                    'Me.txt_r_premiseno.Text = ""
                ElseIf cmb_formtype.Text.Trim = "ABANDON-II" Then
                    house_no = txt_a_add1.Text
                    ADDR_PREFIX_1 = cmb_a_add2.Text
                    ADDR_PREFIX_2 = cmb_a_add2_1.Text
                    STREET_NM = cmb_a_add3.Text
                    ADDR_SUFFIX_CD = cmb_a_add4_1.Text
                    STREET_SUFFIX_CD = cmb_a_add4.Text
                    cities = txt_div.Text
                    'Me.txt_a_premiseno.Text = ""
                ElseIf cmb_formtype.Text.Trim = "Form-X" Then
                    house_no = txt_x_add1.Text
                    ADDR_PREFIX_1 = cmb_x_add2.Text
                    ADDR_PREFIX_2 = cmb_x_add2_1.Text
                    STREET_NM = cmb_x_add3.Text
                    ADDR_SUFFIX_CD = cmb_x_add4_1.Text
                    STREET_SUFFIX_CD = cmb_x_add4.Text
                    cities = txt_div.Text
                    'Me.txt_x_premiseno.Text = ""
                ElseIf cmb_formtype.Text.Trim = "FORM-IX" Then
                    house_no = txt_9_add1.Text
                    ADDR_PREFIX_1 = cmb_9_add2.Text
                    ADDR_PREFIX_2 = cmb_9_add2_1.Text
                    STREET_NM = cmb_9_add3.Text
                    ADDR_SUFFIX_CD = cmb_9_add4_1.Text
                    STREET_SUFFIX_CD = cmb_9_add4.Text
                    cities = txt_div.Text
                    'Me.txt_9_premiseno.Text = ""
                ElseIf cmb_formtype.Text.Trim = "Form-954" Then
                    house_no = txt_7_add1.Text
                    ADDR_PREFIX_1 = cmb_7_add2.Text
                    ADDR_PREFIX_2 = cmb_7_add2_1.Text
                    STREET_NM = cmb_7_add3.Text
                    ADDR_SUFFIX_CD = cmb_7_add4_1.Text
                    STREET_SUFFIX_CD = cmb_7_add4.Text
                    cities = txt_div.Text
                    'Me.txt_7_premiseno.Text = ""
                ElseIf cmb_formtype.Text.Trim = "ABANDON-I" Then
                    house_no = txt_8_add1.Text
                    ADDR_PREFIX_1 = cmb_8_add2.Text
                    ADDR_PREFIX_2 = cmb_8_add2_1.Text
                    STREET_NM = cmb_8_add3.Text
                    ADDR_SUFFIX_CD = cmb_8_add4_1.Text
                    STREET_SUFFIX_CD = cmb_8_add4.Text
                    cities = txt_div.Text
                    'Me.txt_8_premiseno.Text = ""
                ElseIf cmb_formtype.Text.Trim = "Form-80I" Then
                    house_no = txt_6_add1.Text
                    ADDR_PREFIX_1 = cmb_6_add2.Text
                    ADDR_PREFIX_2 = cmb_6_add2_1.Text
                    STREET_NM = cmb_6_add3.Text
                    ADDR_SUFFIX_CD = cmb_6_add4_1.Text
                    STREET_SUFFIX_CD = cmb_6_add4.Text
                    cities = txt_div.Text
                    'Me.txt_6_premiseno.Text = ""
                ElseIf cmb_formtype.Text.Trim = "OD-9-6-38" Then
                    house_no = txt_5_add1.Text
                    ADDR_PREFIX_1 = cmb_5_add2.Text
                    ADDR_PREFIX_2 = cmb_5_add2_1.Text
                    STREET_NM = cmb_5_add3.Text
                    ADDR_SUFFIX_CD = cmb_5_add4_1.Text
                    STREET_SUFFIX_CD = cmb_5_add4.Text
                    cities = txt_div.Text
                    'Me.txt_5_premiseno.Text = ""
                ElseIf cmb_formtype.Text.Trim = "Form235-B-702" Then
                    house_no = txt_4_add1.Text
                    ADDR_PREFIX_1 = cmb_4_add2.Text
                    ADDR_PREFIX_2 = cmb_4_add2_1.Text
                    STREET_NM = cmb_4_add3.Text
                    ADDR_SUFFIX_CD = cmb_4_add4_1.Text
                    STREET_SUFFIX_CD = cmb_4_add4.Text
                    cities = txt_div.Text
                    'txt_4_premiseno.Text = ""
                ElseIf cmb_formtype.Text.Trim = "White" Then
                    house_no = txt_w_add1.Text
                    ADDR_PREFIX_1 = cmb_w_add2.Text
                    ADDR_PREFIX_2 = cmb_w_add2_1.Text
                    STREET_NM = cmb_w_add3.Text
                    ADDR_SUFFIX_CD = cmb_w_add4_1.Text
                    STREET_SUFFIX_CD = cmb_w_add4.Text
                    cities = txt_div.Text
                    'Me.txt_w_premiseno.Text = ""
                ElseIf Me.cmb_formtype.Text.Trim = "Orange" Then
                    house_no = txt_3_add1.Text
                    ADDR_PREFIX_1 = cmb_3_add2.Text
                    ADDR_PREFIX_2 = cmb_3_add2_1.Text
                    STREET_NM = cmb_3_add3.Text
                    ADDR_SUFFIX_CD = cmb_3_add4_1.Text
                    STREET_SUFFIX_CD = cmb_3_add4.Text
                    cities = txt_div.Text
                    'txt_3_premiseno.Text = ""
                End If
                cmd.Parameters.AddWithValue("@HOUSE_NO", house_no)
                cmd.Parameters.AddWithValue("@ADDR_PREFIX_1", ADDR_PREFIX_1)
                cmd.Parameters.AddWithValue("@ADDR_PREFIX_2", ADDR_PREFIX_2)
                cmd.Parameters.AddWithValue("@STREET_NM", STREET_NM)
                cmd.Parameters.AddWithValue("@STREET_SUFFIX_CD", STREET_SUFFIX_CD)
                cmd.Parameters.AddWithValue("@divison", cities)

            End If
            If (conn1.State = ConnectionState.Closed) Then
                conn1.Open()
            End If
            Dim ds As New DataSet()
            ds.Tables.Clear()
            Dim da As New SqlDataAdapter(cmd)
            da.Fill(ds)
            comboField.DataSource = ds.Tables(0)
            comboField.DisplayMember = "t_values"
            comboField.ValueMember = "t_values"
            comboField.SelectedIndex = -1
        Catch ex As Exception
            MessageBox.Show(ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop)
        Finally
            conn1.Close()
            cmd = Nothing
        End Try

    End Sub
    Private Sub Fill_Streetname(ByVal comboField As ComboBox, ByVal HOUSE_NO As String, ByVal ADDR_PREFIX_1 As String, ByVal ADDR_PREFIX_2 As String)
        'comboField.Items.Clear()

        Dim house, add_prefix1, add_prefix2 As String
        If HOUSE_NO.Trim.Length = 0 Then
            house = ""
        Else
            house = HOUSE_NO
        End If
        If ADDR_PREFIX_1.Trim.Length = 0 Then
            add_prefix1 = ""
        Else
            add_prefix1 = ADDR_PREFIX_1
        End If
        If ADDR_PREFIX_2.Trim.Length = 0 Then
            add_prefix2 = ""
        Else
            add_prefix2 = ADDR_PREFIX_2
        End If


        'If HOUSE_NO.Trim.Length = 0 Then
        '    house = ""
        'Else
        '    house = " and HOUSE_NO = '" & HOUSE_NO & "'"
        'End If


        'If ADDR_PREFIX_1.Trim.Length = 0 Then
        '    add_prefix1 = " ADDR_PREFIX_1 is NULL "
        'Else
        '    add_prefix1 = " ADDR_PREFIX_1 = '" & ADDR_PREFIX_1 & "'"
        'End If
        'If ADDR_PREFIX_2.Trim.Length = 0 Then
        '    add_prefix2 = " ADDR_PREFIX_2 is NULL "
        'Else
        '    add_prefix2 = " ADDR_PREFIX_2 = '" & ADDR_PREFIX_2 & "'"
        'End If
        Dim cmdtext As String
        cmdtext = "Fill_Streetname"

        cmd = Nothing

        Try
            cmd = New SqlCommand(cmdtext, conn)
            cmd.CommandType = CommandType.StoredProcedure
            cmd.Parameters.AddWithValue("@HOUSE_NO", house)
            cmd.Parameters.AddWithValue("@ADDR_PREFIX_1", add_prefix1)
            cmd.Parameters.AddWithValue("@ADDR_PREFIX_2", add_prefix2)
            If (conn.State = ConnectionState.Closed) Then
                conn.Open()
            End If
            Dim ds As New DataSet()
            ds.Tables.Clear()
            Dim da As New SqlDataAdapter(cmd)
            da.Fill(ds)
            comboField.DataSource = ds.Tables(0)
            comboField.DisplayMember = "street_nm"
            comboField.ValueMember = "street_nm"
            comboField.SelectedIndex = -1
        Catch ex As Exception
            MessageBox.Show(ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop)
        Finally
            conn.Close()
        End Try

    End Sub
    Private Sub Fill_Streetprefix(ByVal comboField As ComboBox, ByVal HOUSE_NO As String, ByVal ADDR_PREFIX_1 As String, ByVal ADDR_PREFIX_2 As String, ByVal STREET_NM As String, ByVal ADDR_SUFFIX_CD As String)
        'comboField.Items.Clear()
        If (conn.State = ConnectionState.Closed) Then
            conn.Open()
        End If
        Dim cities As String = String.Empty
        Dim house As String = String.Empty
        Dim add_prefix1 As String = String.Empty
        Dim add_prefix2 As String = String.Empty
        Dim street As String = String.Empty
        Dim add_prefix As String = String.Empty

        'If txt_div.Text.Trim = "CENTRAL" Then
        '    cities = "LOCAL_OFFICE_NO IN ('002' ,'005' ,'010', '008' ,'012' ,'014' ,'020' ,'053' ,'054' ,'083', '050' ) "
        'ElseIf txt_div.Text.Trim = "EASTERN" Then
        '    cities = "LOCAL_OFFICE_NO IN ('073', '075', '076', '084', '085', '086' )"
        'ElseIf txt_div.Text.Trim = "COASTAL" Then
        '    cities = "LOCAL_OFFICE_NO IN ('087','088','094')"
        'ElseIf txt_div.Text.Trim = "LOW COUNTRY" Then
        '    cities = "LOCAL_OFFICE_NO IN ('042', '060', '061', '065','080')"
        'ElseIf txt_div.Text.Trim = "SOUTHERN" Then
        '    cities = "LOCAL_OFFICE_NO IN ('023','070', '071', '080','090', '020' ,'091','092','095')"
        'ElseIf txt_div.Text.Trim = "WESTERN" Then
        '    cities = "LOCAL_OFFICE_NO IN ('010', '011', '030', '031', '032', '033', '035', '050','052','055', '089')"
        'End If
        'If HOUSE_NO.Trim.Length = 0 Then
        '    house = " HOUSE_NO is NULL "
        'Else
        '    house = " HOUSE_NO = '" & HOUSE_NO & "'"
        'End If
        'If ADDR_PREFIX_1.Trim.Length = 0 Then
        '    add_prefix1 = " ADDR_PREFIX_1 is NULL "
        'Else
        '    add_prefix1 = " ADDR_PREFIX_1 = '" & ADDR_PREFIX_1 & "'"
        'End If
        'If ADDR_PREFIX_2.Trim.Length = 0 Then
        '    add_prefix2 = " ADDR_PREFIX_2 is NULL "
        'Else
        '    add_prefix2 = " ADDR_PREFIX_2 = '" & ADDR_PREFIX_2 & "'"
        'End If

        'If STREET_NM.Trim.Length = 0 Then
        '    street = " STREET_NM is NULL "
        'Else
        '    street = " STREET_NM = '" & STREET_NM & "'"
        'End If
        'If ADDR_SUFFIX_CD.Trim.Length = 0 Then
        '    add_prefix = " ADDR_SUFFIX_CD is NULL "
        'Else
        '    add_prefix = " ADDR_SUFFIX_CD = '" & ADDR_SUFFIX_CD & "'"
        'End If

        'Dim cmdtext As String
        'cmdtext = "select street_suffix_cd from Address  where " & house & " and " & add_prefix1 & " and " & add_prefix2 & " and " & street & " and " & add_prefix & " and " & cities
        If txt_div.Text.Trim = "Durham" Then
            cities = "DURHAM"
        ElseIf txt_div.Text.Trim = "Asheville" Then
            cities = "ASHEVILLE"
        ElseIf txt_div.Text.Trim = "Gastonia" Then
            cities = "GASTONIA"
        ElseIf txt_div.Text.Trim = "Raleigh" Then
            cities = "RALEIGH"

        ElseIf txt_div.Text.Trim = "CENTRAL" Then
            cities = "CENTRAL"
            'cities = "LOCAL_OFFICE_NO IN ('002' ,'005' ,'010', '008' ,'012' ,'014' ,'020' ,'053' ,'054' ,'083', '050' ) "
        ElseIf txt_div.Text.Trim = "EASTERN" Then
            cities = "EASTERN"
            'cities = "LOCAL_OFFICE_NO IN ('073', '075', '076', '084', '085', '086' )"
        ElseIf txt_div.Text.Trim = "COASTAL" Then
            cities = "COASTAL"
            ' cities = "LOCAL_OFFICE_NO IN ('087','088','094')"
        ElseIf txt_div.Text.Trim = "LOW COUNTRY" Then
            cities = "LOW COUNTRY"
            ' cities = "LOCAL_OFFICE_NO IN ('042', '060', '061', '065','080')"
        ElseIf txt_div.Text.Trim = "SOUTHERN" Then
            cities = "SOUTHERN"
            'cities = "LOCAL_OFFICE_NO IN ('023','070', '071', '080','090', '020' ,'091','092','095')"
        ElseIf txt_div.Text.Trim = "WESTERN" Then
            cities = "WESTERN"
            'cities = "LOCAL_OFFICE_NO IN ('010', '011', '030', '031', '032', '033', '035', '050','052','055', '089')"
        End If
        If HOUSE_NO.Trim.Length = 0 Then
            house = ""
        Else
            house = HOUSE_NO
        End If
        If ADDR_PREFIX_1.Trim.Length = 0 Then
            add_prefix1 = ""
        Else
            add_prefix1 = ADDR_PREFIX_1
        End If
        If ADDR_PREFIX_2.Trim.Length = 0 Then
            add_prefix2 = ""
        Else
            add_prefix2 = ADDR_PREFIX_2
        End If

        If STREET_NM.Trim.Length = 0 Then
            street = ""
        Else
            street = STREET_NM
        End If
        If ADDR_SUFFIX_CD.Trim.Length = 0 Then
            add_prefix = ""
        Else
            add_prefix = ADDR_SUFFIX_CD
        End If

        Dim cmdtext As String
        cmdtext = "Fill_Streetprefix"
        Dim dr As SqlDataReader = Nothing
        cmd = New SqlCommand(cmdtext, conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@HOUSE_NO", house)
        cmd.Parameters.AddWithValue("@ADDR_PREFIX_1", add_prefix1)
        cmd.Parameters.AddWithValue("@ADDR_PREFIX_2", add_prefix2)
        cmd.Parameters.AddWithValue("@STREET_NM", street)
        cmd.Parameters.AddWithValue("@ADDR_SUFFIX_CD", add_prefix)
        cmd.Parameters.AddWithValue("@divison", cities)

        dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        If (dr.Read) Then
            comboField.Text = dr(0).ToString
        End If
        dr.Close()
        If (conn.State = ConnectionState.Open) Then
            conn.Close()
        End If
        'cmd = Nothing
        'Try
        '    cmd = New SqlCommand(cmdtext)
        '    If (conn.State = ConnectionState.Closed) Then
        '        conn.Open()
        '    End If
        '    Dim ds As New DataSet()
        '    ds.Tables.Clear()
        '    Dim da As New SqlDataAdapter(cmd.CommandText, conn)
        '    da.Fill(ds)
        '    comboField.DataSource = ds.Tables(0)
        '    comboField.DisplayMember = "street_suffix_cd"
        '    comboField.ValueMember = "street_suffix_cd"
        '    comboField.SelectedIndex = -1
        'Catch ex As Exception
        '    MessageBox.Show(ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop)
        'Finally
        '    conn.Close()
        'End Try

    End Sub
    Private Sub resetfiledata()
        chk_stub.Checked = False
        chk_inserted.Checked = False
        chk_retired.Checked = False
        ckh_leak.Checked = False
        chk_split.Checked = False

        chk_relocate.Checked = False
        chk_replace.Checked = False

        cmb_loccd_1.Text = " "
        txt_loccd_2.Text = ""
       
        ''Reset 100BLK
        If cmb_formtype.Text.Trim = "FORM-100BLK" Then
            Me.txt_100b_add1.Text = ""
            cmb_100b_add2.Text = " "
            cmb_100b_add2_1.Text = " "
            cmb_100b_add3.Text = ""
            cmb_100b_add4_1.Text = ""
            cmb_100b_add4.Text = ""
            'Me.txt_100b_name.Text = ""
            Me.txt_100b_dated.Text = ""
            txt_100b_dateabandon.Text = ""
            Me.cmb_100b_city.SelectedIndex = -1
            Me.cmb_100b_city.Text = ""
            'Me.txt_100b_subdiv.Text = ""
            'Me.txt_100b_serno.Text = ""
            Me.cmb_100b_pipesize.SelectedIndex = -1
            Me.cmb_100b_pipekind.SelectedIndex = -1
            Me.cmb_100b_pressure.SelectedIndex = -1
            Me.cmb_100b_tapsize.SelectedIndex = -1
            'Me.txt_100b_ser_ft.Text = ""
            'Me.txt_100b_ser_in.Text = ""
            'Me.txt_100b_depser_ft.Text = ""
            'Me.txt_100b_depser_in.Text = ""
            Me.txt_100b_mainln_ft.Text = ""
            'Me.txt_100b_mainln_in.Text = ""
            Me.txt_100b_propln_ft.Text = ""
            'Me.txt_100b_propln_in.Text = ""
            Me.txt_100b_lenmtrtomain.Text = ""
            Me.cmb_100b_mainsize.SelectedIndex = -1
            Me.cmb_100b_maintype.SelectedIndex = -1
            Me.txt_100b_deptmain.Text = ""
            Me.cmb_100b_testedwith.SelectedIndex = -1
            Me.cmb_100b_testedto.SelectedIndex = -1
            Me.txt_100b_psigmin.Text = ""
            'Me.txt_100b_installedby.Text = ""
            'Me.txt_100b_foreman.Text = ""
            Me.txt_100b_remark.Text = ""
            Me.txt_100b_premiseno.Text = ""

            txt_100b_installedyear.Text = ""
            txt_100b_a_ps_reading.Text = ""
            txt_100b_tot_anodes_1.Text = ""
            txt_100b_tot_anodes_17.Text = ""
            txt_100b_lr.Text = ""
            Me.txt_100b_incheswc.Text = ""

            ''Reset 100BLK
        ElseIf cmb_formtype.Text.Trim = "FORM-100BLK-MISC" Then
            Me.txt_100b_m_add1.Text = ""
            cmb_100b_m_add2.Text = " "
            cmb_100b_m_add2_1.Text = " "
            cmb_100b_m_add3.Text = ""
            cmb_100b_m_add4_1.Text = ""
            cmb_100b_m_add4.Text = ""
            'Me.txt_100b_m_name.Text = ""
            Me.txt_100b_m_dated.Text = ""
            txt_100b_m_dateabandon.Text = ""
            Me.cmb_100b_m_city.SelectedIndex = -1
            Me.cmb_100b_m_city.Text = ""
            'Me.txt_100b_m_subdiv.Text = ""
            'Me.txt_100b_m_serno.Text = ""
            Me.cmb_100b_m_pipesize.SelectedIndex = -1
            Me.cmb_100b_m_pipekind.SelectedIndex = -1
            Me.cmb_100b_m_pressure.SelectedIndex = -1
            Me.cmb_100b_m_tapsize.SelectedIndex = -1
            'Me.txt_100b_m_ser_ft.Text = ""
            'Me.txt_100b_m_ser_in.Text = ""
            'Me.txt_100b_m_depser_ft.Text = ""
            'Me.txt_100b_m_depser_in.Text = ""
            Me.txt_100b_m_mainln_ft.Text = ""
            'Me.txt_100b_m_mainln_in.Text = ""
            Me.txt_100b_m_propln_ft.Text = ""
            'Me.txt_100b_m_propln_in.Text = ""
            Me.txt_100b_m_lenmtrtomain.Text = ""
            Me.cmb_100b_m_mainsize.SelectedIndex = -1
            Me.cmb_100b_m_maintype.SelectedIndex = -1
            Me.txt_100b_m_deptmain.Text = ""
            Me.cmb_100b_m_testedwith.SelectedIndex = -1
            Me.cmb_100b_m_testedto.SelectedIndex = -1
            Me.txt_100b_m_psigmin.Text = ""
            'Me.txt_100b_m_installedby.Text = ""
            'Me.txt_100b_m_foreman.Text = ""
            Me.txt_100b_m_remark.Text = ""
            Me.txt_100b_m_premiseno.Text = ""

            txt_100b_m_installedyear.Text = ""
            txt_100b_m_a_ps_reading.Text = ""
            txt_100b_m_tot_anodes_1.Text = ""
            txt_100b_m_tot_anodes_17.Text = ""
            txt_100b_m_lr.Text = ""
            Me.txt_100b_m_incheswc.Text = ""

        ElseIf cmb_formtype.Text.Trim = "FORM-200BLK" Then
            'file_name = Me.txt_filedesc.Text
            'file_type = Me.cmb_formtype.Text
            Me.txthouseNo1.Text = ""
            cmbPrefix11.Text = " "
            cmbPrefix22.Text = " "
            cmbStreetname1.Text = ""
            cmbsuffix12.Text = ""
            cmbsuffix22.Text = ""
            Me.txtDate1.Text = ""
            Me.txt_Retired_date.Text = ""
            Me.cmb_200b_city.Text = ""
            cmb_pipe_size.SelectedIndex = -1
            cmb_typeofservice.SelectedIndex = -1
            cmbPressure.SelectedIndex = -1
            Me.cmb_main_size.SelectedIndex = -1
            Me.cmb_main_type.SelectedIndex = -1
            Me.cmbTapSize.SelectedIndex = -1
            'Me.cmbDepthMain.SelectedIndex = -1
            Me.txtDepthMain.Text = ""
            Me.cmbMedium.SelectedIndex = -1
            cmbPressure.SelectedIndex = -1
            'tested_to = Me.cmb_4_testedto.Text
            Me.txt_length1.Text = ""
            'installed_by_contractor = Me.txt_4_installedby.Text
            'foreman = Me.txt_4_foreman.Text
            Me.txt_Remarks.Text = ""
            chk2lbSystem.Checked = False
            'Me.chk2lbSystemNo1.Checked = False
            txt_200b_premiseno.Text = ""

            Me.txtmainToBackOfCurb.Text = ""
            Me.txt_pipesize_length.Text = ""
            Me.txtPS_Reading.Text = ""

            Me.cmbRetiredSize.SelectedIndex = -1
            Me.txtUnitsRetired.Text = ""
            Me.txtLengthRetired.Text = ""
            Me.txtRetiredQnty.Text = ""

        ElseIf cmb_formtype.Text.Trim = "FORM-200BLK_PAGE1" Then
            Me.txthouseNo.Text = ""
            cmbPrefix1.Text = " "
            cmbPrefix2.Text = " "
            cmbStreetname.Text = ""
            cmbsuffix1.Text = ""
            cmbsuffix2.Text = ""
            Me.txtDate_p1.Text = ""
            Me.txt_Retired_date_p1.Text = ""
            Me.cmb_200b_city_p1.Text = ""
            cmb_pipe_size_p1.SelectedIndex = -1
            cmb_typeofservice_p1.SelectedIndex = -1
            cmbPressure_p1.SelectedIndex = -1
            Me.cmb_main_size_p1.SelectedIndex = -1
            Me.cmb_main_type_p1.SelectedIndex = -1
            Me.cmbTapSize_p1.SelectedIndex = -1
            'Me.cmbDepthMain.SelectedIndex = -1
            Me.txtDepthMain_p1.Text = ""
            Me.cmbMedium_p1.SelectedIndex = -1
            cmbPressure_p1.SelectedIndex = -1
            'tested_to = Me.cmb_4_testedto.Text
            Me.txt_length1_p1.Text = ""
            'installed_by_contractor = Me.txt_4_installedby.Text
            'foreman = Me.txt_4_foreman.Text
            Me.txt_Remarks_p1.Text = ""
            chk2lbSystem_p1.Checked = False
            'Me.chk2lbSystemNo1.Checked = False
            txt_200b_premiseno_p1.Text = ""

            Me.txtmainToBackOfCurb_p1.Text = ""
            Me.txt_pipesize_length_p1.Text = ""
            Me.txtPS_Reading_p1.Text = ""

            Me.cmbRetiredSize_p1.SelectedIndex = -1
            Me.txtUnitsRetired_p1.Text = ""
            Me.txtLengthRetired_p1.Text = ""
            Me.txtRetiredQnty_p1.Text = ""

        ElseIf cmb_formtype.Text.Trim = "Yellow" Then
            'txt_fileid.Text = ""
            'txt_filedesc.Text = ""
            'cmb_formtype.Text = ""
            Me.txt_y_add1.Text = ""
            cmb_y_add2.Text = " "
            cmb_y_add2_1.Text = " "

            cmb_y_add3.Text = ""
            cmb_y_add4_1.Text = ""
            cmb_y_add4.Text = ""
            Me.txt_y_name.Text = ""
            Me.txt_y_dated.Text = ""
            Me.cmb_y_city.SelectedIndex = -1
            Me.txt_y_subdiv.Text = ""
            Me.txt_y_serno.Text = ""
            Me.cmb_y_pipesize.SelectedIndex = -1
            Me.cmb_y_pipekind.SelectedIndex = -1
            Me.cmb_y_pressure.SelectedIndex = -1
            Me.cmb_y_tapzize.SelectedIndex = -1
            Me.txt_y_ser_ft.Text = ""
            Me.txt_y_ser_in.Text = ""
            Me.txt_y_depser_ft.Text = ""
            Me.txt_y_depser_in.Text = ""
            Me.txt_y_mainln_ft.Text = ""
            Me.txt_y_mainln_in.Text = ""
            Me.txt_y_propln_ft.Text = ""
            Me.txt_y_propln_in.Text = ""
            Me.cmb_y_mainsize.SelectedIndex = -1
            Me.cmb_y_maintype.SelectedIndex = -1
            Me.txt_y_deptmain.Text = ""
            Me.cmb_y_testedwith.SelectedIndex = -1
            Me.cmb_y_testedto.SelectedIndex = -1
            Me.txt_y_psigmin.Text = ""
            Me.txt_y_installedby.Text = ""
            Me.txt_y_foreman.Text = ""
            Me.txt_y_remark.Text = ""
            Me.txt_y_premiseno.Text = ""

        ElseIf cmb_formtype.Text.Trim = "ORIGINAL" Then
            'txt_fileid.Text = ""
            'txt_filedesc.Text = ""
            'cmb_formtype.Text = ""
            Me.txt_q_add1.Text = ""
            cmb_q_add2.Text = " "
            cmb_q_add2_1.Text = " "

            cmb_q_add3.Text = ""
            cmb_q_add4_1.Text = ""
            cmb_q_add4.Text = ""

            Me.txt_q_dated.Text = ""
            Me.cmb_q_city.SelectedIndex = -1

            Me.cmb_q_pipesize.SelectedIndex = -1
            Me.cmb_q_pipekind.SelectedIndex = -1

            Me.cmb_q_mainsize.SelectedIndex = -1
            Me.cmb_q_maintype.SelectedIndex = -1

            Me.cmb_q_testedwith.SelectedIndex = -1
            Me.cmb_q_testedto.SelectedIndex = -1
            Me.txt_q_psigmin.Text = ""

            Me.txt_q_remark.Text = ""
            Me.txt_q_premiseno.Text = ""


            txt_q_lenmtrtomain.Text = ""
            cmb_q_coating.SelectedIndex = -1

            chk_q_noblow.Checked = False


            chk_q_defcoatcor.Checked = False
            chk_q_multimeter.Checked = False

            chk_q_serstop.Checked = False
            chk_q_cathodpro.Checked = False
            chk_q_tee.Checked = False
            chk_q_taptee.Checked = False
            chk_q_galvanized.Checked = False
            txt_q_ttsize.Text = ""
            txt_q_ttinlet.Text = ""
            txt_q_ttoutlet.Text = ""
            chk_q_insulated.Checked = False
            chk_q_anoderiser.Checked = False
            txt_q_otheranode.Text = ""

        ElseIf cmb_formtype.Text.Trim = "MISC" Then

            Me.txt_l_add1.Text = ""
            cmb_l_add2.Text = " "
            cmb_l_add2_1.Text = " "
            cmb_l_add3.Text = ""
            cmb_l_add4_1.Text = ""
            cmb_l_add4.Text = ""
            Me.txt_l_remark.Text = ""
            Me.txt_l_premiseno.Text = ""
            cmb_l_misCtype.Text = ""
        ElseIf cmb_formtype.Text.Trim = "ORIGINAL-R" Then

            Me.txt_r_add1.Text = ""
            cmb_r_add2.Text = " "
            cmb_r_add2_1.Text = " "

            cmb_r_add3.Text = ""
            cmb_r_add4_1.Text = ""
            cmb_r_add4.Text = ""

            Me.txt_r_dated.Text = ""
            Me.cmb_r_city.SelectedIndex = -1

            Me.cmb_r_pipesize.SelectedIndex = -1
            Me.cmb_r_pipekind.SelectedIndex = -1

            Me.cmb_r_mainsize.SelectedIndex = -1
            Me.cmb_r_maintype.SelectedIndex = -1

            Me.cmb_r_testedwith.SelectedIndex = -1
            Me.cmb_r_testedto.SelectedIndex = -1
            Me.txt_r_psigmin.Text = ""

            Me.txt_r_remark.Text = ""
            Me.txt_r_premiseno.Text = ""


            txt_r_lenmtrtomain.Text = ""


            chk_r_noblow.Checked = False


            chk_r_defcoatcor.Checked = False


            chk_r_serstop.Checked = False
            chk_r_cathodpro.Checked = False

            txt_r_ttsize.Text = ""
            txt_r_ttinlet.Text = ""
            txt_r_ttoutlet.Text = ""
            chk_r_insulated.Checked = False
            chk_r_anoderiser.Checked = False
            txt_r_otheranode.Text = ""
            cmb_r_connection_data.Text = ""
            cmb_r_connection_data.SelectedIndex = -1



        ElseIf cmb_formtype.Text.Trim = "ABANDON-II" Then
            'txt_fileid.Text = ""
            'txt_filedesc.Text = ""
            'cmb_formtype.Text = ""
            Me.txt_a_add1.Text = ""
            cmb_a_add2.Text = " "
            cmb_a_add2_1.Text = " "

            cmb_a_add3.Text = ""
            cmb_a_add4_1.Text = ""
            cmb_a_add4.Text = ""

            Me.cmb_a_city.SelectedIndex = -1

            Me.cmb_a_mainsize.SelectedIndex = -1
            Me.cmb_a_maintype.SelectedIndex = -1

            Me.cmb_a_testedwith.SelectedIndex = -1


            Me.txt_a_installedby.Text = ""

            Me.txt_a_remark.Text = ""
            Me.txt_a_premiseno.Text = ""
            txt_a_lenmtrtomain.Text = ""
            txt_a_dateabandon.Text = ""
            cmb_a_reasonabandon.SelectedIndex = -1
            chk_a_noblow.Checked = False
            chk_a_gassource.Checked = False
            chk_a_tappingtee.Checked = False
            chk_a_linesealed.Checked = False
        ElseIf cmb_formtype.Text.Trim = "Form-X" Then

            Me.txt_x_add1.Text = ""
            cmb_x_add2.Text = " "
            cmb_x_add2_1.Text = " "

            cmb_x_add3.Text = ""
            cmb_x_add4_1.Text = ""
            cmb_x_add4.Text = ""

            Me.txt_x_dated.Text = ""
            Me.cmb_x_city.SelectedIndex = -1

            Me.cmb_x_pipesize.SelectedIndex = -1
            Me.cmb_x_pipekind.SelectedIndex = -1
            Me.txt_x_mainln_ft.Text = ""
            Me.txt_x_mainln_in.Text = ""
            Me.txt_x_propln_ft.Text = ""
            Me.txt_x_propln_in.Text = ""
            Me.cmb_x_mainsize.SelectedIndex = -1
            Me.cmb_x_maintype.SelectedIndex = -1

            Me.cmb_x_testedwith.SelectedIndex = -1
            Me.cmb_x_testedto.SelectedIndex = -1

            Me.txt_x_installedby.Text = ""

            Me.txt_x_remark.Text = ""
            Me.txt_x_premiseno.Text = ""
            txt_x_lenmtrtomain.Text = ""
            cmb_x_coating.SelectedIndex = -1
        ElseIf cmb_formtype.Text.Trim = "FORM-IX" Then

            Me.txt_9_add1.Text = ""
            cmb_9_add2.Text = " "
            cmb_9_add2_1.Text = " "

            cmb_9_add3.Text = ""
            cmb_9_add4_1.Text = ""
            cmb_9_add4.Text = ""

            Me.txt_9_dated.Text = ""
            Me.cmb_9_city.SelectedIndex = -1

            Me.txt_9_serno.Text = ""
            Me.cmb_9_pipesize.SelectedIndex = -1
            Me.cmb_9_pipekind.SelectedIndex = -1

            Me.cmb_9_tapzize.SelectedIndex = -1


            Me.cmb_9_mainsize.SelectedIndex = -1
            Me.cmb_9_maintype.SelectedIndex = -1

            Me.txt_9_foreman.Text = ""
            Me.txt_9_remark.Text = ""
            Me.txt_9_premiseno.Text = ""
            txt_9_lenmtrtomain.Text = ""
            cmb_9_coating.SelectedIndex = -1

        ElseIf cmb_formtype.Text.Trim = "Form-954" Then

            Me.txt_7_add1.Text = ""
            cmb_7_add2.Text = " "
            cmb_7_add2_1.Text = " "

            cmb_7_add3.Text = ""
            cmb_7_add4_1.Text = ""
            cmb_7_add4.Text = ""

            Me.txt_7_dated.Text = ""
            Me.cmb_7_city.SelectedIndex = -1

            Me.cmb_7_pipesize.SelectedIndex = -1
            Me.cmb_7_pipekind.SelectedIndex = -1

            Me.cmb_7_tapzize.SelectedIndex = -1

            Me.txt_7_mainln_ft.Text = ""
            Me.txt_7_mainln_in.Text = ""

            Me.cmb_7_mainsize.SelectedIndex = -1
            Me.cmb_7_maintype.SelectedIndex = -1

            Me.txt_7_remark.Text = ""
            Me.txt_7_premiseno.Text = ""
            txt_7_lenmtrtomain.Text = ""
            cmb_7_naturework.SelectedIndex = -1
            cmb_7_kindjoint.SelectedIndex = -1
            txt_7_splitsleeve.Text = ""
            txt_7_loccock.Text = ""
            txt_7_kindbox.Text = ""
            cmb_7_coating.SelectedIndex = -1

        ElseIf cmb_formtype.Text.Trim = "ABANDON-I" Then
            'txt_fileid.Text = ""
            'txt_filedesc.Text = ""
            'cmb_formtype.Text = ""
            Me.txt_8_add1.Text = ""
            cmb_8_add2.Text = " "
            cmb_8_add2_1.Text = " "
            cmb_8_add3.Text = ""
            cmb_8_add4_1.Text = ""
            cmb_8_add4.Text = ""
            Me.txt_8_dated.Text = ""
            Me.cmb_8_city.SelectedIndex = -1
            Me.cmb_8_mainsize.SelectedIndex = -1
            Me.cmb_8_maintype.SelectedIndex = -1

            Me.txt_8_remark.Text = ""
            Me.txt_8_premiseno.Text = ""
            txt_8_dateabandon.Text = ""
            cmb_8_coating.SelectedIndex = -1

        ElseIf cmb_formtype.Text.Trim = "Form-80I" Then
            'txt_fileid.Text = ""
            'txt_filedesc.Text = ""
            'cmb_formtype.Text = ""
            txt_6_add1.Text = ""
            cmb_6_add2.Text = " "
            cmb_6_add2_1.Text = " "

            cmb_6_add3.Text = ""
            cmb_6_add4_1.Text = ""
            cmb_6_add4.Text = ""

            txt_6_dated.Text = ""
            cmb_6_city.SelectedIndex = -1

            cmb_6_pipesize.SelectedIndex = -1
            cmb_6_pipekind.SelectedIndex = -1
            cmb_6_pipekind.SelectedIndex = -1

            txt_6_ser_ft.Text = ""
            txt_y_ser_in.Text = ""
            Me.txt_6_depser_ft.Text = ""
            Me.txt_6_depser_in.Text = ""

            Me.cmb_6_mainsize.SelectedIndex = -1
            Me.cmb_6_maintype.SelectedIndex = -1
            Me.txt_6_deptmain.Text = ""
            Me.cmb_6_testedwith.SelectedIndex = -1
            Me.cmb_6_testedto.SelectedIndex = -1
            Me.txt_6_psigmin.Text = ""

            Me.txt_6_remark.Text = ""
            Me.txt_6_premiseno.Text = ""
            txt_6_lenmtrtomain.Text = ""
        ElseIf cmb_formtype.Text.Trim = "OD-9-6-38" Then
            'txt_fileid.Text = ""
            'txt_filedesc.Text = ""
            'cmb_formtype.Text = ""
            txt_5_add1.Text = ""
            cmb_5_add2.Text = " "
            cmb_5_add2_1.Text = " "
            cmb_5_add3.Text = ""
            cmb_5_add4_1.Text = ""
            cmb_5_add4.Text = ""
            Me.txt_5_dated.Text = ""
            Me.cmb_5_city.SelectedIndex = -1
            Me.txt_5_serno.Text = ""
            Me.cmb_5_pipesize.SelectedIndex = -1
            Me.cmb_5_pipekind.SelectedIndex = -1
            Me.txt_5_ser_ft.Text = ""
            Me.txt_5_depser_ft.Text = ""
            Me.txt_5_propln_ft.Text = ""
            Me.txt_5_remark.Text = ""
            Me.txt_5_premiseno.Text = ""
        ElseIf cmb_formtype.Text.Trim = "Form235-B-702" Then
            'txt_fileid.Text = ""
            'txt_filedesc.Text = ""
            'cmb_formtype.Text = ""
            txt_4_add1.Text = ""
            cmb_4_add2.Text = " "
            cmb_4_add2_1.Text = " "

            cmb_4_add3.Text = ""
            cmb_4_add4_1.Text = ""
            cmb_4_add4.Text = ""
            txt_4_name.Text = ""
            txt_4_dated.Text = ""
            cmb_4_city.SelectedIndex = -1

            cmb_4_pipesize.SelectedIndex = -1
            cmb_4_pipekind.SelectedIndex = -1
            cmb_4_pressure.SelectedIndex = -1

            cmb_4_mainsize.SelectedIndex = -1
            cmb_4_maintype.SelectedIndex = -1
            txt_4_deptmain.Text = ""
            cmb_4_testedwith.SelectedIndex = -1
            cmb_4_testedto.SelectedIndex = -1
            txt_4_psigmin.Text = ""
            txt_4_installedby.Text = ""
            txt_4_foreman.Text = ""
            txt_4_remark.Text = ""
            txt_4_premiseno.Text = ""
            cmb_4_condition.Text = ""
            txt_4_lenmtrtomain.Text = ""
            txt_4_sceginspect.Text = ""
        ElseIf cmb_formtype.Text.Trim = "White" Then
            'txt_fileid.Text = ""
            'txt_filedesc.Text = ""
            'cmb_formtype.Text = ""
            txt_w_add1.Text = ""
            cmb_w_add2.Text = " "

            cmb_w_add2_1.Text = " "
            cmb_w_add3.Text = ""
            cmb_w_add4_1.Text = ""
            cmb_w_add4.Text = ""
            txt_w_name.Text = ""
            txt_w_dated.Text = ""
            cmb_w_city.SelectedIndex = -1
            txt_w_subdiv.Text = ""
            txt_w_serno.Text = ""
            cmb_w_pipesize.SelectedIndex = -1
            cmb_w_pipekind.SelectedIndex = -1
            cmb_w_pressure.SelectedIndex = -1
            cmb_w_tapzize.SelectedIndex = -1
            txt_w_ser_ft.Text = ""
            txt_w_ser_in.Text = ""
            txt_w_depser_ft.Text = ""
            cmb_w_mainsize.SelectedIndex = -1
            cmb_w_maintype.SelectedIndex = -1
            txt_w_deptmain.Text = ""
            cmb_w_testedwith.SelectedIndex = -1
            cmb_w_testedto.SelectedIndex = -1
            txt_w_psigmin.Text = ""
            Me.txt_w_installedby.Text = ""
            txt_w_foreman.Text = ""
            txt_w_remark.Text = ""
            Me.txt_w_premiseno.Text = ""

        ElseIf Me.cmb_formtype.Text.Trim = "Orange" Then
            txt_3_add1.Text = ""
            cmb_3_add2.Text = " "
            cmb_3_add2_1.Text = " "
            cmb_3_add3.Text = ""
            cmb_3_add4_1.Text = ""
            cmb_3_add4.Text = ""
            txt_3_dated.Text = ""
            Me.cmb_3_city.SelectedIndex = -1
            cmb_3_pipesize.SelectedIndex = -1
            cmb_3_pipekind.SelectedIndex = -1
            cmb_3_pressure.SelectedIndex = -1
            cmb_3_tapzize.SelectedIndex = -1
            txt_3_ser_ft.Text = ""
            txt_3_depser_ft.Text = ""
            txt_3_mainln_ft.Text = ""
            txt_3_propln_ft.Text = ""
            cmb_3_maintype.SelectedIndex = -1
            cmb_3_mainsize.SelectedIndex = -1
            txt_3_installedby.Text = ""
            txt_3_remark.Text = ""
            txt_3_premiseno.Text = ""



        End If
    End Sub
    Private Sub update_fileid_status(ByVal file_id As String)
        If conn.State = ConnectionState.Closed Then
            conn.Open()
        End If
        Try
            'Dim sql As String = ""
            Dim var As String = ""
            If btn_submit.Text.Trim = "SUBMIT" Then
                var = "SUBMIT"
                'Sql = "update tbl_parent set status = 'E' , dataentry_date = getdate() ,  dataentry_by = " & commonUser.Common.uID & " where file_id = " & file_id & " and assigned_to = " & commonUser.Common.uID & ""
            ElseIf btn_submit.Text.Trim = "UPDATE" Then
                var = "UPDATE"
                'Sql = "update tbl_parent set status = 'E' ,  dataentry_by = " & commonUser.Common.uID & " where file_id = " & file_id & " and assigned_to = " & commonUser.Common.uID & ""
            End If
            Dim cmd As New SqlCommand("SO_FrmDataentry_Updatefileidstatus", conn)
            cmd.CommandType = CommandType.StoredProcedure
            cmd.Parameters.AddWithValue("@var", var)
            cmd.Parameters.AddWithValue("@entryby", commonUser.Common.uID)
            cmd.Parameters.AddWithValue("@fileid", file_id)
            cmd.Parameters.AddWithValue("@assignedto", commonUser.Common.uID)

            cmd.ExecuteNonQuery()
            'MsgBox("User Added Successfully!!", MsgBoxStyle.Information, "User Added")
            'btn_Update.Text = "Update"
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub

    Public Function add_data()
        Dim msg As Boolean = False
        Try
            If conn.State = ConnectionState.Closed Then
                conn.Open()
            End If

            Dim file_name As String = ""
            Dim file_type As String = ""
            Dim add_streetno As String = ""
            Dim add_prefix As String = ""
            Dim add_prefix_2 As String = ""
            Dim add_streetname As String = ""
            Dim add_suffix As String = ""
            Dim street_suffix_cd As String = ""
            Dim name As String = ""
            Dim date_installed As String = ""
            Dim city As String = ""
            Dim subdivision As String = ""
            Dim service_wo_no As String = ""
            Dim pipe_size As String = ""
            Dim pipe_type As String = ""
            Dim pressure As String = ""
            Dim size_of_tap As String = ""
            Dim size_of_main As String = ""
            Dim type_of_main As String = ""
            Dim depth_of_main As String = ""
            Dim tested_with As String = ""
            Dim tested_to As String = ""
            Dim psig_for_minutes As String = ""
            Dim installed_by_contractor As String = ""
            Dim foreman As String = ""
            Dim remark As String = ""
            Dim PREMISE_NO As String = ""
            Dim pipe_condition As String = ""
            Dim sceginspect As String = ""
            Dim nature_of_work As String = ""
            Dim kind_of_joint As String = ""
            Dim split_sleeve As String = ""
            Dim loc_of_cock As String = ""
            Dim kind_of_box As String = ""
            Dim type_coating As String = ""
            Dim DATE_ABANDON As String = ""
            Dim reason_of_abandon As String = ""
            Dim f_multimeter As String = ""
            Dim tap_t_size As String = ""
            Dim tap_t_inlet As String = ""
            Dim tap_t_outlet As String = ""
            Dim otheranode_lbs As String = ""
            Dim connection_data As String = ""
            Dim misc_card_type As String = ""
            Dim STREET_LOCATION_1_CD As String = ""
            Dim STREET_LOCATION_2_CD As String = ""
            Dim lenmtrtomain As Integer
            Dim length_main_to_property_line_ft, length_main_to_property_line_in, length_property_line_to_meter_ft, length_property_line_to_meter_in As Integer
            Dim f_stub, f_inserted, f_retired, f_leak, f_split, f_noblow, f_gassource, f_tappingtee, f_linesealed, f_defcoatcor, f_serstop, f_cathodpro, f_tee, f_taptee, f_galvanized, f_insulated, f_anoderiser, f_relocate, f_replace As Boolean
            Dim file_id, length_main_to_curb_valve_ft, length_main_to_curb_valve_in, length_curb_valve_to_property_line_ft, length_curb_valve_to_property_line_in As Integer

            'New fields for 100BLK
            Dim main_installed_year As String = ""
            Dim a_ps_reading As String = ""
            Dim tot_anodes_1 As String = ""
            Dim tot_anodes_17 As String = ""
            Dim lr As String = ""
            Dim inches_wc As String = ""

            Dim RetiredSize As String = ""
            Dim UnitsRetired As String = ""
            Dim LengthRetired As String = ""
            Dim RetiredQty As String = ""
            Dim LbSystem As Boolean
            Dim sql1 As String = ""
            file_id = Me.txt_fileid.Text.Trim()


            ''ADD 100BLK
            If Me.cmb_formtype.Text = "FORM-100BLK" Then
                file_name = Me.txt_filedesc.Text '"Test.pdf" 
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_100b_add1.Text
                add_prefix = cmb_100b_add2.Text
                add_prefix_2 = cmb_100b_add2_1.Text
                add_streetname = cmb_100b_add3.Text
                add_suffix = cmb_100b_add4_1.Text
                street_suffix_cd = cmb_100b_add4.Text
                city = Me.cmb_100b_city.Text
                date_installed = Me.txt_100b_dated.Text
                DATE_ABANDON = txt_100b_dateabandon.Text

                'subdivision = Me.txt_y_subdiv.Text
                'service_wo_no = Me.txt_y_serno.Text
                pipe_size = Replace(Me.cmb_100b_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_100b_pipekind.Text
                pressure = Me.cmb_100b_pressure.Text
                size_of_tap = Replace(Me.cmb_100b_tapsize.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                'length_main_to_curb_valve_ft = Replace(Me.txt_y_ser_ft.Text, "'", "''")
                'length_main_to_curb_valve_in = Replace(Me.txt_y_ser_in.Text, "'", "''")
                'length_curb_valve_to_property_line_ft = Replace(Me.txt_y_depser_ft.Text, "'", "''")
                'length_curb_valve_to_property_line_in = Replace(Me.txt_y_depser_in.Text, "'", "''")
                length_main_to_property_line_ft = Replace(Me.txt_100b_mainln_ft.Text, "'", "''")

                'length_main_to_property_line_in = Replace(Me.txt_y_mainln_in.Text, "'", "''")
                length_property_line_to_meter_ft = Replace(Me.txt_100b_propln_ft.Text, "'", "''")
                'length_property_line_to_meter_in = Replace(Me.txt_y_propln_in.Text, "'", "''")
                lenmtrtomain = Replace(Me.txt_100b_lenmtrtomain.Text, "'", "''")

                size_of_main = Replace(Me.cmb_100b_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_100b_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                depth_of_main = Me.txt_100b_deptmain.Text
                tested_with = Me.cmb_100b_testedwith.Text
                tested_to = Me.cmb_100b_testedto.Text
                psig_for_minutes = Me.txt_100b_psigmin.Text
                'installed_by_contractor = Me.txt_y_installedby.Text
                'foreman = Me.txt_y_foreman.Text
                remark = Me.txt_100b_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_100b_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If

                main_installed_year = txt_100b_installedyear.Text
                a_ps_reading = txt_100b_a_ps_reading.Text
                tot_anodes_1 = txt_100b_tot_anodes_1.Text
                tot_anodes_17 = txt_100b_tot_anodes_17.Text
                lr = txt_100b_lr.Text
                inches_wc = Me.txt_100b_incheswc.Text
            End If

            ''ADD FORM-100BLK-MISC
            If Me.cmb_formtype.Text = "FORM-100BLK-MISC" Then
                file_name = Me.txt_filedesc.Text '"Test.pdf" 
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_100b_m_add1.Text
                add_prefix = cmb_100b_m_add2.Text
                add_prefix_2 = cmb_100b_m_add2_1.Text
                add_streetname = cmb_100b_m_add3.Text
                add_suffix = cmb_100b_m_add4_1.Text
                street_suffix_cd = cmb_100b_m_add4.Text
                city = Me.cmb_100b_m_city.Text
                date_installed = Me.txt_100b_m_dated.Text
                DATE_ABANDON = txt_100b_m_dateabandon.Text

                'subdivision = Me.txt_y_subdiv.Text
                'service_wo_no = Me.txt_y_serno.Text
                pipe_size = Replace(Me.cmb_100b_m_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_100b_m_pipekind.Text
                pressure = Me.cmb_100b_m_pressure.Text
                size_of_tap = Replace(Me.cmb_100b_m_tapsize.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                'length_main_to_curb_valve_ft = Replace(Me.txt_y_ser_ft.Text, "'", "''")
                'length_main_to_curb_valve_in = Replace(Me.txt_y_ser_in.Text, "'", "''")
                'length_curb_valve_to_property_line_ft = Replace(Me.txt_y_depser_ft.Text, "'", "''")
                'length_curb_valve_to_property_line_in = Replace(Me.txt_y_depser_in.Text, "'", "''")
                length_main_to_property_line_ft = Replace(Me.txt_100b_m_mainln_ft.Text, "'", "''")

                'length_main_to_property_line_in = Replace(Me.txt_y_mainln_in.Text, "'", "''")
                length_property_line_to_meter_ft = Replace(Me.txt_100b_m_propln_ft.Text, "'", "''")
                'length_property_line_to_meter_in = Replace(Me.txt_y_propln_in.Text, "'", "''")
                lenmtrtomain = Replace(Me.txt_100b_m_lenmtrtomain.Text, "'", "''")

                size_of_main = Replace(Me.cmb_100b_m_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_100b_m_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                depth_of_main = Me.txt_100b_m_deptmain.Text
                tested_with = Me.cmb_100b_m_testedwith.Text
                tested_to = Me.cmb_100b_m_testedto.Text
                psig_for_minutes = Me.txt_100b_m_psigmin.Text
                'installed_by_contractor = Me.txt_y_installedby.Text
                'foreman = Me.txt_y_foreman.Text
                remark = Me.txt_100b_m_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_100b_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If

                main_installed_year = txt_100b_m_installedyear.Text
                a_ps_reading = txt_100b_m_a_ps_reading.Text
                tot_anodes_1 = txt_100b_m_tot_anodes_1.Text
                tot_anodes_17 = txt_100b_m_tot_anodes_17.Text
                lr = txt_100b_m_lr.Text
                inches_wc = Me.txt_100b_m_incheswc.Text
            End If
            If Me.cmb_formtype.Text = "FORM-200BLK" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txthouseNo1.Text
                add_prefix = cmbPrefix11.Text
                add_prefix_2 = cmbPrefix22.Text
                add_streetname = cmbStreetname1.Text
                add_suffix = cmbsuffix12.Text
                street_suffix_cd = cmbsuffix22.Text
                city = Me.cmb_200b_city.Text
                date_installed = Me.txtDate1.Text
                DATE_ABANDON = Me.txt_Retired_date.Text
                'city = Me.cmb_4_city.Text
                pipe_size = Replace(Me.cmb_pipe_size.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_typeofservice.Text
                tested_to = Me.cmbPressure.Text
                size_of_main = Replace(Me.cmb_main_size.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_main_type.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                size_of_tap = Replace(Me.cmbTapSize.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                depth_of_main = Me.txtDepthMain.Text
                tested_with = Me.cmbMedium.Text
                'tested_to = Me.cmb_4_testedto.Text
                psig_for_minutes = Me.txt_length1.Text
                'installed_by_contractor = Me.txt_4_installedby.Text
                'foreman = Me.txt_4_foreman.Text
                remark = Replace(Me.txt_Remarks.Text, "'", "''")
                If remark Is Nothing Then
                    remark = ""
                End If
                LbSystem = Me.chk2lbSystem.Checked.ToString
                'chk2lbSystemNo1 = Me.chk2lbSystemNo1.Checked.ToString
                PREMISE_NO = Me.txt_200b_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString

                length_main_to_curb_valve_ft = Replace(Me.txtmainToBackOfCurb.Text, "'", "''")
                lenmtrtomain = Replace(Me.txt_pipesize_length.Text, "'", "''")
                a_ps_reading = Me.txtPS_Reading.Text

                RetiredSize = Me.cmbRetiredSize.Text
                UnitsRetired = Me.txtUnitsRetired.Text
                LengthRetired = Me.txtLengthRetired.Text
                RetiredQty = Me.txtRetiredQnty.Text
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            If Me.cmb_formtype.Text = "FORM-200BLK_PAGE1" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txthouseNo.Text
                add_prefix = cmbPrefix1.Text
                add_prefix_2 = cmbPrefix2.Text
                add_streetname = cmbStreetname.Text
                add_suffix = cmbsuffix1.Text
                street_suffix_cd = cmbsuffix2.Text
                city = Me.cmb_200b_city_p1.Text
                date_installed = Me.txtDate_p1.Text
                DATE_ABANDON = Me.txt_Retired_date_p1.Text
                'city = Me.cmb_4_city.Text
                pipe_size = Replace(Me.cmb_pipe_size_p1.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_typeofservice_p1.Text
                tested_to = Me.cmbPressure_p1.Text
                size_of_main = Replace(Me.cmb_main_size_p1.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_main_type_p1.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                size_of_tap = Replace(Me.cmbTapSize_p1.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                depth_of_main = Me.txtDepthMain_p1.Text
                tested_with = Me.cmbMedium_p1.Text
                'tested_to = Me.cmb_4_testedto.Text
                psig_for_minutes = Me.txt_length1_p1.Text
                'installed_by_contractor = Me.txt_4_installedby.Text
                'foreman = Me.txt_4_foreman.Text
                remark = Replace(Me.txt_Remarks_p1.Text, "'", "''")
                If remark Is Nothing Then
                    remark = ""
                End If
                LbSystem = Me.chk2lbSystem_p1.Checked.ToString
                'chk2lbSystemNo1 = Me.chk2lbSystemNo1.Checked.ToString
                PREMISE_NO = Me.txt_200b_premiseno_p1.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString

                length_main_to_curb_valve_ft = Replace(Me.txtmainToBackOfCurb_p1.Text, "'", "''")
                lenmtrtomain = Replace(Me.txt_pipesize_length_p1.Text, "'", "''")
                a_ps_reading = Me.txtPS_Reading_p1.Text

                RetiredSize = Me.cmbRetiredSize_p1.Text
                UnitsRetired = Me.txtUnitsRetired_p1.Text
                LengthRetired = Me.txtLengthRetired_p1.Text
                RetiredQty = Me.txtRetiredQnty_p1.Text
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If

            ElseIf Me.cmb_formtype.Text = "Yellow" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_y_add1.Text
                add_prefix = cmb_y_add2.Text
                add_prefix_2 = cmb_y_add2_1.Text
                add_streetname = cmb_y_add3.Text
                add_suffix = cmb_y_add4_1.Text
                street_suffix_cd = cmb_y_add4.Text
                date_installed = Me.txt_y_dated.Text
                city = Me.cmb_y_city.Text
                subdivision = Me.txt_y_subdiv.Text
                service_wo_no = Me.txt_y_serno.Text
                pipe_size = Replace(Me.cmb_y_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_y_pipekind.Text
                pressure = Me.cmb_y_pressure.Text
                size_of_tap = Replace(Me.cmb_y_tapzize.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                length_main_to_curb_valve_ft = Replace(Me.txt_y_ser_ft.Text, "'", "''")
                length_main_to_curb_valve_in = Replace(Me.txt_y_ser_in.Text, "'", "''")
                length_curb_valve_to_property_line_ft = Replace(Me.txt_y_depser_ft.Text, "'", "''")
                length_curb_valve_to_property_line_in = Replace(Me.txt_y_depser_in.Text, "'", "''")
                length_main_to_property_line_ft = Replace(Me.txt_y_mainln_ft.Text, "'", "''")
                length_main_to_property_line_in = Replace(Me.txt_y_mainln_in.Text, "'", "''")
                length_property_line_to_meter_ft = Replace(Me.txt_y_propln_ft.Text, "'", "''")
                length_property_line_to_meter_in = Replace(Me.txt_y_propln_in.Text, "'", "''")
                size_of_main = Replace(Me.cmb_y_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_y_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                depth_of_main = Me.txt_y_deptmain.Text
                tested_with = Me.cmb_y_testedwith.Text
                tested_to = Me.cmb_y_testedto.Text
                psig_for_minutes = Me.txt_y_psigmin.Text
                installed_by_contractor = Me.txt_y_installedby.Text
                foreman = Me.txt_y_foreman.Text
                remark = Me.txt_y_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_y_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,subdivision,service_wo_no,pipe_size,pipe_type,pressure,size_of_tap,length_main_to_curb_valve_ft,length_main_to_curb_valve_in,length_curb_valve_to_property_line_ft,length_curb_valve_to_property_line_in,length_main_to_property_line_ft,length_main_to_property_line_in,length_property_line_to_meter_ft,length_property_line_to_meter_in,size_of_main,type_of_main,depth_of_main,tested_with,tested_to,psig_for_minutes,installed_by_contractor,foreman,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_y_add1.Text & "','" & cmb_y_add2.Text & "', '" & cmb_y_add2_1.Text & "','" & cmb_y_add3.Text & "','" & cmb_y_add4_1.Text & "', '" & cmb_y_add4.Text & "','" & Me.txt_y_dated.Text & "','" & Me.cmb_y_city.Text & "','" & Me.txt_y_subdiv.Text & "','" & Me.txt_y_serno.Text & "','" & Replace(Me.cmb_y_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_y_pipekind.Text, "'", "''") & "','" & Me.cmb_y_pressure.Text & "','" & Replace(Me.cmb_y_tapzize.Text, "'", "''") & "','" & Replace(Me.txt_y_ser_ft.Text, "'", "''") & "','" & Replace(Me.txt_y_ser_in.Text, "'", "''") & "','" & Replace(Me.txt_y_depser_ft.Text, "'", "''") & "','" & Replace(Me.txt_y_depser_in.Text, "'", "''") & "','" & Replace(Me.txt_y_mainln_ft.Text, "'", "''") & "','" & Replace(Me.txt_y_mainln_in.Text, "'", "''") & "','" & Replace(Me.txt_y_propln_ft.Text, "'", "''") & "','" & Replace(Me.txt_y_propln_in.Text, "'", "''") & "','" & Replace(Me.cmb_y_mainsize.Text, "'", "''") & "','" & Me.cmb_y_maintype.Text & "','" & Me.txt_y_deptmain.Text & "','" & Me.cmb_y_testedwith.Text & "','" & Me.cmb_y_testedto.Text & "','" & Me.txt_y_psigmin.Text & "','" & Me.txt_y_installedby.Text & "','" & Me.txt_y_foreman.Text & "','" & Replace(Me.txt_y_remark.Text, "'", "''") & "','" & Me.txt_y_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "','" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "ORIGINAL" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_q_add1.Text
                add_prefix = cmb_q_add2.Text
                add_prefix_2 = cmb_q_add2_1.Text
                add_streetname = cmb_q_add3.Text
                add_suffix = cmb_q_add4_1.Text
                street_suffix_cd = cmb_q_add4.Text
                date_installed = Me.txt_q_dated.Text
                city = Me.cmb_q_city.Text
                pipe_size = Replace(Me.cmb_q_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_q_pipekind.Text
                size_of_main = Replace(Me.cmb_q_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_q_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                tested_with = Me.cmb_q_testedwith.Text
                tested_to = Me.cmb_q_testedto.Text
                psig_for_minutes = Me.txt_q_psigmin.Text
                remark = Me.txt_q_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_q_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                type_coating = Replace(cmb_q_coating.Text, "'", "''")
                If type_coating Is Nothing Then
                    type_coating = ""
                End If
                lenmtrtomain = Replace(Me.txt_q_lenmtrtomain.Text, "'", "''")
                f_noblow = chk_q_noblow.Checked.ToString
                f_defcoatcor = chk_q_defcoatcor.Checked.ToString
                f_multimeter = chk_q_multimeter.Checked.ToString
                f_serstop = chk_q_serstop.Checked.ToString
                f_cathodpro = chk_q_cathodpro.Checked.ToString
                f_tee = chk_q_tee.Checked.ToString
                f_taptee = chk_q_taptee.Checked.ToString
                f_galvanized = chk_q_galvanized.Checked.ToString
                tap_t_size = Replace(Me.txt_q_ttsize.Text, "'", "''")
                If tap_t_size Is Nothing Then
                    tap_t_size = ""
                End If
                tap_t_inlet = Replace(Me.txt_q_ttinlet.Text, "'", "''")
                If tap_t_inlet Is Nothing Then
                    tap_t_inlet = ""
                End If
                tap_t_outlet = Replace(Me.txt_q_ttoutlet.Text, "'", "''")
                If tap_t_outlet Is Nothing Then
                    tap_t_outlet = ""
                End If
                f_insulated = chk_q_insulated.Checked.ToString
                f_anoderiser = chk_q_anoderiser.Checked.ToString
                otheranode_lbs = Replace(Me.txt_q_otheranode.Text, "'", "''")
                If otheranode_lbs Is Nothing Then
                    otheranode_lbs = ""
                End If
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,pipe_size,pipe_type,size_of_main,type_of_main,tested_with,tested_to,psig_for_minutes,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split,type_coating, lenmtrtomain, f_noblow , f_defcoatcor, f_multimeter,f_serstop,f_cathodpro,f_tee,f_taptee,f_galvanized,tap_t_size,tap_t_inlet,tap_t_outlet, f_insulated, f_anoderiser, otheranode_lbs, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_q_add1.Text & "','" & cmb_q_add2.Text & "', '" & cmb_q_add2_1.Text & "','" & cmb_q_add3.Text & "','" & cmb_q_add4_1.Text & "', '" & cmb_q_add4.Text & "','" & Me.txt_q_dated.Text & "','" & Me.cmb_q_city.Text & "','" & Replace(Me.cmb_q_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_q_pipekind.Text, "'", "''") & "','" & Replace(Me.cmb_q_mainsize.Text, "'", "''") & "','" & Me.cmb_q_maintype.Text & "','" & Me.cmb_q_testedwith.Text & "','" & Me.cmb_q_testedto.Text & "','" & Me.txt_q_psigmin.Text & "','" & Replace(Me.txt_q_remark.Text, "'", "''") & "','" & Me.txt_q_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "','" & Replace(cmb_q_coating.Text, "'", "''") & "',  '" & Replace(Me.txt_q_lenmtrtomain.Text, "'", "''") & "','" & chk_q_noblow.Checked.ToString & "', '" & chk_q_defcoatcor.Checked.ToString & "', '" & chk_q_multimeter.Checked.ToString & "', '" & chk_q_serstop.Checked.ToString & "', '" & chk_q_cathodpro.Checked.ToString & "' , '" & chk_q_tee.Checked.ToString & "', '" & chk_q_taptee.Checked.ToString & "' , '" & chk_q_galvanized.Checked.ToString & "' , '" & Replace(Me.txt_q_ttsize.Text, "'", "''") & "' , '" & Replace(Me.txt_q_ttinlet.Text, "'", "''") & "' , '" & Replace(Me.txt_q_ttoutlet.Text, "'", "''") & "' , '" & chk_q_insulated.Checked.ToString & "' , '" & chk_q_anoderiser.Checked.ToString & "' , '" & Replace(Me.txt_q_otheranode.Text, "'", "''") & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "','" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "MISC" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_l_add1.Text
                add_prefix = cmb_l_add2.Text
                add_prefix_2 = cmb_l_add2_1.Text
                add_streetname = cmb_l_add3.Text
                add_suffix = cmb_l_add4_1.Text
                street_suffix_cd = cmb_l_add4.Text
                city = Me.cmb_l_city.Text
                remark = Me.txt_l_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_l_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                misc_card_type = Me.cmb_l_misCtype.Text
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            ' sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,city, remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split,misc_card_type, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_l_add1.Text & "','" & cmb_l_add2.Text & "', '" & cmb_l_add2_1.Text & "','" & cmb_l_add3.Text & "','" & cmb_l_add4_1.Text & "', '" & cmb_l_add4.Text & "','" & Me.cmb_l_city.Text & "', '" & Replace(Me.txt_l_remark.Text, "'", "''") & "','" & Me.txt_l_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "', '" & Me.cmb_l_misCtype.Text & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "','" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "ORIGINAL-R" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_r_add1.Text
                add_prefix = cmb_r_add2.Text
                add_prefix_2 = cmb_r_add2_1.Text
                add_streetname = cmb_r_add3.Text
                add_suffix = cmb_r_add4_1.Text
                street_suffix_cd = cmb_r_add4.Text
                date_installed = Me.txt_r_dated.Text
                city = Me.cmb_r_city.Text
                pipe_size = Replace(Me.cmb_r_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_r_pipekind.Text
                size_of_main = Replace(Me.cmb_r_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_r_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                tested_with = Me.cmb_r_testedwith.Text
                tested_to = Me.cmb_r_testedto.Text
                psig_for_minutes = Me.txt_r_psigmin.Text
                remark = Me.txt_r_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_r_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                lenmtrtomain = Replace(Me.txt_r_lenmtrtomain.Text, "'", "''")
                f_noblow = chk_r_noblow.Checked.ToString
                f_defcoatcor = chk_r_defcoatcor.Checked.ToString
                f_serstop = chk_r_serstop.Checked.ToString
                f_cathodpro = chk_r_cathodpro.Checked.ToString
                tap_t_size = Replace(Me.txt_r_ttsize.Text, "'", "''")
                If tap_t_size Is Nothing Then
                    tap_t_size = ""
                End If
                tap_t_inlet = Replace(Me.txt_r_ttinlet.Text, "'", "''")
                If tap_t_inlet Is Nothing Then
                    tap_t_inlet = ""
                End If
                tap_t_outlet = Replace(Me.txt_r_ttoutlet.Text, "'", "''")
                If tap_t_outlet Is Nothing Then
                    tap_t_outlet = ""
                End If
                f_insulated = chk_r_insulated.Checked.ToString
                f_anoderiser = chk_r_anoderiser.Checked.ToString
                otheranode_lbs = Replace(Me.txt_r_otheranode.Text, "'", "''")
                If otheranode_lbs Is Nothing Then
                    otheranode_lbs = ""
                End If
                connection_data = Replace(Me.cmb_r_connection_data.Text, "'", "''")
                If connection_data Is Nothing Then
                    connection_data = ""
                End If
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,pipe_size,pipe_type,size_of_main,type_of_main,tested_with,tested_to,psig_for_minutes,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split, lenmtrtomain, f_noblow , f_defcoatcor, f_serstop,f_cathodpro,tap_t_size,tap_t_inlet,tap_t_outlet, f_insulated, f_anoderiser, otheranode_lbs, connection_data , f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_r_add1.Text & "','" & cmb_r_add2.Text & "', '" & cmb_r_add2_1.Text & "','" & cmb_r_add3.Text & "','" & cmb_r_add4_1.Text & "', '" & cmb_r_add4.Text & "','" & Me.txt_r_dated.Text & "','" & Me.cmb_r_city.Text & "','" & Replace(Me.cmb_r_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_r_pipekind.Text, "'", "''") & "','" & Replace(Me.cmb_r_mainsize.Text, "'", "''") & "','" & Me.cmb_r_maintype.Text & "','" & Me.cmb_r_testedwith.Text & "','" & Me.cmb_r_testedto.Text & "','" & Me.txt_r_psigmin.Text & "','" & Replace(Me.txt_r_remark.Text, "'", "''") & "','" & Me.txt_r_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "',  '" & Replace(Me.txt_r_lenmtrtomain.Text, "'", "''") & "','" & chk_r_noblow.Checked.ToString & "', '" & chk_r_defcoatcor.Checked.ToString & "',  '" & chk_r_serstop.Checked.ToString & "', '" & chk_r_cathodpro.Checked.ToString & "' ,  '" & Replace(Me.txt_r_ttsize.Text, "'", "''") & "' , '" & Replace(Me.txt_r_ttinlet.Text, "'", "''") & "' , '" & Replace(Me.txt_r_ttoutlet.Text, "'", "''") & "' , '" & chk_r_insulated.Checked.ToString & "' , '" & chk_r_anoderiser.Checked.ToString & "' , '" & Replace(Me.txt_r_otheranode.Text, "'", "''") & "', '" & Replace(Me.cmb_r_connection_data.Text, "'", "''") & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "','" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "ABANDON-II" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_a_add1.Text
                add_prefix = cmb_a_add2.Text
                add_prefix_2 = cmb_a_add2_1.Text
                add_streetname = cmb_a_add3.Text
                add_suffix = cmb_a_add4_1.Text
                street_suffix_cd = cmb_a_add4.Text
                city = Me.cmb_a_city.Text
                size_of_main = Replace(Me.cmb_a_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_a_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                depth_of_main = Me.txt_y_deptmain.Text
                tested_with = Me.cmb_a_testedwith.Text
                installed_by_contractor = Me.txt_a_installedby.Text
                remark = Me.txt_a_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_a_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                DATE_ABANDON = Me.txt_a_dateabandon.Text
                f_noblow = chk_a_noblow.Checked.ToString
                f_gassource = chk_a_gassource.Checked.ToString
                f_tappingtee = chk_a_tappingtee.Checked.ToString
                f_linesealed = chk_a_linesealed.Checked.ToString
                lenmtrtomain = Replace(Me.txt_a_lenmtrtomain.Text, "'", "''")
                reason_of_abandon = Replace(Me.cmb_a_reasonabandon.Text, "'", "''")
                If reason_of_abandon Is Nothing Then
                    reason_of_abandon = ""
                End If
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,city,size_of_main,type_of_main,tested_with,installed_by_contractor,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split,lenmtrtomain, reason_of_abandon , DATE_ABANDON, f_noblow, f_gassource, f_tappingtee, f_linesealed, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_a_add1.Text & "','" & cmb_a_add2.Text & "', '" & cmb_a_add2_1.Text & "','" & cmb_a_add3.Text & "','" & cmb_a_add4_1.Text & "', '" & cmb_a_add4.Text & "','" & Me.cmb_a_city.Text & "','" & Replace(Me.cmb_a_mainsize.Text, "'", "''") & "','" & Me.cmb_a_maintype.Text & "','" & Me.cmb_a_testedwith.Text & "','" & Me.txt_a_installedby.Text & "','" & Replace(Me.txt_a_remark.Text, "'", "''") & "','" & Me.txt_a_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "','" & Replace(Me.txt_a_lenmtrtomain.Text, "'", "''") & "', '" & Replace(Me.cmb_a_reasonabandon.Text, "'", "''") & "', '" & Me.txt_a_dateabandon.Text & "' , '" & chk_a_noblow.Checked.ToString & "' ,'" & chk_a_gassource.Checked.ToString & "' , '" & chk_a_tappingtee.Checked.ToString & "' , '" & chk_a_linesealed.Checked.ToString & "' , '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "Form-X" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_x_add1.Text
                add_prefix = cmb_x_add2.Text
                add_prefix_2 = cmb_x_add2_1.Text
                add_streetname = cmb_x_add3.Text
                add_suffix = cmb_x_add4_1.Text
                street_suffix_cd = cmb_x_add4.Text
                date_installed = Me.txt_x_dated.Text
                city = Me.cmb_x_city.Text
                pipe_size = Replace(Me.cmb_x_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_x_pipekind.Text
                length_main_to_property_line_ft = Replace(Me.txt_x_mainln_ft.Text, "'", "''")
                length_main_to_property_line_in = Replace(Me.txt_x_mainln_in.Text, "'", "''")
                length_property_line_to_meter_ft = Replace(Me.txt_x_propln_ft.Text, "'", "''")
                length_property_line_to_meter_in = Replace(Me.txt_x_propln_in.Text, "'", "''")
                size_of_main = Replace(Me.cmb_x_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_x_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                tested_with = Me.cmb_x_testedwith.Text
                tested_to = Me.cmb_x_testedto.Text
                installed_by_contractor = Me.txt_x_installedby.Text
                remark = Me.txt_x_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_x_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                type_coating = Replace(cmb_x_coating.Text, "'", "''")
                If type_coating Is Nothing Then
                    type_coating = ""
                End If
                lenmtrtomain = Replace(Me.txt_x_lenmtrtomain.Text, "'", "''")
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,pipe_size,pipe_type,length_main_to_property_line_ft,length_main_to_property_line_in,length_property_line_to_meter_ft,length_property_line_to_meter_in,size_of_main,type_of_main,tested_with,tested_to,installed_by_contractor,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split, type_coating, lenmtrtomain, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_x_add1.Text & "','" & cmb_x_add2.Text & "', '" & cmb_x_add2_1.Text & "','" & cmb_x_add3.Text & "','" & cmb_x_add4_1.Text & "', '" & cmb_x_add4.Text & "','" & Me.txt_x_dated.Text & "','" & Me.cmb_x_city.Text & "','" & Replace(Me.cmb_x_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_x_pipekind.Text, "'", "''") & "','" & Replace(Me.txt_x_mainln_ft.Text, "'", "''") & "','" & Replace(Me.txt_x_mainln_in.Text, "'", "''") & "','" & Replace(Me.txt_x_propln_ft.Text, "'", "''") & "','" & Replace(Me.txt_x_propln_in.Text, "'", "''") & "','" & Replace(Me.cmb_x_mainsize.Text, "'", "''") & "','" & Me.cmb_x_maintype.Text & "','" & Me.cmb_x_testedwith.Text & "','" & Me.cmb_x_testedto.Text & "','" & Me.txt_x_installedby.Text & "','" & Replace(Me.txt_x_remark.Text, "'", "''") & "','" & Me.txt_x_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "' ,'" & Replace(cmb_x_coating.Text, "'", "''") & "','" & Replace(Me.txt_x_lenmtrtomain.Text, "'", "''") & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "FORM-IX" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_9_add1.Text
                add_prefix = cmb_9_add2.Text
                add_prefix_2 = cmb_9_add2_1.Text
                add_streetname = cmb_9_add3.Text
                add_suffix = cmb_9_add4_1.Text
                street_suffix_cd = cmb_9_add4.Text
                date_installed = Me.txt_9_dated.Text
                city = Me.cmb_9_city.Text
                service_wo_no = Me.txt_9_serno.Text
                pipe_size = Replace(Me.cmb_9_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_9_pipekind.Text
                size_of_tap = Replace(Me.cmb_9_tapzize.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                size_of_main = Replace(Me.cmb_9_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_9_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                foreman = Me.txt_9_foreman.Text
                remark = Me.txt_9_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_9_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                lenmtrtomain = Replace(Me.txt_9_lenmtrtomain.Text, "'", "''")
                type_coating = Replace(cmb_9_coating.Text, "'", "''")
                If type_coating Is Nothing Then
                    type_coating = ""
                End If
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,service_wo_no,pipe_size,pipe_type,size_of_tap,size_of_main,type_of_main,foreman,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split,lenmtrtomain,type_coating, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_9_add1.Text & "','" & cmb_9_add2.Text & "', '" & cmb_9_add2_1.Text & "','" & cmb_9_add3.Text & "','" & cmb_9_add4_1.Text & "', '" & cmb_9_add4.Text & "','" & Me.txt_9_dated.Text & "','" & Me.cmb_9_city.Text & "','" & Me.txt_9_serno.Text & "','" & Replace(Me.cmb_9_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_9_pipekind.Text, "'", "''") & "','" & Replace(Me.cmb_9_tapzize.Text, "'", "''") & "','" & Replace(Me.cmb_9_mainsize.Text, "'", "''") & "','" & Me.cmb_9_maintype.Text & "','" & Me.txt_9_foreman.Text & "','" & Replace(Me.txt_9_remark.Text, "'", "''") & "','" & Me.txt_9_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "','" & Replace(Me.txt_9_lenmtrtomain.Text, "'", "''") & "','" & Replace(cmb_9_coating.Text, "'", "''") & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If cmb_formtype.Text.Trim = "Form-954" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_7_add1.Text
                add_prefix = cmb_7_add2.Text
                add_prefix_2 = cmb_7_add2_1.Text
                add_streetname = cmb_7_add3.Text
                add_suffix = cmb_7_add4_1.Text
                street_suffix_cd = cmb_7_add4.Text
                date_installed = Me.txt_7_dated.Text
                city = Me.cmb_7_city.Text
                pipe_size = Replace(Me.cmb_7_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_7_pipekind.Text
                size_of_tap = Replace(Me.cmb_7_tapzize.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                length_main_to_property_line_ft = Replace(Me.txt_7_mainln_ft.Text, "'", "''")
                length_main_to_property_line_in = Replace(Me.txt_7_mainln_in.Text, "'", "''")
                size_of_main = Replace(Me.cmb_7_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_7_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                remark = Me.txt_7_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_7_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                lenmtrtomain = Replace(Me.txt_7_lenmtrtomain.Text, "'", "''")

                nature_of_work = Replace(cmb_7_naturework.Text, "'", "''")
                If nature_of_work Is Nothing Then
                    nature_of_work = ""
                End If
                kind_of_joint = Replace(cmb_7_kindjoint.Text, "'", "''")
                If kind_of_joint Is Nothing Then
                    kind_of_joint = ""
                End If
                split_sleeve = Replace(txt_7_splitsleeve.Text, "'", "''")
                If split_sleeve Is Nothing Then
                    split_sleeve = ""
                End If
                loc_of_cock = Replace(txt_7_loccock.Text, "'", "''")
                If loc_of_cock Is Nothing Then
                    loc_of_cock = ""
                End If
                kind_of_box = Replace(txt_7_kindbox.Text, "'", "''")
                If kind_of_box Is Nothing Then
                    kind_of_box = ""
                End If
                type_coating = Replace(cmb_7_coating.Text, "'", "''")
                If type_coating Is Nothing Then
                    type_coating = ""
                End If
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,pipe_size,pipe_type,size_of_tap,length_main_to_property_line_ft,length_main_to_property_line_in,size_of_main,type_of_main,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split,lenmtrtomain,nature_of_work,kind_of_joint, split_sleeve, loc_of_cock, kind_of_box, type_coating, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_7_add1.Text & "','" & cmb_7_add2.Text & "', '" & cmb_7_add2_1.Text & "','" & cmb_7_add3.Text & "','" & cmb_7_add4_1.Text & "', '" & cmb_7_add4.Text & "','" & Me.txt_7_dated.Text & "','" & Me.cmb_7_city.Text & "','" & Replace(Me.cmb_7_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_7_pipekind.Text, "'", "''") & "','" & Replace(Me.cmb_7_tapzize.Text, "'", "''") & "','" & Replace(Me.txt_7_mainln_ft.Text, "'", "''") & "','" & Replace(Me.txt_7_mainln_in.Text, "'", "''") & "','" & Replace(Me.cmb_7_mainsize.Text, "'", "''") & "','" & Me.cmb_7_maintype.Text & "','" & Replace(Me.txt_7_remark.Text, "'", "''") & "','" & Me.txt_7_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "','" & Replace(Me.txt_7_lenmtrtomain.Text, "'", "''") & "','" & Replace(cmb_7_naturework.Text, "'", "''") & "','" & Replace(cmb_7_kindjoint.Text, "'", "''") & "','" & Replace(txt_7_splitsleeve.Text, "'", "''") & "', '" & Replace(txt_7_loccock.Text, "'", "''") & "','" & Replace(txt_7_kindbox.Text, "'", "''") & "','" & Replace(cmb_7_coating.Text, "'", "''") & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "Orange" Then
                file_name = Me.txt_filedesc.Text & ""
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_3_add1.Text
                add_prefix = cmb_3_add2.Text
                add_streetname = cmb_3_add3.Text
                add_suffix = cmb_3_add4_1.Text
                street_suffix_cd = cmb_3_add4.Text
                city = Me.cmb_3_city.Text
                date_installed = Me.txt_3_dated.Text
                service_wo_no = Me.txt_3_serno.Text
                pipe_size = Replace(Me.cmb_3_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Replace(Me.cmb_3_pipekind.Text, "'", "''")
                If pipe_type Is Nothing Then
                    pipe_type = ""
                End If
                pressure = Me.cmb_3_pressure.Text
                size_of_tap = Replace(Me.cmb_3_tapzize.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                length_main_to_curb_valve_ft = Replace(Me.txt_3_ser_ft.Text, "'", "''")
                length_curb_valve_to_property_line_ft = Replace(Me.txt_3_depser_ft.Text, "'", "''")
                length_main_to_property_line_ft = Replace(Me.txt_3_mainln_ft.Text, "'", "''")
                length_property_line_to_meter_ft = Replace(Me.txt_3_propln_ft.Text, "'", "''")
                size_of_main = Replace(Me.cmb_3_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_3_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                installed_by_contractor = Me.txt_3_installedby.Text
                remark = Me.txt_3_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_3_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,service_wo_no,pipe_size,pipe_type,pressure,size_of_tap,length_main_to_curb_valve_ft,length_curb_valve_to_property_line_ft,length_main_to_property_line_ft,length_property_line_to_meter_ft,size_of_main,type_of_main,installed_by_contractor,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_3_add1.Text & "','" & cmb_3_add2.Text & "', '" & cmb_3_add2_1.Text & "','" & cmb_3_add3.Text & "','" & cmb_3_add4_1.Text & "', '" & cmb_3_add4.Text & "','" & Me.txt_3_dated.Text & "','" & Me.cmb_3_city.Text & "', '" & Me.txt_3_serno.Text & "','" & Replace(Me.cmb_3_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_3_pipekind.Text, "'", "''") & "','" & Me.cmb_3_pressure.Text & "','" & Replace(Me.cmb_3_tapzize.Text, "'", "''") & "','" & Replace(Me.txt_3_ser_ft.Text, "'", "''") & "','" & Replace(Me.txt_3_depser_ft.Text, "'", "''") & "','" & Replace(Me.txt_3_mainln_ft.Text, "'", "''") & "','" & Replace(Me.txt_3_propln_ft.Text, "'", "''") & "','" & Replace(Me.cmb_3_mainsize.Text, "'", "''") & "','" & Me.cmb_3_maintype.Text & "','" & Me.txt_3_installedby.Text & "','" & Replace(Me.txt_3_remark.Text, "'", "''") & "','" & Me.txt_3_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "White" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_w_add1.Text
                add_prefix = cmb_w_add2.Text
                add_prefix_2 = cmb_w_add2_1.Text
                add_streetname = cmb_w_add3.Text
                add_suffix = Me.cmb_w_add4_1.Text
                street_suffix_cd = cmb_w_add4.Text
                date_installed = Me.txt_w_dated.Text
                city = Me.cmb_w_city.Text
                subdivision = Me.txt_w_subdiv.Text
                service_wo_no = Me.txt_w_serno.Text
                pipe_size = Replace(Me.cmb_w_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Replace(Me.cmb_w_pipekind.Text, "'", "''")
                If pipe_type Is Nothing Then
                    pipe_type = ""
                End If
                pressure = Me.cmb_w_pressure.Text
                size_of_tap = Replace(cmb_w_tapzize.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                length_main_to_curb_valve_ft = Replace(Me.txt_w_ser_ft.Text, "'", "''")
                length_main_to_curb_valve_in = Replace(Me.txt_w_ser_in.Text, "'", "''")
                length_curb_valve_to_property_line_ft = Replace(Me.txt_w_depser_ft.Text, "'", "''")
                size_of_main = Replace(cmb_w_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_w_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                depth_of_main = Replace(Me.txt_w_deptmain.Text, "'", "''")
                If depth_of_main Is Nothing Then
                    depth_of_main = ""
                End If
                tested_with = Me.cmb_w_testedwith.Text
                tested_to = Me.cmb_w_testedto.Text
                psig_for_minutes = Me.txt_w_psigmin.Text
                installed_by_contractor = Me.txt_w_installedby.Text
                foreman = Me.txt_w_foreman.Text
                remark = Me.txt_w_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_w_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2,add_streetname,add_suffix,street_suffix_cd,date_installed,city,subdivision,service_wo_no,pipe_size,pipe_type,pressure,size_of_tap,length_main_to_curb_valve_ft,length_main_to_curb_valve_in,length_curb_valve_to_property_line_ft,size_of_main,type_of_main,depth_of_main,tested_with,tested_to,psig_for_minutes,installed_by_contractor,foreman,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_w_add1.Text & "','" & cmb_w_add2.Text & "','" & cmb_w_add2_1.Text & "','" & cmb_w_add3.Text & "','" & cmb_w_add4_1.Text & "','" & Me.cmb_w_add4.Text & "','" & Me.txt_w_dated.Text & "','" & Me.cmb_w_city.Text & "','" & Me.txt_w_subdiv.Text & "','" & Me.txt_w_serno.Text & "','" & Replace(Me.cmb_w_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_w_pipekind.Text, "'", "''") & "','" & Me.cmb_w_pressure.Text & "','" & Replace(cmb_w_tapzize.Text, "'", "''") & "','" & Replace(Me.txt_w_ser_ft.Text, "'", "''") & "','" & Replace(Me.txt_w_ser_in.Text, "'", "''") & "','" & Replace(Me.txt_w_depser_ft.Text, "'", "''") & "','" & Replace(cmb_w_mainsize.Text, "'", "''") & "','" & Me.cmb_w_maintype.Text & "','" & Me.txt_w_deptmain.Text & "','" & Me.cmb_w_testedwith.Text & "','" & Me.cmb_w_testedto.Text & "','" & Me.txt_w_psigmin.Text & "','" & Me.txt_w_installedby.Text & "','" & Me.txt_w_foreman.Text & "','" & Replace(Me.txt_w_remark.Text, "'", "''") & "','" & Me.txt_w_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "Form235-B-702" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_4_add1.Text
                add_prefix = cmb_4_add2.Text
                add_prefix_2 = cmb_4_add2_1.Text
                add_streetname = cmb_4_add3.Text
                add_suffix = cmb_4_add4_1.Text
                street_suffix_cd = cmb_4_add4.Text
                date_installed = Me.txt_4_dated.Text
                city = Me.cmb_4_city.Text
                pipe_size = Replace(Me.cmb_4_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_4_pipekind.Text
                pressure = Me.cmb_4_pressure.Text
                size_of_main = Replace(Me.cmb_4_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_4_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                depth_of_main = Me.txt_4_deptmain.Text
                tested_with = Me.cmb_4_testedwith.Text
                tested_to = Me.cmb_4_testedto.Text
                psig_for_minutes = Me.txt_4_psigmin.Text
                installed_by_contractor = Me.txt_4_installedby.Text
                foreman = Me.txt_4_foreman.Text
                remark = Me.txt_4_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_4_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                pipe_condition = Replace(Me.cmb_4_condition.Text, "'", "''")
                If pipe_condition Is Nothing Then
                    pipe_condition = ""
                End If
                lenmtrtomain = Replace(Me.txt_4_lenmtrtomain.Text, "'", "''")
                sceginspect = Replace(Me.txt_4_sceginspect.Text, "'", "''")
                If sceginspect Is Nothing Then
                    sceginspect = ""
                End If
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,pipe_size,pipe_type,pressure,size_of_main,type_of_main,depth_of_main,tested_with,tested_to,psig_for_minutes,installed_by_contractor,foreman,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split,pipe_condition,lenmtrtomain,sceginspect, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_4_add1.Text & "','" & cmb_4_add2.Text & "', '" & cmb_4_add2_1.Text & "','" & cmb_4_add3.Text & "','" & cmb_4_add4_1.Text & "', '" & cmb_4_add4.Text & "','" & Me.txt_4_dated.Text & "','" & Me.cmb_4_city.Text & "','" & Replace(Me.cmb_4_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_4_pipekind.Text, "'", "''") & "','" & Me.cmb_4_pressure.Text & "','" & Replace(Me.cmb_4_mainsize.Text, "'", "''") & "','" & Me.cmb_4_maintype.Text & "','" & Me.txt_4_deptmain.Text & "','" & Me.cmb_4_testedwith.Text & "','" & Me.cmb_4_testedto.Text & "','" & Me.txt_4_psigmin.Text & "','" & Me.txt_4_installedby.Text & "','" & Me.txt_4_foreman.Text & "','" & Replace(Me.txt_4_remark.Text, "'", "''") & "','" & Me.txt_4_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "','" & Replace(Me.cmb_4_condition.Text, "'", "''") & "' ,'" & Replace(Me.txt_4_lenmtrtomain.Text, "'", "''") & "','" & Replace(Me.txt_4_sceginspect.Text, "'", "''") & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "OD-9-6-38" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_5_add1.Text
                add_prefix = cmb_5_add2.Text
                add_prefix_2 = cmb_5_add2_1.Text
                add_streetname = cmb_5_add3.Text
                add_suffix = cmb_5_add4_1.Text
                street_suffix_cd = cmb_5_add4.Text
                date_installed = Me.txt_5_dated.Text
                city = Me.cmb_5_city.Text
                service_wo_no = Me.txt_5_serno.Text
                pipe_size = Replace(Me.cmb_5_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_5_pipekind.Text
                length_main_to_curb_valve_ft = Replace(Me.txt_5_ser_ft.Text, "'", "''")
                length_curb_valve_to_property_line_ft = Replace(Me.txt_5_depser_ft.Text, "'", "''")
                length_property_line_to_meter_ft = Replace(Me.txt_5_propln_ft.Text, "'", "''")
                remark = Me.txt_5_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_5_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,service_wo_no,pipe_size,pipe_type,length_main_to_curb_valve_ft,length_curb_valve_to_property_line_ft,length_property_line_to_meter_ft,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_5_add1.Text & "','" & cmb_5_add2.Text & "', '" & cmb_5_add2_1.Text & "','" & cmb_5_add3.Text & "','" & cmb_5_add4_1.Text & "', '" & cmb_5_add4.Text & "','" & Me.txt_5_dated.Text & "','" & Me.cmb_5_city.Text & "','" & Me.txt_5_serno.Text & "','" & Replace(Me.cmb_5_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_5_pipekind.Text, "'", "''") & "','" & Replace(Me.txt_5_ser_ft.Text, "'", "''") & "','" & Replace(Me.txt_5_depser_ft.Text, "'", "''") & "','" & Replace(Me.txt_5_propln_ft.Text, "'", "''") & "','" & Replace(Me.txt_5_remark.Text, "'", "''") & "','" & Me.txt_5_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "Form-80I" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_6_add1.Text
                add_prefix = cmb_6_add2.Text
                add_prefix_2 = cmb_6_add2_1.Text
                add_streetname = cmb_6_add3.Text
                add_suffix = cmb_6_add4_1.Text
                street_suffix_cd = cmb_6_add4.Text
                date_installed = Me.txt_6_dated.Text
                city = Me.cmb_6_city.Text
                pipe_size = Replace(Me.cmb_6_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_6_pipekind.Text
                length_main_to_curb_valve_ft = Replace(Me.txt_6_ser_ft.Text, "'", "''")
                length_main_to_curb_valve_in = Replace(Me.txt_6_ser_in.Text, "'", "''")
                length_curb_valve_to_property_line_ft = Replace(Me.txt_6_depser_ft.Text, "'", "''")
                length_curb_valve_to_property_line_in = Replace(Me.txt_6_depser_in.Text, "'", "''")
                size_of_main = Replace(Me.cmb_6_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_6_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                depth_of_main = Me.txt_6_deptmain.Text
                tested_with = Me.cmb_6_testedwith.Text
                tested_to = Me.cmb_6_testedto.Text
                psig_for_minutes = Me.txt_6_psigmin.Text
                remark = Me.txt_6_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_6_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                lenmtrtomain = Replace(Me.txt_6_lenmtrtomain.Text, "'", "''")

                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,pipe_size,pipe_type,length_main_to_curb_valve_ft,length_main_to_curb_valve_in,length_curb_valve_to_property_line_ft,length_curb_valve_to_property_line_in,size_of_main,type_of_main,depth_of_main,tested_with,tested_to,psig_for_minutes,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split,lenmtrtomain, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_6_add1.Text & "','" & cmb_6_add2.Text & "', '" & cmb_6_add2_1.Text & "','" & cmb_6_add3.Text & "','" & cmb_6_add4_1.Text & "', '" & cmb_6_add4.Text & "','" & Me.txt_6_dated.Text & "','" & Me.cmb_6_city.Text & "','" & Replace(Me.cmb_6_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_6_pipekind.Text, "'", "''") & "','" & Replace(Me.txt_6_ser_ft.Text, "'", "''") & "','" & Replace(Me.txt_6_ser_in.Text, "'", "''") & "','" & Replace(Me.txt_6_depser_ft.Text, "'", "''") & "','" & Replace(Me.txt_6_depser_in.Text, "'", "''") & "','" & Replace(Me.cmb_6_mainsize.Text, "'", "''") & "','" & Me.cmb_6_maintype.Text & "','" & Me.txt_6_deptmain.Text & "','" & Me.cmb_6_testedwith.Text & "','" & Me.cmb_6_testedto.Text & "','" & Me.txt_6_psigmin.Text & "','" & Replace(Me.txt_6_remark.Text, "'", "''") & "','" & Me.txt_6_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "','" & Replace(Me.txt_6_lenmtrtomain.Text, "'", "''") & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If cmb_formtype.Text.Trim = "ABANDON-I" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_8_add1.Text
                add_prefix = cmb_8_add2.Text
                add_prefix_2 = cmb_8_add2_1.Text
                add_streetname = cmb_8_add3.Text
                add_suffix = cmb_8_add4_1.Text
                street_suffix_cd = cmb_8_add4.Text
                date_installed = Me.txt_8_dated.Text
                city = Me.cmb_8_city.Text
                size_of_main = Replace(Me.cmb_8_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_8_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                remark = Me.txt_8_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_8_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                DATE_ABANDON = Me.txt_8_dateabandon.Text
                type_coating = Replace(cmb_8_coating.Text, "'", "''")
                If type_coating Is Nothing Then
                    type_coating = ""
                End If
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,size_of_main,type_of_main,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split, DATE_ABANDON, type_coating, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_8_add1.Text & "','" & cmb_8_add2.Text & "', '" & cmb_8_add2_1.Text & "','" & cmb_8_add3.Text & "','" & cmb_8_add4_1.Text & "', '" & cmb_8_add4.Text & "','" & Me.txt_8_dated.Text & "','" & Me.cmb_8_city.Text & "','" & Replace(Me.cmb_8_mainsize.Text, "'", "''") & "','" & Me.cmb_8_maintype.Text & "','" & Replace(Me.txt_8_remark.Text, "'", "''") & "','" & Me.txt_8_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "', '" & Me.txt_8_dateabandon.Text & "', '" & Replace(cmb_8_coating.Text, "'", "''") & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            'End If
            If Me.btn_submit.Text = "SUBMIT" Then
                sql1 = "AddNew_Data"
            Else
                sql1 = "Update_Data"
            End If

            'ElseIf Me.btn_submit.Text = "UPDATE" Then
            '    If Me.cmb_formtype.Text = "Yellow" Then
            '        sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_y_add1.Text & "',add_prefix = '" & cmb_y_add2.Text & "',add_streetname = '" & cmb_y_add3.Text & "',add_suffix = '" & cmb_y_add4_1.Text & "', street_suffix_cd = '" & cmb_y_add4.Text & "',  date_installed = '" & Me.txt_y_dated.Text & "', city= '" & Me.cmb_y_city.Text & "',subdivision = '" & Me.txt_y_subdiv.Text & "', service_wo_no  = '" & Me.txt_y_serno.Text & "', pipe_size= '" & Replace(Me.cmb_y_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_y_pipekind.Text & "', pressure = '" & Me.cmb_y_pressure.Text & "' ,size_of_tap = '" & Replace(Me.cmb_y_tapzize.Text, "'", "''") & "',length_main_to_curb_valve_ft = '" & Replace(Me.txt_y_ser_ft.Text, "'", "''") & "', length_main_to_curb_valve_in = '" & Replace(Me.txt_y_ser_in.Text, "'", "''") & "', length_curb_valve_to_property_line_ft = '" & Replace(Me.txt_y_depser_ft.Text, "'", "''") & "', length_curb_valve_to_property_line_in = '" & Replace(Me.txt_y_depser_in.Text, "'", "''") & "', length_main_to_property_line_ft = '" & Replace(Me.txt_y_mainln_ft.Text, "'", "''") & "', length_main_to_property_line_in = '" & Replace(Me.txt_y_mainln_in.Text, "'", "''") & "', length_property_line_to_meter_ft = '" & Replace(Me.txt_y_propln_ft.Text, "'", "''") & "', length_property_line_to_meter_in = '" & Replace(Me.txt_y_propln_in.Text, "'", "''") & "', size_of_main = '" & Replace(Me.cmb_y_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_y_maintype.Text, "'", "''") & "',depth_of_main = '" & Me.txt_y_deptmain.Text & "', tested_with = '" & Me.cmb_y_testedwith.Text & "', tested_to = '" & Me.cmb_y_testedto.Text & "', psig_for_minutes = '" & Me.txt_y_psigmin.Text & "', installed_by_contractor = '" & Me.txt_y_installedby.Text & "', foreman = '" & Me.txt_y_foreman.Text & "', remark = '" & Replace(Me.txt_y_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_y_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
            '    ElseIf cmb_formtype.Text.Trim = "ORIGINAL" Then
            '        sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_q_add1.Text & "',add_prefix = '" & cmb_q_add2.Text & "',add_prefix_2 = '" & cmb_q_add2_1.Text & "',add_streetname = '" & cmb_q_add3.Text & "',add_suffix = '" & cmb_q_add4_1.Text & "', street_suffix_cd = '" & cmb_q_add4.Text & "',  date_installed = '" & Me.txt_q_dated.Text & "', city= '" & Me.cmb_q_city.Text & "', pipe_size= '" & Replace(Me.cmb_q_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_q_pipekind.Text & "',  size_of_main = '" & Replace(Me.cmb_q_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_q_maintype.Text, "'", "''") & "', tested_with = '" & Me.cmb_q_testedwith.Text & "', tested_to = '" & Me.cmb_q_testedto.Text & "', psig_for_minutes = '" & Me.txt_q_psigmin.Text & "',  remark = '" & Replace(Me.txt_q_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_q_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "'  ,type_coating	 = '" & Replace(cmb_q_coating.Text, "'", "''") & "', lenmtrtomain	 = '" & Replace(Me.txt_q_lenmtrtomain.Text, "'", "''") & "', f_noblow = '" & chk_q_noblow.Checked.ToString & "', f_defcoatcor = '" & chk_q_defcoatcor.Checked.ToString & "',f_multimeter = '" & chk_q_multimeter.Checked.ToString & "',f_serstop = '" & chk_q_serstop.Checked.ToString & "', f_cathodpro = '" & chk_q_cathodpro.Checked.ToString & "', f_tee = '" & chk_q_tee.Checked.ToString & "', f_taptee = '" & chk_q_taptee.Checked.ToString & "' ,f_galvanized = '" & chk_q_galvanized.Checked.ToString & "' , tap_t_size = '" & Replace(Me.txt_q_ttsize.Text, "'", "''") & "', tap_t_inlet = '" & Replace(Me.txt_q_ttinlet.Text, "'", "''") & "', tap_t_outlet = '" & Replace(Me.txt_q_ttoutlet.Text, "'", "''") & "', f_insulated = '" & chk_q_insulated.Checked.ToString & "', f_anoderiser = '" & chk_q_anoderiser.Checked.ToString & "', otheranode_lbs = '" & Replace(Me.txt_q_otheranode.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
            '    ElseIf cmb_formtype.Text.Trim = "MISC" Then
            '        sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_l_add1.Text & "',add_prefix = '" & cmb_l_add2.Text & "',add_prefix_2 = '" & cmb_l_add2_1.Text & "',add_streetname = '" & cmb_l_add3.Text & "',add_suffix = '" & cmb_l_add4_1.Text & "', street_suffix_cd = '" & cmb_l_add4.Text & "',   city= '" & Me.cmb_l_city.Text & "',   remark = '" & Replace(Me.txt_l_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_l_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' ,  misc_card_type = '" & Me.cmb_l_misCtype.Text & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
            '    ElseIf cmb_formtype.Text.Trim = "ORIGINAL-R" Then
            '        sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_r_add1.Text & "',add_prefix = '" & cmb_r_add2.Text & "',add_prefix_2 = '" & cmb_r_add2_1.Text & "',add_streetname = '" & cmb_r_add3.Text & "',add_suffix = '" & cmb_r_add4_1.Text & "', street_suffix_cd = '" & cmb_r_add4.Text & "',  date_installed = '" & Me.txt_r_dated.Text & "', city= '" & Me.cmb_r_city.Text & "', pipe_size= '" & Replace(Me.cmb_r_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_r_pipekind.Text & "',  size_of_main = '" & Replace(Me.cmb_r_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_r_maintype.Text, "'", "''") & "', tested_with = '" & Me.cmb_r_testedwith.Text & "', tested_to = '" & Me.cmb_r_testedto.Text & "', psig_for_minutes = '" & Me.txt_r_psigmin.Text & "',  remark = '" & Replace(Me.txt_r_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_r_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' , lenmtrtomain	 = '" & Replace(Me.txt_r_lenmtrtomain.Text, "'", "''") & "', f_noblow = '" & chk_r_noblow.Checked.ToString & "', f_defcoatcor = '" & chk_r_defcoatcor.Checked.ToString & "',f_serstop = '" & chk_r_serstop.Checked.ToString & "', f_cathodpro = '" & chk_r_cathodpro.Checked.ToString & "', tap_t_size = '" & Replace(Me.txt_r_ttsize.Text, "'", "''") & "', tap_t_inlet = '" & Replace(Me.txt_r_ttinlet.Text, "'", "''") & "', tap_t_outlet = '" & Replace(Me.txt_r_ttoutlet.Text, "'", "''") & "', f_insulated = '" & chk_r_insulated.Checked.ToString & "', f_anoderiser = '" & chk_r_anoderiser.Checked.ToString & "', otheranode_lbs = '" & Replace(Me.txt_r_otheranode.Text, "'", "''") & "' , connection_data = '" & Replace(Me.cmb_r_connection_data.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
            '    ElseIf Me.cmb_formtype.Text = "ABANDON-II" Then
            '        sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_a_add1.Text & "',add_prefix = '" & cmb_a_add2.Text & "',add_prefix_2 = '" & cmb_a_add2_1.Text & "',add_streetname = '" & cmb_a_add3.Text & "',add_suffix = '" & cmb_a_add4_1.Text & "', street_suffix_cd = '" & cmb_a_add4.Text & "',  city= '" & Me.cmb_a_city.Text & "', size_of_main = '" & Replace(Me.cmb_a_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_a_maintype.Text, "'", "''") & "', tested_with = '" & Me.cmb_a_testedwith.Text & "',  installed_by_contractor = '" & Me.txt_a_installedby.Text & "',  remark = '" & Replace(Me.txt_a_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_a_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' , DATE_ABANDON = '" & Me.txt_a_dateabandon.Text & "',f_noblow = '" & chk_a_noblow.Checked.ToString & "' ,f_gassource = '" & chk_a_gassource.Checked.ToString & "' , f_tappingtee = '" & chk_a_tappingtee.Checked.ToString & "' , f_linesealed= '" & chk_a_linesealed.Checked.ToString & "' , lenmtrtomain	 = '" & Replace(Me.txt_a_lenmtrtomain.Text, "'", "''") & "', reason_of_abandon = '" & Replace(Me.cmb_a_reasonabandon.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
            '    ElseIf Me.cmb_formtype.Text = "Form-X" Then
            '        sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_x_add1.Text & "',add_prefix = '" & cmb_x_add2.Text & "',add_prefix_2 = '" & cmb_x_add2_1.Text & "',add_streetname = '" & cmb_x_add3.Text & "',add_suffix = '" & cmb_x_add4_1.Text & "', street_suffix_cd = '" & cmb_x_add4.Text & "',  date_installed = '" & Me.txt_x_dated.Text & "', city= '" & Me.cmb_x_city.Text & "', pipe_size= '" & Replace(Me.cmb_x_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_x_pipekind.Text & "',  length_main_to_property_line_ft = '" & Replace(Me.txt_x_mainln_ft.Text, "'", "''") & "', length_main_to_property_line_in = '" & Replace(Me.txt_x_mainln_in.Text, "'", "''") & "', length_property_line_to_meter_ft = '" & Replace(Me.txt_x_propln_ft.Text, "'", "''") & "', length_property_line_to_meter_in = '" & Replace(Me.txt_x_propln_in.Text, "'", "''") & "', size_of_main = '" & Replace(Me.cmb_x_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_x_maintype.Text, "'", "''") & "', tested_with = '" & Me.cmb_x_testedwith.Text & "', tested_to = '" & Me.cmb_x_testedto.Text & "',  installed_by_contractor = '" & Me.txt_x_installedby.Text & "',  remark = '" & Replace(Me.txt_x_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_x_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' ,type_coating	 = '" & Replace(cmb_x_coating.Text, "'", "''") & "', lenmtrtomain	 = '" & Replace(Me.txt_x_lenmtrtomain.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
            '    ElseIf Me.cmb_formtype.Text = "FORM-IX" Then
            '        sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_9_add1.Text & "',add_prefix = '" & cmb_9_add2.Text & "',add_prefix_2 = '" & cmb_9_add2_1.Text & "',add_streetname = '" & cmb_9_add3.Text & "',add_suffix = '" & cmb_9_add4_1.Text & "', street_suffix_cd = '" & cmb_9_add4.Text & "',  date_installed = '" & Me.txt_9_dated.Text & "', city= '" & Me.cmb_9_city.Text & "', service_wo_no  = '" & Me.txt_9_serno.Text & "', pipe_size= '" & Replace(Me.cmb_9_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_9_pipekind.Text & "', size_of_tap = '" & Replace(Me.cmb_9_tapzize.Text, "'", "''") & "',size_of_main = '" & Replace(Me.cmb_9_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_9_maintype.Text, "'", "''") & "',foreman = '" & Me.txt_9_foreman.Text & "', remark = '" & Replace(Me.txt_9_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_9_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' ,lenmtrtomain	 = '" & Replace(Me.txt_9_lenmtrtomain.Text, "'", "''") & "' ,type_coating	 = '" & Replace(cmb_9_coating.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
            '    ElseIf cmb_formtype.Text.Trim = "Form-954" Then
            '        sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_7_add1.Text & "',add_prefix = '" & cmb_7_add2.Text & "',add_prefix_2 = '" & cmb_7_add2_1.Text & "',add_streetname = '" & cmb_7_add3.Text & "',add_suffix = '" & cmb_7_add4_1.Text & "', street_suffix_cd = '" & cmb_7_add4.Text & "',  date_installed = '" & Me.txt_7_dated.Text & "', city= '" & Me.cmb_7_city.Text & "',  pipe_size= '" & Replace(Me.cmb_7_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_7_pipekind.Text & "', size_of_tap = '" & Replace(Me.cmb_7_tapzize.Text, "'", "''") & "', length_main_to_property_line_ft = '" & Replace(Me.txt_7_mainln_ft.Text, "'", "''") & "', length_main_to_property_line_in = '" & Replace(Me.txt_7_mainln_in.Text, "'", "''") & "',  size_of_main = '" & Replace(Me.cmb_7_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_7_maintype.Text, "'", "''") & "', remark = '" & Replace(Me.txt_7_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_7_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' ,lenmtrtomain	 = '" & Replace(Me.txt_7_lenmtrtomain.Text, "'", "''") & "'  ,nature_of_work	 = '" & Replace(cmb_7_naturework.Text, "'", "''") & "',kind_of_joint	 = '" & Replace(cmb_7_kindjoint.Text, "'", "''") & "',split_sleeve	 = '" & Replace(txt_7_splitsleeve.Text, "'", "''") & "',loc_of_cock	 = '" & Replace(txt_7_loccock.Text, "'", "''") & "',kind_of_box	 = '" & Replace(txt_7_kindbox.Text, "'", "''") & "',type_coating	 = '" & Replace(cmb_7_coating.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
            '    ElseIf Me.cmb_formtype.Text = "Orange" Then
            '        sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_3_add1.Text & "',add_prefix = '" & cmb_3_add2.Text & "',add_streetname = '" & cmb_3_add3.Text & "',add_suffix = '" & cmb_3_add4_1.Text & "', street_suffix_cd = '" & cmb_3_add4.Text & "', city= '" & Me.cmb_3_city.Text & "',  date_installed = '" & Me.txt_3_dated.Text & "',  service_wo_no  = '" & Me.txt_3_serno.Text & "', pipe_size= '" & Replace(Me.cmb_3_pipesize.Text, "'", "''") & "',pipe_type = '" & Replace(Me.cmb_3_pipekind.Text, "'", "''") & "', pressure = '" & Me.cmb_3_pressure.Text & "' ,size_of_tap = '" & Replace(Me.cmb_3_tapzize.Text, "'", "''") & "',length_main_to_curb_valve_ft = '" & Replace(Me.txt_3_ser_ft.Text, "'", "''") & "', length_curb_valve_to_property_line_ft = '" & Replace(Me.txt_3_depser_ft.Text, "'", "''") & "',  length_main_to_property_line_ft = '" & Replace(Me.txt_3_mainln_ft.Text, "'", "''") & "',  length_property_line_to_meter_ft = '" & Replace(Me.txt_3_propln_ft.Text, "'", "''") & "',  size_of_main = '" & Replace(Me.cmb_3_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_3_maintype.Text, "'", "''") & "',installed_by_contractor = '" & Me.txt_3_installedby.Text & "', remark = '" & Replace(Me.txt_3_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_3_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
            '    ElseIf Me.cmb_formtype.Text = "White" Then
            '        sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "', file_type = '" & Me.cmb_formtype.Text & "', add_streetno = '" & Me.txt_w_add1.Text & "', add_prefix = '" & cmb_w_add2.Text & "', add_prefix_2 = '" & cmb_w_add2_1.Text & "', add_streetname = '" & cmb_w_add3.Text & "', add_suffix = '" & Me.cmb_w_add4_1.Text & "', street_suffix_cd = '" & cmb_w_add4.Text & "', date_installed = '" & Me.txt_w_dated.Text & "', city = '" & Me.cmb_w_city.Text & "', subdivision = '" & Me.txt_w_subdiv.Text & "', service_wo_no = '" & Me.txt_w_serno.Text & "', pipe_size = '" & Replace(Me.cmb_w_pipesize.Text, "'", "''") & "', pipe_type = '" & Replace(Me.cmb_w_pipekind.Text, "'", "''") & "', pressure = '" & Me.cmb_w_pressure.Text & "', size_of_tap = '" & Replace(cmb_w_tapzize.Text, "'", "''") & "', length_main_to_curb_valve_ft = '" & Replace(Me.txt_w_ser_ft.Text, "'", "''") & "',length_main_to_curb_valve_in = '" & Replace(Me.txt_w_ser_in.Text, "'", "''") & "', length_curb_valve_to_property_line_ft = '" & Replace(Me.txt_w_depser_ft.Text, "'", "''") & "', size_of_main = '" & Replace(cmb_w_mainsize.Text, "'", "''") & "', type_of_main = '" & Replace(Me.cmb_w_maintype.Text, "'", "''") & "', depth_of_main = '" & Replace(Me.txt_w_deptmain.Text, "'", "''") & "', tested_with = '" & Me.cmb_w_testedwith.Text & "', tested_to = '" & Me.cmb_w_testedto.Text & "', psig_for_minutes = '" & Me.txt_w_psigmin.Text & "', installed_by_contractor = '" & Me.txt_w_installedby.Text & "', foreman = '" & Me.txt_w_foreman.Text & "', remark = '" & Replace(Me.txt_w_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_w_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "',  f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
            '    ElseIf cmb_formtype.Text = "Form235-B-702" Then
            '        sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_4_add1.Text & "',add_prefix = '" & cmb_4_add2.Text & "',add_streetname = '" & cmb_4_add3.Text & "',add_suffix = '" & cmb_4_add4_1.Text & "', street_suffix_cd = '" & cmb_4_add4.Text & "',  date_installed = '" & Me.txt_4_dated.Text & "', city= '" & Me.cmb_4_city.Text & "', pipe_size= '" & Replace(Me.cmb_4_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_4_pipekind.Text & "', pressure = '" & Me.cmb_4_pressure.Text & "' , size_of_main = '" & Replace(Me.cmb_4_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_4_maintype.Text, "'", "''") & "',depth_of_main = '" & Me.txt_4_deptmain.Text & "', tested_with = '" & Me.cmb_4_testedwith.Text & "', tested_to = '" & Me.cmb_4_testedto.Text & "', psig_for_minutes = '" & Me.txt_4_psigmin.Text & "', installed_by_contractor = '" & Me.txt_4_installedby.Text & "', foreman = '" & Me.txt_4_foreman.Text & "', remark = '" & Replace(Me.txt_4_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_4_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' ,pipe_condition	 = '" & Replace(Me.cmb_4_condition.Text, "'", "''") & "' ,lenmtrtomain	 = '" & Replace(Me.txt_4_lenmtrtomain.Text, "'", "''") & "' ,sceginspect	 = '" & Replace(Me.txt_4_sceginspect.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
            '    ElseIf Me.cmb_formtype.Text = "OD-9-6-38" Then
            '        sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_5_add1.Text & "',add_prefix = '" & cmb_5_add2.Text & "',add_streetname = '" & cmb_5_add3.Text & "',add_suffix = '" & cmb_5_add4_1.Text & "', street_suffix_cd = '" & cmb_5_add4.Text & "',  date_installed = '" & Me.txt_5_dated.Text & "', city= '" & Me.cmb_5_city.Text & "', service_wo_no  = '" & Me.txt_5_serno.Text & "', pipe_size= '" & Replace(Me.cmb_5_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_5_pipekind.Text & "', length_main_to_curb_valve_ft = '" & Replace(Me.txt_5_ser_ft.Text, "'", "''") & "',  length_curb_valve_to_property_line_ft = '" & Replace(Me.txt_5_depser_ft.Text, "'", "''") & "', length_property_line_to_meter_ft = '" & Replace(Me.txt_5_propln_ft.Text, "'", "''") & "',  remark = '" & Replace(Me.txt_5_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_5_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
            '    ElseIf Me.cmb_formtype.Text = "Form-80I" Then
            '        sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_6_add1.Text & "',add_prefix = '" & cmb_6_add2.Text & "',add_prefix_2 = '" & cmb_6_add2_1.Text & "',add_streetname = '" & cmb_6_add3.Text & "',add_suffix = '" & cmb_6_add4_1.Text & "', street_suffix_cd = '" & cmb_6_add4.Text & "',  date_installed = '" & Me.txt_6_dated.Text & "', city= '" & Me.cmb_6_city.Text & "', pipe_size= '" & Replace(Me.cmb_6_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_6_pipekind.Text & "', length_main_to_curb_valve_ft = '" & Replace(Me.txt_6_ser_ft.Text, "'", "''") & "', length_main_to_curb_valve_in = '" & Replace(Me.txt_6_ser_in.Text, "'", "''") & "', length_curb_valve_to_property_line_ft = '" & Replace(Me.txt_6_depser_ft.Text, "'", "''") & "', length_curb_valve_to_property_line_in = '" & Replace(Me.txt_6_depser_in.Text, "'", "''") & "',  size_of_main = '" & Replace(Me.cmb_6_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_6_maintype.Text, "'", "''") & "',depth_of_main = '" & Me.txt_6_deptmain.Text & "', tested_with = '" & Me.cmb_6_testedwith.Text & "', tested_to = '" & Me.cmb_6_testedto.Text & "', psig_for_minutes = '" & Me.txt_6_psigmin.Text & "', remark = '" & Replace(Me.txt_6_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_6_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' ,lenmtrtomain	 = '" & Replace(Me.txt_6_lenmtrtomain.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
            '    ElseIf cmb_formtype.Text.Trim = "ABANDON-I" Then
            '        sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_8_add1.Text & "',add_prefix = '" & cmb_8_add2.Text & "',add_prefix_2 = '" & cmb_8_add2_1.Text & "',add_streetname = '" & cmb_8_add3.Text & "',add_suffix = '" & cmb_8_add4_1.Text & "', street_suffix_cd = '" & cmb_8_add4.Text & "',  date_installed = '" & Me.txt_8_dated.Text & "', city= '" & Me.cmb_8_city.Text & "',   size_of_main = '" & Replace(Me.cmb_8_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_8_maintype.Text, "'", "''") & "', remark = '" & Replace(Me.txt_8_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_8_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' , DATE_ABANDON = '" & Me.txt_8_dateabandon.Text & "',type_coating	 = '" & Replace(cmb_8_coating.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
            '    End If
            'End If
            Dim cmd As New SqlCommand(sql1, conn)
            cmd.CommandType = CommandType.StoredProcedure
            cmd.Parameters.AddWithValue("@file_id", file_id)
            cmd.Parameters.AddWithValue("@file_name", file_name)
            cmd.Parameters.AddWithValue("@file_type", file_type)
            cmd.Parameters.AddWithValue("@add_streetno", add_streetno)
            cmd.Parameters.AddWithValue("@add_prefix", add_prefix)
            cmd.Parameters.AddWithValue("@add_prefix_2", add_prefix_2)
            cmd.Parameters.AddWithValue("@add_streetname", add_streetname)
            cmd.Parameters.AddWithValue("@add_suffix", add_suffix)
            cmd.Parameters.AddWithValue("@street_suffix_cd", street_suffix_cd)
            cmd.Parameters.AddWithValue("@name", name)
            cmd.Parameters.AddWithValue("@date_installed", date_installed)
            cmd.Parameters.AddWithValue("@city", city)
            cmd.Parameters.AddWithValue("@subdivision", subdivision)
            cmd.Parameters.AddWithValue("@service_wo_no", service_wo_no)
            cmd.Parameters.AddWithValue("@pipe_size", pipe_size)
            cmd.Parameters.AddWithValue("@pipe_type", pipe_type)
            cmd.Parameters.AddWithValue("@pressure", pressure)
            cmd.Parameters.AddWithValue("@size_of_tap", size_of_tap)
            cmd.Parameters.AddWithValue("@length_main_to_curb_valve_ft", length_main_to_curb_valve_ft)
            cmd.Parameters.AddWithValue("@length_main_to_curb_valve_in", length_main_to_curb_valve_in)
            cmd.Parameters.AddWithValue("@length_curb_valve_to_property_line_ft", length_curb_valve_to_property_line_ft)
            cmd.Parameters.AddWithValue("@length_curb_valve_to_property_line_in", length_curb_valve_to_property_line_in)
            cmd.Parameters.AddWithValue("@length_main_to_property_line_ft", length_main_to_property_line_ft)
            cmd.Parameters.AddWithValue("@length_main_to_property_line_in", length_main_to_property_line_in)
            cmd.Parameters.AddWithValue("@length_property_line_to_meter_ft", length_property_line_to_meter_ft)
            cmd.Parameters.AddWithValue("@length_property_line_to_meter_in", length_property_line_to_meter_in)
            cmd.Parameters.AddWithValue("@size_of_main", size_of_main)
            cmd.Parameters.AddWithValue("@type_of_main", type_of_main)
            cmd.Parameters.AddWithValue("@depth_of_main", depth_of_main)
            cmd.Parameters.AddWithValue("@tested_with", tested_with)
            cmd.Parameters.AddWithValue("@tested_to", tested_to)
            cmd.Parameters.AddWithValue("@psig_for_minutes", psig_for_minutes)
            cmd.Parameters.AddWithValue("@installed_by_contractor", installed_by_contractor)
            cmd.Parameters.AddWithValue("@foreman", foreman)
            cmd.Parameters.AddWithValue("@remark", remark)
            cmd.Parameters.AddWithValue("@PREMISE_NO", PREMISE_NO)
            cmd.Parameters.AddWithValue("@f_stub", f_stub)
            cmd.Parameters.AddWithValue("@f_inserted", f_inserted)
            cmd.Parameters.AddWithValue("@f_retired", f_retired)
            cmd.Parameters.AddWithValue("@f_leak", f_leak)
            cmd.Parameters.AddWithValue("@f_split", f_split)
            cmd.Parameters.AddWithValue("@pipe_condition", pipe_condition)
            cmd.Parameters.AddWithValue("@lenmtrtomain", lenmtrtomain)
            cmd.Parameters.AddWithValue("@sceginspect", sceginspect)
            cmd.Parameters.AddWithValue("@nature_of_work", nature_of_work)
            cmd.Parameters.AddWithValue("@kind_of_joint", kind_of_joint)
            cmd.Parameters.AddWithValue("@split_sleeve", split_sleeve)
            cmd.Parameters.AddWithValue("@loc_of_cock", loc_of_cock)
            cmd.Parameters.AddWithValue("@kind_of_box", kind_of_box)
            cmd.Parameters.AddWithValue("@type_coating", type_coating)
            cmd.Parameters.AddWithValue("@DATE_ABANDON", DATE_ABANDON)
            cmd.Parameters.AddWithValue("@reason_of_abandon", reason_of_abandon)
            cmd.Parameters.AddWithValue("@f_noblow", f_noblow)
            cmd.Parameters.AddWithValue("@f_gassource", f_gassource)
            cmd.Parameters.AddWithValue("@f_tappingtee", f_tappingtee)
            cmd.Parameters.AddWithValue("@f_linesealed", f_linesealed)
            cmd.Parameters.AddWithValue("@f_defcoatcor", f_defcoatcor)
            cmd.Parameters.AddWithValue("@f_multimeter", f_multimeter)
            cmd.Parameters.AddWithValue("@f_serstop", f_serstop)
            cmd.Parameters.AddWithValue("@f_cathodpro", f_cathodpro)
            cmd.Parameters.AddWithValue("@f_tee", f_tee)
            cmd.Parameters.AddWithValue("@f_taptee", f_taptee)
            cmd.Parameters.AddWithValue("@f_galvanized", f_galvanized)
            cmd.Parameters.AddWithValue("@tap_t_size", tap_t_size)
            cmd.Parameters.AddWithValue("@tap_t_inlet", tap_t_inlet)
            cmd.Parameters.AddWithValue("@tap_t_outlet", tap_t_outlet)
            cmd.Parameters.AddWithValue("@f_insulated", f_insulated)
            cmd.Parameters.AddWithValue("@f_anoderiser", f_anoderiser)
            cmd.Parameters.AddWithValue("@otheranode_lbs", otheranode_lbs)
            cmd.Parameters.AddWithValue("@connection_data", connection_data)
            cmd.Parameters.AddWithValue("@misc_card_type", misc_card_type)
            cmd.Parameters.AddWithValue("@f_relocate", f_relocate)
            cmd.Parameters.AddWithValue("@f_replace", f_replace)
            cmd.Parameters.AddWithValue("@STREET_LOCATION_1_CD", STREET_LOCATION_1_CD)
            cmd.Parameters.AddWithValue("@STREET_LOCATION_2_CD", STREET_LOCATION_2_CD)

            '100BLK Parameters
            cmd.Parameters.AddWithValue("@main_year_installed", main_installed_year)
            cmd.Parameters.AddWithValue("@a_ps_reading", a_ps_reading)
            cmd.Parameters.AddWithValue("@total_anodes_1", tot_anodes_1)
            cmd.Parameters.AddWithValue("@total_anodes_17", tot_anodes_17)
            cmd.Parameters.AddWithValue("@lr", lr)
            cmd.Parameters.AddWithValue("@inches_wc", inches_wc)

            '200BLK Parameters
            cmd.Parameters.AddWithValue("@RetiredSize", RetiredSize)
            cmd.Parameters.AddWithValue("@UnitsRetired", UnitsRetired)
            cmd.Parameters.AddWithValue("@LengthRetired", LengthRetired)
            cmd.Parameters.AddWithValue("@RetiredQty", RetiredQty)
            cmd.Parameters.AddWithValue("@2LbSystem", LbSystem)

            cmd.ExecuteNonQuery()
            msg = True
            MessageBox.Show("Record Added Successfully!!", "Scraping", MessageBoxButtons.OK, MessageBoxIcon.Information)
            If conn.State = ConnectionState.Open Then
                conn.Close()
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message.ToString & vbCrLf & " Record could not be added, Try Again", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
            msg = False
        End Try
        Return msg
    End Function

    Private Function get_submitted_flag(ByVal file_id As Integer)
        Dim sflag As Boolean = False
        If conn.State = 0 Then
            conn.Open()
        End If
        Dim SQLCmd As New SqlCommand
        SQLCmd.CommandText = "Get_submitted_flag" ' Stored Procedure
        SQLCmd.CommandType = CommandType.StoredProcedure
        SQLCmd.Connection = conn
        SQLCmd.Parameters.AddWithValue("file_id", file_id)
        Dim dr1 As SqlDataReader = Nothing

        dr1 = SQLCmd.ExecuteReader(CommandBehavior.CloseConnection)
        If (dr1.Read) Then
            If Not (IsDBNull(dr1(0))) Then
                If dr1(0).ToString <> "" Then
                    sflag = True
                End If

            End If
        End If
        dr1.Close()

        If conn.State = ConnectionState.Open Then
            conn.Close()
        End If

        Return sflag
    End Function
    Private Sub btn_submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_submit.Click
        If conn.State = ConnectionState.Closed Then
            conn.Open()
        End If
        If btn_submit.Text.Trim = "SUBMIT" Then
            Try
                Dim a As DialogResult = MsgBox("Are you sure, you want to store the record?", MsgBoxStyle.OkCancel, "Data Entry")
                If a = Windows.Forms.DialogResult.Cancel Then Exit Sub
                If add_data() = False Then Exit Sub

                update_fileid_status(Me.txt_fileid.Text.Trim)

                If (getnext_fileid(CInt(Me.txt_fileid.Text.Trim)) > 0) Then
                    getfiledetail(getnext_fileid(CInt(Me.txt_fileid.Text.Trim)))
                Else
                    MsgBox("No More image files available.", MsgBoxStyle.Information, "Next Image")
                End If
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        ElseIf btn_submit.Text.Trim = "UPDATE" Then

            If get_submitted_flag(CInt(txt_fileid.Text.Trim)) = True Then
                MsgBox("Scraping Data for this service card has been submitted. i.e. with Scana now.", MsgBoxStyle.Information, "Data could not be updated any more")
                Exit Sub
            End If
            If conn.State = ConnectionState.Closed Then
                conn.Open()
            End If
            Dim a As DialogResult = MsgBox("Are you sure, you want to update the record?", MsgBoxStyle.OkCancel, "Data Entry")
            If a = Windows.Forms.DialogResult.Cancel Then Exit Sub

            Dim file_name As String = ""
            Dim file_type As String = ""
            Dim add_streetno As String = ""
            Dim add_prefix As String = ""
            Dim add_prefix_2 As String = ""
            Dim add_streetname As String = ""
            Dim add_suffix As String = ""
            Dim street_suffix_cd As String = ""
            Dim name As String = ""
            Dim date_installed As String = ""
            Dim city As String = ""
            Dim subdivision As String = ""
            Dim service_wo_no As String = ""
            Dim pipe_size As String = ""
            Dim pipe_type As String = ""
            Dim pressure As String = ""
            Dim size_of_tap As String = ""
            Dim size_of_main As String = ""
            Dim type_of_main As String = ""
            Dim depth_of_main As String = ""
            Dim tested_with As String = ""
            Dim tested_to As String = ""
            Dim psig_for_minutes As String = ""
            Dim installed_by_contractor As String = ""
            Dim foreman As String = ""
            Dim remark As String = ""
            Dim PREMISE_NO As String = ""
            Dim pipe_condition As String = ""
            Dim sceginspect As String = ""
            Dim nature_of_work As String = ""
            Dim kind_of_joint As String = ""
            Dim split_sleeve As String = ""
            Dim loc_of_cock As String = ""
            Dim kind_of_box As String = ""
            Dim type_coating As String = ""
            Dim DATE_ABANDON As String = ""
            Dim reason_of_abandon As String = ""
            Dim f_multimeter As String = ""
            Dim tap_t_size As String = ""
            Dim tap_t_inlet As String = ""
            Dim tap_t_outlet As String = ""
            Dim otheranode_lbs As String = ""
            Dim connection_data As String = ""
            Dim misc_card_type As String = ""
            Dim STREET_LOCATION_1_CD As String = ""
            Dim STREET_LOCATION_2_CD As String = ""
            Dim lenmtrtomain As Integer
            Dim length_main_to_property_line_ft, length_main_to_property_line_in, length_property_line_to_meter_ft, length_property_line_to_meter_in As Integer
            Dim f_stub, f_inserted, f_retired, f_leak, f_split, f_noblow, f_gassource, f_tappingtee, f_linesealed, f_defcoatcor, f_serstop, f_cathodpro, f_tee, f_taptee, f_galvanized, f_insulated, f_anoderiser, f_relocate, f_replace As Boolean
            Dim file_id, length_main_to_curb_valve_ft, length_main_to_curb_valve_in, length_curb_valve_to_property_line_ft, length_curb_valve_to_property_line_in As Integer

            'New fields for 100BLK for update
            Dim main_installed_year As String = ""
            Dim a_ps_reading As String = ""
            Dim tot_anodes_1 As String = ""
            Dim tot_anodes_17 As String = ""
            Dim lr As String = ""
            Dim inches_wc As String = ""

            'New fields for 200BLK for update
            Dim RetiredSize As String = ""
            Dim UnitsRetired As String = ""
            Dim LengthRetired As String = ""
            Dim RetiredQty As String = ""
            Dim LbSystem As Boolean

            Dim sql1 As String = "Update_Data"
            file_id = Me.txt_fileid.Text.Trim()


            ''UPDATE 100BLK
            If Me.cmb_formtype.Text = "FORM-100BLK" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_100b_add1.Text
                add_prefix = cmb_100b_add2.Text
                add_prefix_2 = cmb_100b_add2_1.Text
                add_streetname = cmb_100b_add3.Text
                add_suffix = cmb_100b_add4_1.Text
                street_suffix_cd = cmb_100b_add4.Text
                city = Me.cmb_100b_city.Text
                date_installed = Me.txt_100b_dated.Text
                DATE_ABANDON = txt_100b_dateabandon.Text
                'subdivision = Me.txt_y_subdiv.Text
                'service_wo_no = Me.txt_y_serno.Text
                pipe_size = Replace(Me.cmb_100b_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_100b_pipekind.Text
                pressure = Me.cmb_100b_pressure.Text
                size_of_tap = Replace(Me.cmb_100b_tapsize.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                'length_main_to_curb_valve_ft = Replace(Me.txt_y_ser_ft.Text, "'", "''")
                'length_main_to_curb_valve_in = Replace(Me.txt_y_ser_in.Text, "'", "''")
                'length_curb_valve_to_property_line_ft = Replace(Me.txt_y_depser_ft.Text, "'", "''")
                'length_curb_valve_to_property_line_in = Replace(Me.txt_y_depser_in.Text, "'", "''")
                length_main_to_property_line_ft = Replace(Me.txt_100b_mainln_ft.Text, "'", "''")
                'length_main_to_property_line_in = Replace(Me.txt_y_mainln_in.Text, "'", "''")
                length_property_line_to_meter_ft = Replace(Me.txt_100b_propln_ft.Text, "'", "''")
                'length_property_line_to_meter_in = Replace(Me.txt_y_propln_in.Text, "'", "''")
                lenmtrtomain = Replace(Me.txt_100b_lenmtrtomain.Text, "'", "''")
                size_of_main = Replace(Me.cmb_100b_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_100b_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                depth_of_main = Me.txt_100b_deptmain.Text
                tested_with = Me.cmb_100b_testedwith.Text
                tested_to = Me.cmb_100b_testedto.Text
                psig_for_minutes = Me.txt_100b_psigmin.Text
                'installed_by_contractor = Me.txt_y_installedby.Text
                'foreman = Me.txt_y_foreman.Text
                remark = Me.txt_100b_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_100b_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If

                main_installed_year = txt_100b_installedyear.Text
                a_ps_reading = txt_100b_a_ps_reading.Text
                tot_anodes_1 = txt_100b_tot_anodes_1.Text
                tot_anodes_17 = txt_100b_tot_anodes_17.Text
                lr = txt_100b_lr.Text
                inches_wc = Me.txt_100b_incheswc.Text
            End If


            ''UPDATE FORM-100BLK-MISC
            If Me.cmb_formtype.Text = "FORM-100BLK-MISC" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_100b_m_add1.Text
                add_prefix = cmb_100b_m_add2.Text
                add_prefix_2 = cmb_100b_m_add2_1.Text
                add_streetname = cmb_100b_m_add3.Text
                add_suffix = cmb_100b_m_add4_1.Text
                street_suffix_cd = cmb_100b_m_add4.Text
                city = Me.cmb_100b_m_city.Text
                date_installed = Me.txt_100b_m_dated.Text
                DATE_ABANDON = txt_100b_m_dateabandon.Text
                'subdivision = Me.txt_y_subdiv.Text
                'service_wo_no = Me.txt_y_serno.Text
                pipe_size = Replace(Me.cmb_100b_m_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_100b_m_pipekind.Text
                pressure = Me.cmb_100b_m_pressure.Text
                size_of_tap = Replace(Me.cmb_100b_m_tapsize.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                'length_main_to_curb_valve_ft = Replace(Me.txt_y_ser_ft.Text, "'", "''")
                'length_main_to_curb_valve_in = Replace(Me.txt_y_ser_in.Text, "'", "''")
                'length_curb_valve_to_property_line_ft = Replace(Me.txt_y_depser_ft.Text, "'", "''")
                'length_curb_valve_to_property_line_in = Replace(Me.txt_y_depser_in.Text, "'", "''")
                length_main_to_property_line_ft = Replace(Me.txt_100b_m_mainln_ft.Text, "'", "''")
                'length_main_to_property_line_in = Replace(Me.txt_y_mainln_in.Text, "'", "''")
                length_property_line_to_meter_ft = Replace(Me.txt_100b_m_propln_ft.Text, "'", "''")
                'length_property_line_to_meter_in = Replace(Me.txt_y_propln_in.Text, "'", "''")
                lenmtrtomain = Replace(Me.txt_100b_m_lenmtrtomain.Text, "'", "''")
                size_of_main = Replace(Me.cmb_100b_m_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_100b_m_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                depth_of_main = Me.txt_100b_m_deptmain.Text
                tested_with = Me.cmb_100b_m_testedwith.Text
                tested_to = Me.cmb_100b_m_testedto.Text
                psig_for_minutes = Me.txt_100b_m_psigmin.Text
                'installed_by_contractor = Me.txt_y_installedby.Text
                'foreman = Me.txt_y_foreman.Text
                remark = Me.txt_100b_m_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_100b_m_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If

                main_installed_year = txt_100b_m_installedyear.Text
                a_ps_reading = txt_100b_m_a_ps_reading.Text
                tot_anodes_1 = txt_100b_m_tot_anodes_1.Text
                tot_anodes_17 = txt_100b_m_tot_anodes_17.Text
                lr = txt_100b_m_lr.Text
                inches_wc = Me.txt_100b_m_incheswc.Text
            End If

            ''UPDATE 200BLK
            If Me.cmb_formtype.Text = "FORM-200BLK" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txthouseNo1.Text
                add_prefix = cmbPrefix11.Text
                add_prefix_2 = cmbPrefix22.Text
                add_streetname = cmbStreetname1.Text
                add_suffix = cmbsuffix12.Text
                street_suffix_cd = cmbsuffix22.Text
                city = Me.cmb_200b_city.Text
                date_installed = Me.txtDate1.Text
                DATE_ABANDON = Me.txt_Retired_date.Text

                pipe_size = Replace(Me.cmb_pipe_size.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_typeofservice.Text
                tested_to = Me.cmbPressure.Text
                size_of_main = Replace(Me.cmb_main_size.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_main_type.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                size_of_tap = Replace(Me.cmbTapSize.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                depth_of_main = Me.txtDepthMain.Text
                tested_with = Me.cmbMedium.Text
                'tested_to = Me.cmb_4_testedto.Text
                psig_for_minutes = Me.txt_length1.Text
                'installed_by_contractor = Me.txt_4_installedby.Text
                'foreman = Me.txt_4_foreman.Text
                remark = Replace(Me.txt_Remarks.Text, "'", "''")
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = txt_200b_premiseno.Text
                LbSystem = Me.chk2lbSystem.Checked.ToString
                'chk2lbSystemNo1 = Me.chk2lbSystemNo1.Checked.ToString

                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString

                length_main_to_curb_valve_ft = Replace(Me.txtmainToBackOfCurb.Text, "'", "''")
                lenmtrtomain = Me.txt_pipesize_length.Text
                a_ps_reading = Me.txtPS_Reading.Text

                RetiredSize = Me.cmbRetiredSize.Text
                UnitsRetired = Me.txtUnitsRetired.Text
                LengthRetired = Me.txtLengthRetired.Text
                RetiredQty = Me.txtRetiredQnty.Text

                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If

            If Me.cmb_formtype.Text = "FORM-200BLK_PAGE1" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txthouseNo.Text
                add_prefix = cmbPrefix1.Text
                add_prefix_2 = cmbPrefix2.Text
                add_streetname = cmbStreetname.Text
                add_suffix = cmbsuffix1.Text
                street_suffix_cd = cmbsuffix2.Text
                city = Me.cmb_200b_city_p1.Text
                date_installed = Me.txtDate_p1.Text
                DATE_ABANDON = Me.txt_Retired_date_p1.Text

                pipe_size = Replace(Me.cmb_pipe_size_p1.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_typeofservice_p1.Text
                tested_to = Me.cmbPressure_p1.Text
                size_of_main = Replace(Me.cmb_main_size_p1.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_main_type_p1.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                size_of_tap = Replace(Me.cmbTapSize_p1.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                depth_of_main = Me.txtDepthMain_p1.Text
                tested_with = Me.cmbMedium_p1.Text
                'tested_to = Me.cmb_4_testedto.Text
                psig_for_minutes = Me.txt_length1_p1.Text
                'installed_by_contractor = Me.txt_4_installedby.Text
                'foreman = Me.txt_4_foreman.Text
                remark = Replace(Me.txt_Remarks_p1.Text, "'", "''")
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = txt_200b_premiseno_p1.Text
                LbSystem = Me.chk2lbSystem_p1.Checked.ToString
                'chk2lbSystemNo1 = Me.chk2lbSystemNo1.Checked.ToString

                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString

                length_main_to_curb_valve_ft = Replace(Me.txtmainToBackOfCurb_p1.Text, "'", "''")
                lenmtrtomain = Me.txt_pipesize_length_p1.Text
                a_ps_reading = Me.txtPS_Reading_p1.Text

                RetiredSize = Me.cmbRetiredSize_p1.Text
                UnitsRetired = Me.txtUnitsRetired_p1.Text
                LengthRetired = Me.txtLengthRetired_p1.Text
                RetiredQty = Me.txtRetiredQnty_p1.Text

                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If

            If Me.cmb_formtype.Text = "Yellow" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_y_add1.Text
                add_prefix = cmb_y_add2.Text
                add_prefix_2 = cmb_y_add2_1.Text
                add_streetname = cmb_y_add3.Text
                add_suffix = cmb_y_add4_1.Text
                street_suffix_cd = cmb_y_add4.Text
                date_installed = Me.txt_y_dated.Text
                city = Me.cmb_y_city.Text
                subdivision = Me.txt_y_subdiv.Text
                service_wo_no = Me.txt_y_serno.Text
                pipe_size = Replace(Me.cmb_y_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_y_pipekind.Text
                pressure = Me.cmb_y_pressure.Text
                size_of_tap = Replace(Me.cmb_y_tapzize.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                length_main_to_curb_valve_ft = Replace(Me.txt_y_ser_ft.Text, "'", "''")
                length_main_to_curb_valve_in = Replace(Me.txt_y_ser_in.Text, "'", "''")
                length_curb_valve_to_property_line_ft = Replace(Me.txt_y_depser_ft.Text, "'", "''")
                length_curb_valve_to_property_line_in = Replace(Me.txt_y_depser_in.Text, "'", "''")
                length_main_to_property_line_ft = Replace(Me.txt_y_mainln_ft.Text, "'", "''")
                length_main_to_property_line_in = Replace(Me.txt_y_mainln_in.Text, "'", "''")
                length_property_line_to_meter_ft = Replace(Me.txt_y_propln_ft.Text, "'", "''")
                length_property_line_to_meter_in = Replace(Me.txt_y_propln_in.Text, "'", "''")
                size_of_main = Replace(Me.cmb_y_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_y_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                depth_of_main = Me.txt_y_deptmain.Text
                tested_with = Me.cmb_y_testedwith.Text
                tested_to = Me.cmb_y_testedto.Text
                psig_for_minutes = Me.txt_y_psigmin.Text
                installed_by_contractor = Me.txt_y_installedby.Text
                foreman = Me.txt_y_foreman.Text
                remark = Me.txt_y_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_y_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,subdivision,service_wo_no,pipe_size,pipe_type,pressure,size_of_tap,length_main_to_curb_valve_ft,length_main_to_curb_valve_in,length_curb_valve_to_property_line_ft,length_curb_valve_to_property_line_in,length_main_to_property_line_ft,length_main_to_property_line_in,length_property_line_to_meter_ft,length_property_line_to_meter_in,size_of_main,type_of_main,depth_of_main,tested_with,tested_to,psig_for_minutes,installed_by_contractor,foreman,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_y_add1.Text & "','" & cmb_y_add2.Text & "', '" & cmb_y_add2_1.Text & "','" & cmb_y_add3.Text & "','" & cmb_y_add4_1.Text & "', '" & cmb_y_add4.Text & "','" & Me.txt_y_dated.Text & "','" & Me.cmb_y_city.Text & "','" & Me.txt_y_subdiv.Text & "','" & Me.txt_y_serno.Text & "','" & Replace(Me.cmb_y_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_y_pipekind.Text, "'", "''") & "','" & Me.cmb_y_pressure.Text & "','" & Replace(Me.cmb_y_tapzize.Text, "'", "''") & "','" & Replace(Me.txt_y_ser_ft.Text, "'", "''") & "','" & Replace(Me.txt_y_ser_in.Text, "'", "''") & "','" & Replace(Me.txt_y_depser_ft.Text, "'", "''") & "','" & Replace(Me.txt_y_depser_in.Text, "'", "''") & "','" & Replace(Me.txt_y_mainln_ft.Text, "'", "''") & "','" & Replace(Me.txt_y_mainln_in.Text, "'", "''") & "','" & Replace(Me.txt_y_propln_ft.Text, "'", "''") & "','" & Replace(Me.txt_y_propln_in.Text, "'", "''") & "','" & Replace(Me.cmb_y_mainsize.Text, "'", "''") & "','" & Me.cmb_y_maintype.Text & "','" & Me.txt_y_deptmain.Text & "','" & Me.cmb_y_testedwith.Text & "','" & Me.cmb_y_testedto.Text & "','" & Me.txt_y_psigmin.Text & "','" & Me.txt_y_installedby.Text & "','" & Me.txt_y_foreman.Text & "','" & Replace(Me.txt_y_remark.Text, "'", "''") & "','" & Me.txt_y_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "','" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "ORIGINAL" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_q_add1.Text
                add_prefix = cmb_q_add2.Text
                add_prefix_2 = cmb_q_add2_1.Text
                add_streetname = cmb_q_add3.Text
                add_suffix = cmb_q_add4_1.Text
                street_suffix_cd = cmb_q_add4.Text
                date_installed = Me.txt_q_dated.Text
                city = Me.cmb_q_city.Text
                pipe_size = Replace(Me.cmb_q_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_q_pipekind.Text
                size_of_main = Replace(Me.cmb_q_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_q_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                tested_with = Me.cmb_q_testedwith.Text
                tested_to = Me.cmb_q_testedto.Text
                psig_for_minutes = Me.txt_q_psigmin.Text
                remark = Me.txt_q_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_q_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                type_coating = Replace(cmb_q_coating.Text, "'", "''")
                If type_coating Is Nothing Then
                    type_coating = ""
                End If
                lenmtrtomain = Replace(Me.txt_q_lenmtrtomain.Text, "'", "''")
                f_noblow = chk_q_noblow.Checked.ToString
                f_defcoatcor = chk_q_defcoatcor.Checked.ToString
                f_multimeter = chk_q_multimeter.Checked.ToString
                f_serstop = chk_q_serstop.Checked.ToString
                f_cathodpro = chk_q_cathodpro.Checked.ToString
                f_tee = chk_q_tee.Checked.ToString
                f_taptee = chk_q_taptee.Checked.ToString
                f_galvanized = chk_q_galvanized.Checked.ToString
                tap_t_size = Replace(Me.txt_q_ttsize.Text, "'", "''")
                If tap_t_size Is Nothing Then
                    tap_t_size = ""
                End If
                tap_t_inlet = Replace(Me.txt_q_ttinlet.Text, "'", "''")
                If tap_t_inlet Is Nothing Then
                    tap_t_inlet = ""
                End If
                tap_t_outlet = Replace(Me.txt_q_ttoutlet.Text, "'", "''")
                If tap_t_outlet Is Nothing Then
                    tap_t_outlet = ""
                End If
                f_insulated = chk_q_insulated.Checked.ToString
                f_anoderiser = chk_q_anoderiser.Checked.ToString
                otheranode_lbs = Replace(Me.txt_q_otheranode.Text, "'", "''")
                If otheranode_lbs Is Nothing Then
                    otheranode_lbs = ""
                End If
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,pipe_size,pipe_type,size_of_main,type_of_main,tested_with,tested_to,psig_for_minutes,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split,type_coating, lenmtrtomain, f_noblow , f_defcoatcor, f_multimeter,f_serstop,f_cathodpro,f_tee,f_taptee,f_galvanized,tap_t_size,tap_t_inlet,tap_t_outlet, f_insulated, f_anoderiser, otheranode_lbs, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_q_add1.Text & "','" & cmb_q_add2.Text & "', '" & cmb_q_add2_1.Text & "','" & cmb_q_add3.Text & "','" & cmb_q_add4_1.Text & "', '" & cmb_q_add4.Text & "','" & Me.txt_q_dated.Text & "','" & Me.cmb_q_city.Text & "','" & Replace(Me.cmb_q_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_q_pipekind.Text, "'", "''") & "','" & Replace(Me.cmb_q_mainsize.Text, "'", "''") & "','" & Me.cmb_q_maintype.Text & "','" & Me.cmb_q_testedwith.Text & "','" & Me.cmb_q_testedto.Text & "','" & Me.txt_q_psigmin.Text & "','" & Replace(Me.txt_q_remark.Text, "'", "''") & "','" & Me.txt_q_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "','" & Replace(cmb_q_coating.Text, "'", "''") & "',  '" & Replace(Me.txt_q_lenmtrtomain.Text, "'", "''") & "','" & chk_q_noblow.Checked.ToString & "', '" & chk_q_defcoatcor.Checked.ToString & "', '" & chk_q_multimeter.Checked.ToString & "', '" & chk_q_serstop.Checked.ToString & "', '" & chk_q_cathodpro.Checked.ToString & "' , '" & chk_q_tee.Checked.ToString & "', '" & chk_q_taptee.Checked.ToString & "' , '" & chk_q_galvanized.Checked.ToString & "' , '" & Replace(Me.txt_q_ttsize.Text, "'", "''") & "' , '" & Replace(Me.txt_q_ttinlet.Text, "'", "''") & "' , '" & Replace(Me.txt_q_ttoutlet.Text, "'", "''") & "' , '" & chk_q_insulated.Checked.ToString & "' , '" & chk_q_anoderiser.Checked.ToString & "' , '" & Replace(Me.txt_q_otheranode.Text, "'", "''") & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "','" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "MISC" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_l_add1.Text
                add_prefix = cmb_l_add2.Text
                add_prefix_2 = cmb_l_add2_1.Text
                add_streetname = cmb_l_add3.Text
                add_suffix = cmb_l_add4_1.Text
                street_suffix_cd = cmb_l_add4.Text
                city = Me.cmb_l_city.Text
                remark = Me.txt_l_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_l_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                misc_card_type = Me.cmb_l_misCtype.Text
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            ' sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,city, remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split,misc_card_type, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_l_add1.Text & "','" & cmb_l_add2.Text & "', '" & cmb_l_add2_1.Text & "','" & cmb_l_add3.Text & "','" & cmb_l_add4_1.Text & "', '" & cmb_l_add4.Text & "','" & Me.cmb_l_city.Text & "', '" & Replace(Me.txt_l_remark.Text, "'", "''") & "','" & Me.txt_l_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "', '" & Me.cmb_l_misCtype.Text & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "','" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "ORIGINAL-R" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_r_add1.Text
                add_prefix = cmb_r_add2.Text
                add_prefix_2 = cmb_r_add2_1.Text
                add_streetname = cmb_r_add3.Text
                add_suffix = cmb_r_add4_1.Text
                street_suffix_cd = cmb_r_add4.Text
                date_installed = Me.txt_r_dated.Text
                city = Me.cmb_r_city.Text
                pipe_size = Replace(Me.cmb_r_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_r_pipekind.Text
                size_of_main = Replace(Me.cmb_r_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_r_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                tested_with = Me.cmb_r_testedwith.Text
                tested_to = Me.cmb_r_testedto.Text
                psig_for_minutes = Me.txt_r_psigmin.Text
                remark = Me.txt_r_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_r_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                lenmtrtomain = Replace(Me.txt_r_lenmtrtomain.Text, "'", "''")
                f_noblow = chk_r_noblow.Checked.ToString
                f_defcoatcor = chk_r_defcoatcor.Checked.ToString
                f_serstop = chk_r_serstop.Checked.ToString
                f_cathodpro = chk_r_cathodpro.Checked.ToString
                tap_t_size = Replace(Me.txt_r_ttsize.Text, "'", "''")
                If tap_t_size Is Nothing Then
                    tap_t_size = ""
                End If
                tap_t_inlet = Replace(Me.txt_r_ttinlet.Text, "'", "''")
                If tap_t_inlet Is Nothing Then
                    tap_t_inlet = ""
                End If
                tap_t_outlet = Replace(Me.txt_r_ttoutlet.Text, "'", "''")
                If tap_t_outlet Is Nothing Then
                    tap_t_outlet = ""
                End If
                f_insulated = chk_r_insulated.Checked.ToString
                f_anoderiser = chk_r_anoderiser.Checked.ToString
                otheranode_lbs = Replace(Me.txt_r_otheranode.Text, "'", "''")
                If otheranode_lbs Is Nothing Then
                    otheranode_lbs = ""
                End If
                connection_data = Replace(Me.cmb_r_connection_data.Text, "'", "''")
                If connection_data Is Nothing Then
                    connection_data = ""
                End If
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,pipe_size,pipe_type,size_of_main,type_of_main,tested_with,tested_to,psig_for_minutes,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split, lenmtrtomain, f_noblow , f_defcoatcor, f_serstop,f_cathodpro,tap_t_size,tap_t_inlet,tap_t_outlet, f_insulated, f_anoderiser, otheranode_lbs, connection_data , f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_r_add1.Text & "','" & cmb_r_add2.Text & "', '" & cmb_r_add2_1.Text & "','" & cmb_r_add3.Text & "','" & cmb_r_add4_1.Text & "', '" & cmb_r_add4.Text & "','" & Me.txt_r_dated.Text & "','" & Me.cmb_r_city.Text & "','" & Replace(Me.cmb_r_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_r_pipekind.Text, "'", "''") & "','" & Replace(Me.cmb_r_mainsize.Text, "'", "''") & "','" & Me.cmb_r_maintype.Text & "','" & Me.cmb_r_testedwith.Text & "','" & Me.cmb_r_testedto.Text & "','" & Me.txt_r_psigmin.Text & "','" & Replace(Me.txt_r_remark.Text, "'", "''") & "','" & Me.txt_r_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "',  '" & Replace(Me.txt_r_lenmtrtomain.Text, "'", "''") & "','" & chk_r_noblow.Checked.ToString & "', '" & chk_r_defcoatcor.Checked.ToString & "',  '" & chk_r_serstop.Checked.ToString & "', '" & chk_r_cathodpro.Checked.ToString & "' ,  '" & Replace(Me.txt_r_ttsize.Text, "'", "''") & "' , '" & Replace(Me.txt_r_ttinlet.Text, "'", "''") & "' , '" & Replace(Me.txt_r_ttoutlet.Text, "'", "''") & "' , '" & chk_r_insulated.Checked.ToString & "' , '" & chk_r_anoderiser.Checked.ToString & "' , '" & Replace(Me.txt_r_otheranode.Text, "'", "''") & "', '" & Replace(Me.cmb_r_connection_data.Text, "'", "''") & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "','" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "ABANDON-II" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_a_add1.Text
                add_prefix = cmb_a_add2.Text
                add_prefix_2 = cmb_a_add2_1.Text
                add_streetname = cmb_a_add3.Text
                add_suffix = cmb_a_add4_1.Text
                street_suffix_cd = cmb_a_add4.Text
                city = Me.cmb_a_city.Text
                size_of_main = Replace(Me.cmb_a_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_a_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                depth_of_main = Me.txt_y_deptmain.Text
                tested_with = Me.cmb_a_testedwith.Text
                installed_by_contractor = Me.txt_a_installedby.Text
                remark = Me.txt_a_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_a_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                DATE_ABANDON = Me.txt_a_dateabandon.Text
                f_noblow = chk_a_noblow.Checked.ToString
                f_gassource = chk_a_gassource.Checked.ToString
                f_tappingtee = chk_a_tappingtee.Checked.ToString
                f_linesealed = chk_a_linesealed.Checked.ToString
                lenmtrtomain = Replace(Me.txt_a_lenmtrtomain.Text, "'", "''")
                reason_of_abandon = Replace(Me.cmb_a_reasonabandon.Text, "'", "''")
                If reason_of_abandon Is Nothing Then
                    reason_of_abandon = ""
                End If
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,city,size_of_main,type_of_main,tested_with,installed_by_contractor,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split,lenmtrtomain, reason_of_abandon , DATE_ABANDON, f_noblow, f_gassource, f_tappingtee, f_linesealed, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_a_add1.Text & "','" & cmb_a_add2.Text & "', '" & cmb_a_add2_1.Text & "','" & cmb_a_add3.Text & "','" & cmb_a_add4_1.Text & "', '" & cmb_a_add4.Text & "','" & Me.cmb_a_city.Text & "','" & Replace(Me.cmb_a_mainsize.Text, "'", "''") & "','" & Me.cmb_a_maintype.Text & "','" & Me.cmb_a_testedwith.Text & "','" & Me.txt_a_installedby.Text & "','" & Replace(Me.txt_a_remark.Text, "'", "''") & "','" & Me.txt_a_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "','" & Replace(Me.txt_a_lenmtrtomain.Text, "'", "''") & "', '" & Replace(Me.cmb_a_reasonabandon.Text, "'", "''") & "', '" & Me.txt_a_dateabandon.Text & "' , '" & chk_a_noblow.Checked.ToString & "' ,'" & chk_a_gassource.Checked.ToString & "' , '" & chk_a_tappingtee.Checked.ToString & "' , '" & chk_a_linesealed.Checked.ToString & "' , '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "Form-X" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_x_add1.Text
                add_prefix = cmb_x_add2.Text
                add_prefix_2 = cmb_x_add2_1.Text
                add_streetname = cmb_x_add3.Text
                add_suffix = cmb_x_add4_1.Text
                street_suffix_cd = cmb_x_add4.Text
                date_installed = Me.txt_x_dated.Text
                city = Me.cmb_x_city.Text
                pipe_size = Replace(Me.cmb_x_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_x_pipekind.Text
                length_main_to_property_line_ft = Replace(Me.txt_x_mainln_ft.Text, "'", "''")
                length_main_to_property_line_in = Replace(Me.txt_x_mainln_in.Text, "'", "''")
                length_property_line_to_meter_ft = Replace(Me.txt_x_propln_ft.Text, "'", "''")
                length_property_line_to_meter_in = Replace(Me.txt_x_propln_in.Text, "'", "''")
                size_of_main = Replace(Me.cmb_x_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_x_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                tested_with = Me.cmb_x_testedwith.Text
                tested_to = Me.cmb_x_testedto.Text
                installed_by_contractor = Me.txt_x_installedby.Text
                remark = Me.txt_x_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_x_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                type_coating = Replace(cmb_x_coating.Text, "'", "''")
                If type_coating Is Nothing Then
                    type_coating = ""
                End If
                lenmtrtomain = Replace(Me.txt_x_lenmtrtomain.Text, "'", "''")
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,pipe_size,pipe_type,length_main_to_property_line_ft,length_main_to_property_line_in,length_property_line_to_meter_ft,length_property_line_to_meter_in,size_of_main,type_of_main,tested_with,tested_to,installed_by_contractor,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split, type_coating, lenmtrtomain, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_x_add1.Text & "','" & cmb_x_add2.Text & "', '" & cmb_x_add2_1.Text & "','" & cmb_x_add3.Text & "','" & cmb_x_add4_1.Text & "', '" & cmb_x_add4.Text & "','" & Me.txt_x_dated.Text & "','" & Me.cmb_x_city.Text & "','" & Replace(Me.cmb_x_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_x_pipekind.Text, "'", "''") & "','" & Replace(Me.txt_x_mainln_ft.Text, "'", "''") & "','" & Replace(Me.txt_x_mainln_in.Text, "'", "''") & "','" & Replace(Me.txt_x_propln_ft.Text, "'", "''") & "','" & Replace(Me.txt_x_propln_in.Text, "'", "''") & "','" & Replace(Me.cmb_x_mainsize.Text, "'", "''") & "','" & Me.cmb_x_maintype.Text & "','" & Me.cmb_x_testedwith.Text & "','" & Me.cmb_x_testedto.Text & "','" & Me.txt_x_installedby.Text & "','" & Replace(Me.txt_x_remark.Text, "'", "''") & "','" & Me.txt_x_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "' ,'" & Replace(cmb_x_coating.Text, "'", "''") & "','" & Replace(Me.txt_x_lenmtrtomain.Text, "'", "''") & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "FORM-IX" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_9_add1.Text
                add_prefix = cmb_9_add2.Text
                add_prefix_2 = cmb_9_add2_1.Text
                add_streetname = cmb_9_add3.Text
                add_suffix = cmb_9_add4_1.Text
                street_suffix_cd = cmb_9_add4.Text
                date_installed = Me.txt_9_dated.Text
                city = Me.cmb_9_city.Text
                service_wo_no = Me.txt_9_serno.Text
                pipe_size = Replace(Me.cmb_9_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_9_pipekind.Text
                size_of_tap = Replace(Me.cmb_9_tapzize.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                size_of_main = Replace(Me.cmb_9_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_9_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                foreman = Me.txt_9_foreman.Text
                remark = Me.txt_9_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_9_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                lenmtrtomain = Replace(Me.txt_9_lenmtrtomain.Text, "'", "''")
                type_coating = Replace(cmb_9_coating.Text, "'", "''")
                If type_coating Is Nothing Then
                    type_coating = ""
                End If
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,service_wo_no,pipe_size,pipe_type,size_of_tap,size_of_main,type_of_main,foreman,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split,lenmtrtomain,type_coating, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_9_add1.Text & "','" & cmb_9_add2.Text & "', '" & cmb_9_add2_1.Text & "','" & cmb_9_add3.Text & "','" & cmb_9_add4_1.Text & "', '" & cmb_9_add4.Text & "','" & Me.txt_9_dated.Text & "','" & Me.cmb_9_city.Text & "','" & Me.txt_9_serno.Text & "','" & Replace(Me.cmb_9_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_9_pipekind.Text, "'", "''") & "','" & Replace(Me.cmb_9_tapzize.Text, "'", "''") & "','" & Replace(Me.cmb_9_mainsize.Text, "'", "''") & "','" & Me.cmb_9_maintype.Text & "','" & Me.txt_9_foreman.Text & "','" & Replace(Me.txt_9_remark.Text, "'", "''") & "','" & Me.txt_9_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "','" & Replace(Me.txt_9_lenmtrtomain.Text, "'", "''") & "','" & Replace(cmb_9_coating.Text, "'", "''") & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If cmb_formtype.Text.Trim = "Form-954" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_7_add1.Text
                add_prefix = cmb_7_add2.Text
                add_prefix_2 = cmb_7_add2_1.Text
                add_streetname = cmb_7_add3.Text
                add_suffix = cmb_7_add4_1.Text
                street_suffix_cd = cmb_7_add4.Text
                date_installed = Me.txt_7_dated.Text
                city = Me.cmb_7_city.Text
                pipe_size = Replace(Me.cmb_7_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_7_pipekind.Text
                size_of_tap = Replace(Me.cmb_7_tapzize.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                length_main_to_property_line_ft = Replace(Me.txt_7_mainln_ft.Text, "'", "''")
                length_main_to_property_line_in = Replace(Me.txt_7_mainln_in.Text, "'", "''")
                size_of_main = Replace(Me.cmb_7_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_7_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                remark = Me.txt_7_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_7_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                lenmtrtomain = Replace(Me.txt_7_lenmtrtomain.Text, "'", "''")

                nature_of_work = Replace(cmb_7_naturework.Text, "'", "''")
                If nature_of_work Is Nothing Then
                    nature_of_work = ""
                End If
                kind_of_joint = Replace(cmb_7_kindjoint.Text, "'", "''")
                If kind_of_joint Is Nothing Then
                    kind_of_joint = ""
                End If
                split_sleeve = Replace(txt_7_splitsleeve.Text, "'", "''")
                If split_sleeve Is Nothing Then
                    split_sleeve = ""
                End If
                loc_of_cock = Replace(txt_7_loccock.Text, "'", "''")
                If loc_of_cock Is Nothing Then
                    loc_of_cock = ""
                End If
                kind_of_box = Replace(txt_7_kindbox.Text, "'", "''")
                If kind_of_box Is Nothing Then
                    kind_of_box = ""
                End If
                type_coating = Replace(cmb_7_coating.Text, "'", "''")
                If type_coating Is Nothing Then
                    type_coating = ""
                End If
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,pipe_size,pipe_type,size_of_tap,length_main_to_property_line_ft,length_main_to_property_line_in,size_of_main,type_of_main,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split,lenmtrtomain,nature_of_work,kind_of_joint, split_sleeve, loc_of_cock, kind_of_box, type_coating, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_7_add1.Text & "','" & cmb_7_add2.Text & "', '" & cmb_7_add2_1.Text & "','" & cmb_7_add3.Text & "','" & cmb_7_add4_1.Text & "', '" & cmb_7_add4.Text & "','" & Me.txt_7_dated.Text & "','" & Me.cmb_7_city.Text & "','" & Replace(Me.cmb_7_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_7_pipekind.Text, "'", "''") & "','" & Replace(Me.cmb_7_tapzize.Text, "'", "''") & "','" & Replace(Me.txt_7_mainln_ft.Text, "'", "''") & "','" & Replace(Me.txt_7_mainln_in.Text, "'", "''") & "','" & Replace(Me.cmb_7_mainsize.Text, "'", "''") & "','" & Me.cmb_7_maintype.Text & "','" & Replace(Me.txt_7_remark.Text, "'", "''") & "','" & Me.txt_7_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "','" & Replace(Me.txt_7_lenmtrtomain.Text, "'", "''") & "','" & Replace(cmb_7_naturework.Text, "'", "''") & "','" & Replace(cmb_7_kindjoint.Text, "'", "''") & "','" & Replace(txt_7_splitsleeve.Text, "'", "''") & "', '" & Replace(txt_7_loccock.Text, "'", "''") & "','" & Replace(txt_7_kindbox.Text, "'", "''") & "','" & Replace(cmb_7_coating.Text, "'", "''") & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "Orange" Then
                file_name = Me.txt_filedesc.Text & ""
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_3_add1.Text
                add_prefix = cmb_3_add2.Text
                add_streetname = cmb_3_add3.Text
                add_suffix = cmb_3_add4_1.Text
                street_suffix_cd = cmb_3_add4.Text
                city = Me.cmb_3_city.Text
                date_installed = Me.txt_3_dated.Text
                service_wo_no = Me.txt_3_serno.Text
                pipe_size = Replace(Me.cmb_3_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Replace(Me.cmb_3_pipekind.Text, "'", "''")
                If pipe_type Is Nothing Then
                    pipe_type = ""
                End If
                pressure = Me.cmb_3_pressure.Text
                size_of_tap = Replace(Me.cmb_3_tapzize.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                length_main_to_curb_valve_ft = Replace(Me.txt_3_ser_ft.Text, "'", "''")
                length_curb_valve_to_property_line_ft = Replace(Me.txt_3_depser_ft.Text, "'", "''")
                length_main_to_property_line_ft = Replace(Me.txt_3_mainln_ft.Text, "'", "''")
                length_property_line_to_meter_ft = Replace(Me.txt_3_propln_ft.Text, "'", "''")
                size_of_main = Replace(Me.cmb_3_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_3_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                installed_by_contractor = Me.txt_3_installedby.Text
                remark = Me.txt_3_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_3_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,service_wo_no,pipe_size,pipe_type,pressure,size_of_tap,length_main_to_curb_valve_ft,length_curb_valve_to_property_line_ft,length_main_to_property_line_ft,length_property_line_to_meter_ft,size_of_main,type_of_main,installed_by_contractor,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_3_add1.Text & "','" & cmb_3_add2.Text & "', '" & cmb_3_add2_1.Text & "','" & cmb_3_add3.Text & "','" & cmb_3_add4_1.Text & "', '" & cmb_3_add4.Text & "','" & Me.txt_3_dated.Text & "','" & Me.cmb_3_city.Text & "', '" & Me.txt_3_serno.Text & "','" & Replace(Me.cmb_3_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_3_pipekind.Text, "'", "''") & "','" & Me.cmb_3_pressure.Text & "','" & Replace(Me.cmb_3_tapzize.Text, "'", "''") & "','" & Replace(Me.txt_3_ser_ft.Text, "'", "''") & "','" & Replace(Me.txt_3_depser_ft.Text, "'", "''") & "','" & Replace(Me.txt_3_mainln_ft.Text, "'", "''") & "','" & Replace(Me.txt_3_propln_ft.Text, "'", "''") & "','" & Replace(Me.cmb_3_mainsize.Text, "'", "''") & "','" & Me.cmb_3_maintype.Text & "','" & Me.txt_3_installedby.Text & "','" & Replace(Me.txt_3_remark.Text, "'", "''") & "','" & Me.txt_3_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "White" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_w_add1.Text
                add_prefix = cmb_w_add2.Text
                add_prefix_2 = cmb_w_add2_1.Text
                add_streetname = cmb_w_add3.Text
                add_suffix = Me.cmb_w_add4_1.Text
                street_suffix_cd = cmb_w_add4.Text
                date_installed = Me.txt_w_dated.Text
                city = Me.cmb_w_city.Text
                subdivision = Me.txt_w_subdiv.Text
                service_wo_no = Me.txt_w_serno.Text
                pipe_size = Replace(Me.cmb_w_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Replace(Me.cmb_w_pipekind.Text, "'", "''")
                If pipe_type Is Nothing Then
                    pipe_type = ""
                End If
                pressure = Me.cmb_w_pressure.Text
                size_of_tap = Replace(cmb_w_tapzize.Text, "'", "''")
                If size_of_tap Is Nothing Then
                    size_of_tap = ""
                End If
                length_main_to_curb_valve_ft = Replace(Me.txt_w_ser_ft.Text, "'", "''")
                length_main_to_curb_valve_in = Replace(Me.txt_w_ser_in.Text, "'", "''")
                length_curb_valve_to_property_line_ft = Replace(Me.txt_w_depser_ft.Text, "'", "''")
                size_of_main = Replace(cmb_w_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_w_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                depth_of_main = Replace(Me.txt_w_deptmain.Text, "'", "''")
                If depth_of_main Is Nothing Then
                    depth_of_main = ""
                End If
                tested_with = Me.cmb_w_testedwith.Text
                tested_to = Me.cmb_w_testedto.Text
                psig_for_minutes = Me.txt_w_psigmin.Text
                installed_by_contractor = Me.txt_w_installedby.Text
                foreman = Me.txt_w_foreman.Text
                remark = Me.txt_w_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_w_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2,add_streetname,add_suffix,street_suffix_cd,date_installed,city,subdivision,service_wo_no,pipe_size,pipe_type,pressure,size_of_tap,length_main_to_curb_valve_ft,length_main_to_curb_valve_in,length_curb_valve_to_property_line_ft,size_of_main,type_of_main,depth_of_main,tested_with,tested_to,psig_for_minutes,installed_by_contractor,foreman,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_w_add1.Text & "','" & cmb_w_add2.Text & "','" & cmb_w_add2_1.Text & "','" & cmb_w_add3.Text & "','" & cmb_w_add4_1.Text & "','" & Me.cmb_w_add4.Text & "','" & Me.txt_w_dated.Text & "','" & Me.cmb_w_city.Text & "','" & Me.txt_w_subdiv.Text & "','" & Me.txt_w_serno.Text & "','" & Replace(Me.cmb_w_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_w_pipekind.Text, "'", "''") & "','" & Me.cmb_w_pressure.Text & "','" & Replace(cmb_w_tapzize.Text, "'", "''") & "','" & Replace(Me.txt_w_ser_ft.Text, "'", "''") & "','" & Replace(Me.txt_w_ser_in.Text, "'", "''") & "','" & Replace(Me.txt_w_depser_ft.Text, "'", "''") & "','" & Replace(cmb_w_mainsize.Text, "'", "''") & "','" & Me.cmb_w_maintype.Text & "','" & Me.txt_w_deptmain.Text & "','" & Me.cmb_w_testedwith.Text & "','" & Me.cmb_w_testedto.Text & "','" & Me.txt_w_psigmin.Text & "','" & Me.txt_w_installedby.Text & "','" & Me.txt_w_foreman.Text & "','" & Replace(Me.txt_w_remark.Text, "'", "''") & "','" & Me.txt_w_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "Form235-B-702" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_4_add1.Text
                add_prefix = cmb_4_add2.Text
                add_prefix_2 = cmb_4_add2_1.Text
                add_streetname = cmb_4_add3.Text
                add_suffix = cmb_4_add4_1.Text
                street_suffix_cd = cmb_4_add4.Text
                date_installed = Me.txt_4_dated.Text
                city = Me.cmb_4_city.Text
                pipe_size = Replace(Me.cmb_4_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_4_pipekind.Text
                pressure = Me.cmb_4_pressure.Text
                size_of_main = Replace(Me.cmb_4_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_4_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                depth_of_main = Me.txt_4_deptmain.Text
                tested_with = Me.cmb_4_testedwith.Text
                tested_to = Me.cmb_4_testedto.Text
                psig_for_minutes = Me.txt_4_psigmin.Text
                installed_by_contractor = Me.txt_4_installedby.Text
                foreman = Me.txt_4_foreman.Text
                remark = Me.txt_4_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_4_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                pipe_condition = Replace(Me.cmb_4_condition.Text, "'", "''")
                If pipe_condition Is Nothing Then
                    pipe_condition = ""
                End If
                lenmtrtomain = Replace(Me.txt_4_lenmtrtomain.Text, "'", "''")
                sceginspect = Replace(Me.txt_4_sceginspect.Text, "'", "''")
                If sceginspect Is Nothing Then
                    sceginspect = ""
                End If
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,pipe_size,pipe_type,pressure,size_of_main,type_of_main,depth_of_main,tested_with,tested_to,psig_for_minutes,installed_by_contractor,foreman,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split,pipe_condition,lenmtrtomain,sceginspect, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_4_add1.Text & "','" & cmb_4_add2.Text & "', '" & cmb_4_add2_1.Text & "','" & cmb_4_add3.Text & "','" & cmb_4_add4_1.Text & "', '" & cmb_4_add4.Text & "','" & Me.txt_4_dated.Text & "','" & Me.cmb_4_city.Text & "','" & Replace(Me.cmb_4_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_4_pipekind.Text, "'", "''") & "','" & Me.cmb_4_pressure.Text & "','" & Replace(Me.cmb_4_mainsize.Text, "'", "''") & "','" & Me.cmb_4_maintype.Text & "','" & Me.txt_4_deptmain.Text & "','" & Me.cmb_4_testedwith.Text & "','" & Me.cmb_4_testedto.Text & "','" & Me.txt_4_psigmin.Text & "','" & Me.txt_4_installedby.Text & "','" & Me.txt_4_foreman.Text & "','" & Replace(Me.txt_4_remark.Text, "'", "''") & "','" & Me.txt_4_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "','" & Replace(Me.cmb_4_condition.Text, "'", "''") & "' ,'" & Replace(Me.txt_4_lenmtrtomain.Text, "'", "''") & "','" & Replace(Me.txt_4_sceginspect.Text, "'", "''") & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "OD-9-6-38" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_5_add1.Text
                add_prefix = cmb_5_add2.Text
                add_prefix_2 = cmb_5_add2_1.Text
                add_streetname = cmb_5_add3.Text
                add_suffix = cmb_5_add4_1.Text
                street_suffix_cd = cmb_5_add4.Text
                date_installed = Me.txt_5_dated.Text
                city = Me.cmb_5_city.Text
                service_wo_no = Me.txt_5_serno.Text
                pipe_size = Replace(Me.cmb_5_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_5_pipekind.Text
                length_main_to_curb_valve_ft = Replace(Me.txt_5_ser_ft.Text, "'", "''")
                length_curb_valve_to_property_line_ft = Replace(Me.txt_5_depser_ft.Text, "'", "''")
                length_property_line_to_meter_ft = Replace(Me.txt_5_propln_ft.Text, "'", "''")
                remark = Me.txt_5_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_5_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,service_wo_no,pipe_size,pipe_type,length_main_to_curb_valve_ft,length_curb_valve_to_property_line_ft,length_property_line_to_meter_ft,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_5_add1.Text & "','" & cmb_5_add2.Text & "', '" & cmb_5_add2_1.Text & "','" & cmb_5_add3.Text & "','" & cmb_5_add4_1.Text & "', '" & cmb_5_add4.Text & "','" & Me.txt_5_dated.Text & "','" & Me.cmb_5_city.Text & "','" & Me.txt_5_serno.Text & "','" & Replace(Me.cmb_5_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_5_pipekind.Text, "'", "''") & "','" & Replace(Me.txt_5_ser_ft.Text, "'", "''") & "','" & Replace(Me.txt_5_depser_ft.Text, "'", "''") & "','" & Replace(Me.txt_5_propln_ft.Text, "'", "''") & "','" & Replace(Me.txt_5_remark.Text, "'", "''") & "','" & Me.txt_5_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If Me.cmb_formtype.Text = "Form-80I" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_6_add1.Text
                add_prefix = cmb_6_add2.Text
                add_prefix_2 = cmb_6_add2_1.Text
                add_streetname = cmb_6_add3.Text
                add_suffix = cmb_6_add4_1.Text
                street_suffix_cd = cmb_6_add4.Text
                date_installed = Me.txt_6_dated.Text
                city = Me.cmb_6_city.Text
                pipe_size = Replace(Me.cmb_6_pipesize.Text, "'", "''")
                If pipe_size Is Nothing Then
                    pipe_size = ""
                End If
                pipe_type = Me.cmb_6_pipekind.Text
                length_main_to_curb_valve_ft = Replace(Me.txt_6_ser_ft.Text, "'", "''")
                length_main_to_curb_valve_in = Replace(Me.txt_6_ser_in.Text, "'", "''")
                length_curb_valve_to_property_line_ft = Replace(Me.txt_6_depser_ft.Text, "'", "''")
                length_curb_valve_to_property_line_in = Replace(Me.txt_6_depser_in.Text, "'", "''")
                size_of_main = Replace(Me.cmb_6_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_6_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                depth_of_main = Me.txt_6_deptmain.Text
                tested_with = Me.cmb_6_testedwith.Text
                tested_to = Me.cmb_6_testedto.Text
                psig_for_minutes = Me.txt_6_psigmin.Text
                remark = Me.txt_6_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_6_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                lenmtrtomain = Replace(Me.txt_6_lenmtrtomain.Text, "'", "''")

                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If
            'sql1 = "Insert into tbl_servicewo(file_id,file_name,file_type,add_streetno,add_prefix,add_prefix_2, add_streetname,add_suffix,street_suffix_cd,date_installed,city,pipe_size,pipe_type,length_main_to_curb_valve_ft,length_main_to_curb_valve_in,length_curb_valve_to_property_line_ft,length_curb_valve_to_property_line_in,size_of_main,type_of_main,depth_of_main,tested_with,tested_to,psig_for_minutes,remark,PREMISE_NO,f_stub,f_inserted,f_retired,f_leak, f_split,lenmtrtomain, f_relocate , f_replace, STREET_LOCATION_1_CD, STREET_LOCATION_2_CD ) values('" & Me.txt_fileid.Text.Trim & "','" & Me.txt_filedesc.Text & "','" & Me.cmb_formtype.Text & "','" & Me.txt_6_add1.Text & "','" & cmb_6_add2.Text & "', '" & cmb_6_add2_1.Text & "','" & cmb_6_add3.Text & "','" & cmb_6_add4_1.Text & "', '" & cmb_6_add4.Text & "','" & Me.txt_6_dated.Text & "','" & Me.cmb_6_city.Text & "','" & Replace(Me.cmb_6_pipesize.Text, "'", "''") & "','" & Replace(Me.cmb_6_pipekind.Text, "'", "''") & "','" & Replace(Me.txt_6_ser_ft.Text, "'", "''") & "','" & Replace(Me.txt_6_ser_in.Text, "'", "''") & "','" & Replace(Me.txt_6_depser_ft.Text, "'", "''") & "','" & Replace(Me.txt_6_depser_in.Text, "'", "''") & "','" & Replace(Me.cmb_6_mainsize.Text, "'", "''") & "','" & Me.cmb_6_maintype.Text & "','" & Me.txt_6_deptmain.Text & "','" & Me.cmb_6_testedwith.Text & "','" & Me.cmb_6_testedto.Text & "','" & Me.txt_6_psigmin.Text & "','" & Replace(Me.txt_6_remark.Text, "'", "''") & "','" & Me.txt_6_premiseno.Text & "', '" & chk_stub.Checked.ToString & "', '" & chk_inserted.Checked.ToString & "', '" & chk_retired.Checked.ToString & "' , '" & ckh_leak.Checked.ToString & "', '" & chk_split.Checked.ToString & "','" & Replace(Me.txt_6_lenmtrtomain.Text, "'", "''") & "', '" & chk_relocate.Checked.ToString & "' , '" & chk_replace.Checked.ToString & "' ,'" & Replace(cmb_loccd_1.Text, "'", "''") & "' ,'" & Replace(txt_loccd_2.Text, "'", "''") & "' )"
            If cmb_formtype.Text.Trim = "ABANDON-I" Then
                file_name = Me.txt_filedesc.Text
                file_type = Me.cmb_formtype.Text
                add_streetno = Me.txt_8_add1.Text
                add_prefix = cmb_8_add2.Text
                add_prefix_2 = cmb_8_add2_1.Text
                add_streetname = cmb_8_add3.Text
                add_suffix = cmb_8_add4_1.Text
                street_suffix_cd = cmb_8_add4.Text
                date_installed = Me.txt_8_dated.Text
                city = Me.cmb_8_city.Text
                size_of_main = Replace(Me.cmb_8_mainsize.Text, "'", "''")
                If size_of_main Is Nothing Then
                    size_of_main = ""
                End If
                type_of_main = Replace(Me.cmb_8_maintype.Text, "'", "''")
                If type_of_main Is Nothing Then
                    type_of_main = ""
                End If
                remark = Me.txt_8_remark.Text
                If remark Is Nothing Then
                    remark = ""
                End If
                PREMISE_NO = Me.txt_8_premiseno.Text
                f_stub = chk_stub.Checked.ToString
                f_inserted = chk_inserted.Checked.ToString
                f_retired = chk_retired.Checked.ToString
                f_leak = ckh_leak.Checked.ToString
                f_split = chk_split.Checked.ToString
                f_relocate = chk_relocate.Checked.ToString
                f_replace = chk_replace.Checked.ToString
                DATE_ABANDON = Me.txt_8_dateabandon.Text
                type_coating = Replace(cmb_8_coating.Text, "'", "''")
                If type_coating Is Nothing Then
                    type_coating = ""
                End If
                STREET_LOCATION_1_CD = Replace(cmb_loccd_1.Text, "'", "''")
                If STREET_LOCATION_1_CD Is Nothing Then
                    STREET_LOCATION_1_CD = ""
                End If
                STREET_LOCATION_2_CD = Replace(txt_loccd_2.Text, "'", "''")
                If STREET_LOCATION_2_CD Is Nothing Then
                    STREET_LOCATION_2_CD = ""
                End If
            End If

            Try
                'If Cmb_formtype.Text = "Yellow" Then
                '    sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_y_add1.Text & "',add_prefix = '" & cmb_y_add2.Text & "',add_prefix_2 = '" & cmb_y_add2_1.Text & "',add_streetname = '" & cmb_y_add3.Text & "',add_suffix = '" & cmb_y_add4_1.Text & "', street_suffix_cd = '" & cmb_y_add4.Text & "', date_installed = '" & Me.txt_y_dated.Text & "', city= '" & Me.cmb_y_city.Text & "',subdivision = '" & Me.txt_y_subdiv.Text & "', service_wo_no  = '" & Me.txt_y_serno.Text & "', pipe_size= '" & Replace(Me.cmb_y_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_y_pipekind.Text & "', pressure = '" & Me.cmb_y_pressure.Text & "' ,size_of_tap = '" & Replace(Me.cmb_y_tapzize.Text, "'", "''") & "',length_main_to_curb_valve_ft = '" & Replace(Me.txt_y_ser_ft.Text, "'", "''") & "', length_main_to_curb_valve_in = '" & Replace(Me.txt_y_ser_in.Text, "'", "''") & "', length_curb_valve_to_property_line_ft = '" & Replace(Me.txt_y_depser_ft.Text, "'", "''") & "', length_curb_valve_to_property_line_in = '" & Replace(Me.txt_y_depser_in.Text, "'", "''") & "', length_main_to_property_line_ft = '" & Replace(Me.txt_y_mainln_ft.Text, "'", "''") & "', length_main_to_property_line_in = '" & Replace(Me.txt_y_mainln_in.Text, "'", "''") & "', length_property_line_to_meter_ft = '" & Replace(Me.txt_y_propln_ft.Text, "'", "''") & "', length_property_line_to_meter_in = '" & Replace(Me.txt_y_propln_in.Text, "'", "''") & "', size_of_main = '" & Replace(Me.cmb_y_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_y_maintype.Text, "'", "''") & "',depth_of_main = '" & Me.txt_y_deptmain.Text & "', tested_with = '" & Me.cmb_y_testedwith.Text & "', tested_to = '" & Me.cmb_y_testedto.Text & "', psig_for_minutes = '" & Me.txt_y_psigmin.Text & "', installed_by_contractor = '" & Me.txt_y_installedby.Text & "', foreman = '" & Me.txt_y_foreman.Text & "', remark = '" & Replace(Me.txt_y_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_y_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
                'ElseIf cmb_formtype.Text.Trim = "ORIGINAL" Then
                '    sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_q_add1.Text & "',add_prefix = '" & cmb_q_add2.Text & "',add_prefix_2 = '" & cmb_q_add2_1.Text & "',add_streetname = '" & cmb_q_add3.Text & "',add_suffix = '" & cmb_q_add4_1.Text & "', street_suffix_cd = '" & cmb_q_add4.Text & "',  date_installed = '" & Me.txt_q_dated.Text & "', city= '" & Me.cmb_q_city.Text & "', pipe_size= '" & Replace(Me.cmb_q_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_q_pipekind.Text & "',  size_of_main = '" & Replace(Me.cmb_q_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_q_maintype.Text, "'", "''") & "', tested_with = '" & Me.cmb_q_testedwith.Text & "', tested_to = '" & Me.cmb_q_testedto.Text & "', psig_for_minutes = '" & Me.txt_q_psigmin.Text & "',  remark = '" & Replace(Me.txt_q_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_q_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' ,  type_coating	 = '" & Replace(cmb_q_coating.Text, "'", "''") & "', lenmtrtomain	 = '" & Replace(Me.txt_q_lenmtrtomain.Text, "'", "''") & "', f_noblow = '" & chk_q_noblow.Checked.ToString & "', f_defcoatcor = '" & chk_q_defcoatcor.Checked.ToString & "',f_multimeter = '" & chk_q_multimeter.Checked.ToString & "',f_serstop = '" & chk_q_serstop.Checked.ToString & "', f_cathodpro = '" & chk_q_cathodpro.Checked.ToString & "', f_tee = '" & chk_q_tee.Checked.ToString & "', f_taptee = '" & chk_q_taptee.Checked.ToString & "' ,f_galvanized = '" & chk_q_galvanized.Checked.ToString & "' , tap_t_size = '" & Replace(Me.txt_q_ttsize.Text, "'", "''") & "', tap_t_inlet = '" & Replace(Me.txt_q_ttinlet.Text, "'", "''") & "', tap_t_outlet = '" & Replace(Me.txt_q_ttoutlet.Text, "'", "''") & "', f_insulated = '" & chk_q_insulated.Checked.ToString & "', f_anoderiser = '" & chk_q_anoderiser.Checked.ToString & "', otheranode_lbs = '" & Replace(Me.txt_q_otheranode.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
                'ElseIf cmb_formtype.Text.Trim = "MISC" Then
                '    sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_l_add1.Text & "',add_prefix = '" & cmb_l_add2.Text & "',add_prefix_2 = '" & cmb_l_add2_1.Text & "',add_streetname = '" & cmb_l_add3.Text & "',add_suffix = '" & cmb_l_add4_1.Text & "', street_suffix_cd = '" & cmb_l_add4.Text & "',   city= '" & Me.cmb_l_city.Text & "',   remark = '" & Replace(Me.txt_l_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_l_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' ,   misc_card_type = '" & Me.cmb_l_misCtype.Text & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "'  where file_id = '" & Me.txt_fileid.Text.Trim & "'"
                'ElseIf cmb_formtype.Text.Trim = "ORIGINAL-R" Then
                '    sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_r_add1.Text & "',add_prefix = '" & cmb_r_add2.Text & "',add_prefix_2 = '" & cmb_r_add2_1.Text & "',add_streetname = '" & cmb_r_add3.Text & "',add_suffix = '" & cmb_r_add4_1.Text & "', street_suffix_cd = '" & cmb_r_add4.Text & "',  date_installed = '" & Me.txt_r_dated.Text & "', city= '" & Me.cmb_r_city.Text & "', pipe_size= '" & Replace(Me.cmb_r_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_r_pipekind.Text & "',  size_of_main = '" & Replace(Me.cmb_r_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_r_maintype.Text, "'", "''") & "', tested_with = '" & Me.cmb_r_testedwith.Text & "', tested_to = '" & Me.cmb_r_testedto.Text & "', psig_for_minutes = '" & Me.txt_r_psigmin.Text & "',  remark = '" & Replace(Me.txt_r_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_r_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "'  , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' , lenmtrtomain	 = '" & Replace(Me.txt_r_lenmtrtomain.Text, "'", "''") & "', f_noblow = '" & chk_r_noblow.Checked.ToString & "', f_defcoatcor = '" & chk_r_defcoatcor.Checked.ToString & "',f_serstop = '" & chk_r_serstop.Checked.ToString & "', f_cathodpro = '" & chk_r_cathodpro.Checked.ToString & "', tap_t_size = '" & Replace(Me.txt_r_ttsize.Text, "'", "''") & "', tap_t_inlet = '" & Replace(Me.txt_r_ttinlet.Text, "'", "''") & "', tap_t_outlet = '" & Replace(Me.txt_r_ttoutlet.Text, "'", "''") & "', f_insulated = '" & chk_r_insulated.Checked.ToString & "', f_anoderiser = '" & chk_r_anoderiser.Checked.ToString & "', otheranode_lbs = '" & Replace(Me.txt_r_otheranode.Text, "'", "''") & "' , connection_data = '" & Replace(Me.cmb_r_connection_data.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
                'ElseIf Me.cmb_formtype.Text = "ABANDON-II" Then
                '    sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_a_add1.Text & "',add_prefix = '" & cmb_a_add2.Text & "',add_prefix_2 = '" & cmb_a_add2_1.Text & "',add_streetname = '" & cmb_a_add3.Text & "',add_suffix = '" & cmb_a_add4_1.Text & "', street_suffix_cd = '" & cmb_a_add4.Text & "',  city= '" & Me.cmb_a_city.Text & "', size_of_main = '" & Replace(Me.cmb_a_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_a_maintype.Text, "'", "''") & "', tested_with = '" & Me.cmb_a_testedwith.Text & "',  installed_by_contractor = '" & Me.txt_a_installedby.Text & "',  remark = '" & Replace(Me.txt_a_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_a_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' , DATE_ABANDON = '" & Me.txt_a_dateabandon.Text & "', f_noblow = '" & chk_a_noblow.Checked.ToString & "' ,f_gassource = '" & chk_a_gassource.Checked.ToString & "' , f_tappingtee = '" & chk_a_tappingtee.Checked.ToString & "' , f_linesealed= '" & chk_a_linesealed.Checked.ToString & "' , lenmtrtomain	 = '" & Replace(Me.txt_a_lenmtrtomain.Text, "'", "''") & "', reason_of_abandon = '" & Replace(Me.cmb_a_reasonabandon.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
                'ElseIf Me.cmb_formtype.Text = "Form-X" Then
                '    sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_x_add1.Text & "',add_prefix = '" & cmb_x_add2.Text & "',add_prefix_2 = '" & cmb_x_add2_1.Text & "',add_streetname = '" & cmb_x_add3.Text & "',add_suffix = '" & cmb_x_add4_1.Text & "', street_suffix_cd = '" & cmb_x_add4.Text & "',  date_installed = '" & Me.txt_x_dated.Text & "', city= '" & Me.cmb_x_city.Text & "', pipe_size= '" & Replace(Me.cmb_x_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_x_pipekind.Text & "',  length_main_to_property_line_ft = '" & Replace(Me.txt_x_mainln_ft.Text, "'", "''") & "', length_main_to_property_line_in = '" & Replace(Me.txt_x_mainln_in.Text, "'", "''") & "', length_property_line_to_meter_ft = '" & Replace(Me.txt_x_propln_ft.Text, "'", "''") & "', length_property_line_to_meter_in = '" & Replace(Me.txt_x_propln_in.Text, "'", "''") & "', size_of_main = '" & Replace(Me.cmb_x_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_x_maintype.Text, "'", "''") & "', tested_with = '" & Me.cmb_x_testedwith.Text & "', tested_to = '" & Me.cmb_x_testedto.Text & "',  installed_by_contractor = '" & Me.txt_x_installedby.Text & "',  remark = '" & Replace(Me.txt_x_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_x_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' ,type_coating	 = '" & Replace(cmb_x_coating.Text, "'", "''") & "', lenmtrtomain	 = '" & Replace(Me.txt_x_lenmtrtomain.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
                'ElseIf Me.cmb_formtype.Text = "FORM-IX" Then
                '    sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_9_add1.Text & "',add_prefix = '" & cmb_9_add2.Text & "',add_prefix_2 = '" & cmb_9_add2_1.Text & "',add_streetname = '" & cmb_9_add3.Text & "',add_suffix = '" & cmb_9_add4_1.Text & "', street_suffix_cd = '" & cmb_9_add4.Text & "',  date_installed = '" & Me.txt_9_dated.Text & "', city= '" & Me.cmb_9_city.Text & "', service_wo_no  = '" & Me.txt_9_serno.Text & "', pipe_size= '" & Replace(Me.cmb_9_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_9_pipekind.Text & "', size_of_tap = '" & Replace(Me.cmb_9_tapzize.Text, "'", "''") & "',size_of_main = '" & Replace(Me.cmb_9_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_9_maintype.Text, "'", "''") & "',foreman = '" & Me.txt_9_foreman.Text & "', remark = '" & Replace(Me.txt_9_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_9_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' ,lenmtrtomain	 = '" & Replace(Me.txt_9_lenmtrtomain.Text, "'", "''") & "' ,type_coating	 = '" & Replace(cmb_9_coating.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
                'ElseIf Me.cmb_formtype.Text = "Orange" Then
                '    sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_3_add1.Text & "',add_prefix = '" & cmb_3_add2.Text & "',add_streetname = '" & cmb_3_add3.Text & "',add_suffix = '" & cmb_3_add4_1.Text & "', street_suffix_cd = '" & cmb_3_add4.Text & "', city= '" & Me.cmb_3_city.Text & "',  date_installed = '" & Me.txt_3_dated.Text & "',  service_wo_no  = '" & Me.txt_3_serno.Text & "', pipe_size= '" & Replace(Me.cmb_3_pipesize.Text, "'", "''") & "',pipe_type = '" & Replace(Me.cmb_3_pipekind.Text, "'", "''") & "', pressure = '" & Me.cmb_3_pressure.Text & "' ,size_of_tap = '" & Replace(Me.cmb_3_tapzize.Text, "'", "''") & "',length_main_to_curb_valve_ft = '" & Replace(Me.txt_3_ser_ft.Text, "'", "''") & "', length_curb_valve_to_property_line_ft = '" & Replace(Me.txt_3_depser_ft.Text, "'", "''") & "',  length_main_to_property_line_ft = '" & Replace(Me.txt_3_mainln_ft.Text, "'", "''") & "',  length_property_line_to_meter_ft = '" & Replace(Me.txt_3_propln_ft.Text, "'", "''") & "',  size_of_main = '" & Replace(Me.cmb_3_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_3_maintype.Text, "'", "''") & "',installed_by_contractor = '" & Me.txt_3_installedby.Text & "', remark = '" & Replace(Me.txt_3_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_3_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
                'ElseIf cmb_formtype.Text.Trim = "Form-954" Then
                '    sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_7_add1.Text & "',add_prefix = '" & cmb_7_add2.Text & "',add_prefix_2 = '" & cmb_7_add2_1.Text & "',add_streetname = '" & cmb_7_add3.Text & "',add_suffix = '" & cmb_7_add4_1.Text & "', street_suffix_cd = '" & cmb_7_add4.Text & "',  date_installed = '" & Me.txt_7_dated.Text & "', city= '" & Me.cmb_7_city.Text & "',  pipe_size= '" & Replace(Me.cmb_7_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_7_pipekind.Text & "', size_of_tap = '" & Replace(Me.cmb_7_tapzize.Text, "'", "''") & "', length_main_to_property_line_ft = '" & Replace(Me.txt_7_mainln_ft.Text, "'", "''") & "', length_main_to_property_line_in = '" & Replace(Me.txt_7_mainln_in.Text, "'", "''") & "',  size_of_main = '" & Replace(Me.cmb_7_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_7_maintype.Text, "'", "''") & "', remark = '" & Replace(Me.txt_7_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_7_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "', f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "'  ,lenmtrtomain	 = '" & Replace(Me.txt_7_lenmtrtomain.Text, "'", "''") & "'  ,nature_of_work	 = '" & Replace(cmb_7_naturework.Text, "'", "''") & "',kind_of_joint	 = '" & Replace(cmb_7_kindjoint.Text, "'", "''") & "',split_sleeve	 = '" & Replace(txt_7_splitsleeve.Text, "'", "''") & "',loc_of_cock	 = '" & Replace(txt_7_loccock.Text, "'", "''") & "',kind_of_box	 = '" & Replace(txt_7_kindbox.Text, "'", "''") & "',type_coating	 = '" & Replace(cmb_7_coating.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
                'ElseIf Me.cmb_formtype.Text = "White" Then
                '    sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "', file_type = '" & Me.cmb_formtype.Text & "', add_streetno = '" & Me.txt_w_add1.Text & "', add_prefix = '" & cmb_w_add2.Text & "', add_prefix_2 = '" & cmb_w_add2_1.Text & "', add_streetname = '" & cmb_w_add3.Text & "', add_suffix = '" & Me.cmb_w_add4_1.Text & "', street_suffix_cd = '" & cmb_w_add4.Text & "', date_installed = '" & Me.txt_w_dated.Text & "', city = '" & Me.cmb_w_city.Text & "', subdivision = '" & Me.txt_w_subdiv.Text & "', service_wo_no = '" & Me.txt_w_serno.Text & "', pipe_size = '" & Replace(Me.cmb_w_pipesize.Text, "'", "''") & "', pipe_type = '" & Replace(Me.cmb_w_pipekind.Text, "'", "''") & "', pressure = '" & Me.cmb_w_pressure.Text & "', size_of_tap = '" & Replace(cmb_w_tapzize.Text, "'", "''") & "', length_main_to_curb_valve_ft = '" & Replace(Me.txt_w_ser_ft.Text, "'", "''") & "',length_main_to_curb_valve_in = '" & Replace(Me.txt_w_ser_in.Text, "'", "''") & "', length_curb_valve_to_property_line_ft = '" & Replace(Me.txt_w_depser_ft.Text, "'", "''") & "', size_of_main = '" & Replace(cmb_w_mainsize.Text, "'", "''") & "', type_of_main = '" & Replace(Me.cmb_w_maintype.Text, "'", "''") & "', depth_of_main = '" & Replace(Me.txt_w_deptmain.Text, "'", "''") & "', tested_with = '" & Me.cmb_w_testedwith.Text & "', tested_to = '" & Me.cmb_w_testedto.Text & "', psig_for_minutes = '" & Me.txt_w_psigmin.Text & "', installed_by_contractor = '" & Me.txt_w_installedby.Text & "', foreman = '" & Me.txt_w_foreman.Text & "', remark = '" & Replace(Me.txt_w_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_w_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "',  f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
                'ElseIf cmb_formtype.Text = "Form235-B-702" Then
                '    sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_4_add1.Text & "',add_prefix = '" & cmb_4_add2.Text & "',add_prefix_2 = '" & cmb_4_add2_1.Text & "',add_streetname = '" & cmb_4_add3.Text & "',add_suffix = '" & cmb_4_add4_1.Text & "', street_suffix_cd = '" & cmb_4_add4.Text & "', date_installed = '" & Me.txt_4_dated.Text & "', city= '" & Me.cmb_4_city.Text & "', pipe_size= '" & Replace(Me.cmb_4_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_4_pipekind.Text & "', pressure = '" & Me.cmb_4_pressure.Text & "' , size_of_main = '" & Replace(Me.cmb_4_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_4_maintype.Text, "'", "''") & "',depth_of_main = '" & Me.txt_4_deptmain.Text & "', tested_with = '" & Me.cmb_4_testedwith.Text & "', tested_to = '" & Me.cmb_4_testedto.Text & "', psig_for_minutes = '" & Me.txt_4_psigmin.Text & "', installed_by_contractor = '" & Me.txt_4_installedby.Text & "', foreman = '" & Me.txt_4_foreman.Text & "', remark = '" & Replace(Me.txt_4_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_4_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "'  ,pipe_condition	 = '" & Replace(Me.cmb_4_condition.Text, "'", "''") & "' ,lenmtrtomain	 = '" & Replace(Me.txt_4_lenmtrtomain.Text, "'", "''") & "' ,sceginspect	 = '" & Replace(Me.txt_4_sceginspect.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
                'ElseIf Me.cmb_formtype.Text = "OD-9-6-38" Then
                '    sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_5_add1.Text & "',add_prefix = '" & cmb_5_add2.Text & "',add_prefix_2 = '" & cmb_5_add2_1.Text & "',add_streetname = '" & cmb_5_add3.Text & "',add_suffix = '" & cmb_5_add4_1.Text & "', street_suffix_cd = '" & cmb_5_add4.Text & "',  date_installed = '" & Me.txt_5_dated.Text & "', city= '" & Me.cmb_5_city.Text & "', service_wo_no  = '" & Me.txt_5_serno.Text & "', pipe_size= '" & Replace(Me.cmb_5_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_5_pipekind.Text & "', length_main_to_curb_valve_ft = '" & Replace(Me.txt_5_ser_ft.Text, "'", "''") & "',  length_curb_valve_to_property_line_ft = '" & Replace(Me.txt_5_depser_ft.Text, "'", "''") & "', length_property_line_to_meter_ft = '" & Replace(Me.txt_5_propln_ft.Text, "'", "''") & "',  remark = '" & Replace(Me.txt_5_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_5_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
                'ElseIf Me.cmb_formtype.Text = "Form-80I" Then
                '    sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_6_add1.Text & "',add_prefix = '" & cmb_6_add2.Text & "',add_prefix_2 = '" & cmb_6_add2_1.Text & "',add_streetname = '" & cmb_6_add3.Text & "',add_suffix = '" & cmb_6_add4_1.Text & "', street_suffix_cd = '" & cmb_6_add4.Text & "',  date_installed = '" & Me.txt_6_dated.Text & "', city= '" & Me.cmb_6_city.Text & "', pipe_size= '" & Replace(Me.cmb_6_pipesize.Text, "'", "''") & "',pipe_type = '" & Me.cmb_6_pipekind.Text & "', length_main_to_curb_valve_ft = '" & Replace(Me.txt_6_ser_ft.Text, "'", "''") & "', length_main_to_curb_valve_in = '" & Replace(Me.txt_6_ser_in.Text, "'", "''") & "', length_curb_valve_to_property_line_ft = '" & Replace(Me.txt_6_depser_ft.Text, "'", "''") & "', length_curb_valve_to_property_line_in = '" & Replace(Me.txt_6_depser_in.Text, "'", "''") & "',  size_of_main = '" & Replace(Me.cmb_6_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_6_maintype.Text, "'", "''") & "',depth_of_main = '" & Me.txt_6_deptmain.Text & "', tested_with = '" & Me.cmb_6_testedwith.Text & "', tested_to = '" & Me.cmb_6_testedto.Text & "', psig_for_minutes = '" & Me.txt_6_psigmin.Text & "', remark = '" & Replace(Me.txt_6_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_6_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' ,lenmtrtomain	 = '" & Replace(Me.txt_6_lenmtrtomain.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
                'ElseIf cmb_formtype.Text.Trim = "ABANDON-I" Then
                '    sql1 = "update tbl_servicewo set file_name = '" & Me.txt_filedesc.Text & "',file_type='" & Me.cmb_formtype.Text & "',add_streetno = '" & Me.txt_8_add1.Text & "',add_prefix = '" & cmb_8_add2.Text & "',add_prefix_2 = '" & cmb_8_add2_1.Text & "',add_streetname = '" & cmb_8_add3.Text & "',add_suffix = '" & cmb_8_add4_1.Text & "', street_suffix_cd = '" & cmb_8_add4.Text & "',  date_installed = '" & Me.txt_8_dated.Text & "', city= '" & Me.cmb_8_city.Text & "',   size_of_main = '" & Replace(Me.cmb_8_mainsize.Text, "'", "''") & "',type_of_main = '" & Replace(Me.cmb_8_maintype.Text, "'", "''") & "', remark = '" & Replace(Me.txt_8_remark.Text, "'", "''") & "' , PREMISE_NO = '" & Me.txt_8_premiseno.Text & "' , f_stub = '" & chk_stub.Checked.ToString & "' , f_inserted = '" & chk_inserted.Checked.ToString & "' , f_retired = '" & chk_retired.Checked.ToString & "', f_leak = '" & ckh_leak.Checked.ToString & "' ,  f_split = '" & chk_split.Checked.ToString & "' , f_relocate = '" & chk_relocate.Checked.ToString & "' , f_replace = '" & chk_replace.Checked.ToString & "' , DATE_ABANDON = '" & Me.txt_8_dateabandon.Text & "',type_coating	 = '" & Replace(cmb_8_coating.Text, "'", "''") & "' , STREET_LOCATION_1_CD = '" & Replace(cmb_loccd_1.Text, "'", "''") & "' , STREET_LOCATION_2_CD  = '" & Replace(txt_loccd_2.Text, "'", "''") & "' where file_id = '" & Me.txt_fileid.Text.Trim & "'"
                'End If
                Dim cmd As New SqlCommand(sql1, conn)
                cmd.CommandType = CommandType.StoredProcedure
                cmd.Parameters.AddWithValue("@file_id", file_id)
                cmd.Parameters.AddWithValue("@file_name", file_name)
                cmd.Parameters.AddWithValue("@file_type", file_type)
                cmd.Parameters.AddWithValue("@add_streetno", add_streetno)
                cmd.Parameters.AddWithValue("@add_prefix", add_prefix)
                cmd.Parameters.AddWithValue("@add_prefix_2", add_prefix_2)
                cmd.Parameters.AddWithValue("@add_streetname", add_streetname)
                cmd.Parameters.AddWithValue("@add_suffix", add_suffix)
                cmd.Parameters.AddWithValue("@street_suffix_cd", street_suffix_cd)
                cmd.Parameters.AddWithValue("@name", name)
                cmd.Parameters.AddWithValue("@date_installed", date_installed)
                cmd.Parameters.AddWithValue("@city", city)
                cmd.Parameters.AddWithValue("@subdivision", subdivision)
                cmd.Parameters.AddWithValue("@service_wo_no", service_wo_no)
                cmd.Parameters.AddWithValue("@pipe_size", pipe_size)
                cmd.Parameters.AddWithValue("@pipe_type", pipe_type)
                cmd.Parameters.AddWithValue("@pressure", pressure)
                cmd.Parameters.AddWithValue("@size_of_tap", size_of_tap)
                cmd.Parameters.AddWithValue("@length_main_to_curb_valve_ft", length_main_to_curb_valve_ft)
                cmd.Parameters.AddWithValue("@length_main_to_curb_valve_in", length_main_to_curb_valve_in)
                cmd.Parameters.AddWithValue("@length_curb_valve_to_property_line_ft", length_curb_valve_to_property_line_ft)
                cmd.Parameters.AddWithValue("@length_curb_valve_to_property_line_in", length_curb_valve_to_property_line_in)
                cmd.Parameters.AddWithValue("@length_main_to_property_line_ft", length_main_to_property_line_ft)
                cmd.Parameters.AddWithValue("@length_main_to_property_line_in", length_main_to_property_line_in)
                cmd.Parameters.AddWithValue("@length_property_line_to_meter_ft", length_property_line_to_meter_ft)
                cmd.Parameters.AddWithValue("@length_property_line_to_meter_in", length_property_line_to_meter_in)
                cmd.Parameters.AddWithValue("@size_of_main", size_of_main)
                cmd.Parameters.AddWithValue("@type_of_main", type_of_main)
                cmd.Parameters.AddWithValue("@depth_of_main", depth_of_main)
                cmd.Parameters.AddWithValue("@tested_with", tested_with)
                cmd.Parameters.AddWithValue("@tested_to", tested_to)
                cmd.Parameters.AddWithValue("@psig_for_minutes", psig_for_minutes)
                cmd.Parameters.AddWithValue("@installed_by_contractor", installed_by_contractor)
                cmd.Parameters.AddWithValue("@foreman", foreman)
                cmd.Parameters.AddWithValue("@remark", remark)
                cmd.Parameters.AddWithValue("@PREMISE_NO", PREMISE_NO)
                cmd.Parameters.AddWithValue("@f_stub", f_stub)
                cmd.Parameters.AddWithValue("@f_inserted", f_inserted)
                cmd.Parameters.AddWithValue("@f_retired", f_retired)
                cmd.Parameters.AddWithValue("@f_leak", f_leak)
                cmd.Parameters.AddWithValue("@f_split", f_split)
                cmd.Parameters.AddWithValue("@pipe_condition", pipe_condition)
                cmd.Parameters.AddWithValue("@lenmtrtomain", lenmtrtomain)
                cmd.Parameters.AddWithValue("@sceginspect", sceginspect)
                cmd.Parameters.AddWithValue("@nature_of_work", nature_of_work)
                cmd.Parameters.AddWithValue("@kind_of_joint", kind_of_joint)
                cmd.Parameters.AddWithValue("@split_sleeve", split_sleeve)
                cmd.Parameters.AddWithValue("@loc_of_cock", loc_of_cock)
                cmd.Parameters.AddWithValue("@kind_of_box", kind_of_box)
                cmd.Parameters.AddWithValue("@type_coating", type_coating)
                cmd.Parameters.AddWithValue("@DATE_ABANDON", DATE_ABANDON)
                cmd.Parameters.AddWithValue("@reason_of_abandon", reason_of_abandon)
                cmd.Parameters.AddWithValue("@f_noblow", f_noblow)
                cmd.Parameters.AddWithValue("@f_gassource", f_gassource)
                cmd.Parameters.AddWithValue("@f_tappingtee", f_tappingtee)
                cmd.Parameters.AddWithValue("@f_linesealed", f_linesealed)
                cmd.Parameters.AddWithValue("@f_defcoatcor", f_defcoatcor)
                cmd.Parameters.AddWithValue("@f_multimeter", f_multimeter)
                cmd.Parameters.AddWithValue("@f_serstop", f_serstop)
                cmd.Parameters.AddWithValue("@f_cathodpro", f_cathodpro)
                cmd.Parameters.AddWithValue("@f_tee", f_tee)
                cmd.Parameters.AddWithValue("@f_taptee", f_taptee)
                cmd.Parameters.AddWithValue("@f_galvanized", f_galvanized)
                cmd.Parameters.AddWithValue("@tap_t_size", tap_t_size)
                cmd.Parameters.AddWithValue("@tap_t_inlet", tap_t_inlet)
                cmd.Parameters.AddWithValue("@tap_t_outlet", tap_t_outlet)
                cmd.Parameters.AddWithValue("@f_insulated", f_insulated)
                cmd.Parameters.AddWithValue("@f_anoderiser", f_anoderiser)
                cmd.Parameters.AddWithValue("@otheranode_lbs", otheranode_lbs)
                cmd.Parameters.AddWithValue("@connection_data", connection_data)
                cmd.Parameters.AddWithValue("@misc_card_type", misc_card_type)
                cmd.Parameters.AddWithValue("@f_relocate", f_relocate)
                cmd.Parameters.AddWithValue("@f_replace", f_replace)
                cmd.Parameters.AddWithValue("@STREET_LOCATION_1_CD", STREET_LOCATION_1_CD)
                cmd.Parameters.AddWithValue("@STREET_LOCATION_2_CD", STREET_LOCATION_2_CD)

                'Update 100BLK
                cmd.Parameters.AddWithValue("@main_year_installed", main_installed_year)
                cmd.Parameters.AddWithValue("@a_ps_reading", a_ps_reading)
                cmd.Parameters.AddWithValue("@total_anodes_1", tot_anodes_1)
                cmd.Parameters.AddWithValue("@total_anodes_17", tot_anodes_17)
                cmd.Parameters.AddWithValue("@lr", lr)
                cmd.Parameters.AddWithValue("@inches_wc", inches_wc)
                'Update 200BLK
                cmd.Parameters.AddWithValue("@RetiredSize", RetiredSize)
                cmd.Parameters.AddWithValue("@UnitsRetired", UnitsRetired)
                cmd.Parameters.AddWithValue("@LengthRetired", LengthRetired)
                cmd.Parameters.AddWithValue("@RetiredQty", RetiredQty)
                cmd.Parameters.AddWithValue("@2LbSystem", LbSystem)

                cmd.ExecuteNonQuery()
                update_fileid_status(Me.txt_fileid.Text.Trim)
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try

        End If
        'End If
        If conn.State = ConnectionState.Open Then
            conn.Close()
        End If
    End Sub
    Private Sub btn_reset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_reset.Click
        Dim a As DialogResult = MsgBox("Are you sure to reset the record?", MsgBoxStyle.OkCancel, "Data Entry")
        If a = Windows.Forms.DialogResult.Cancel Then Exit Sub
        If btn_submit.Text.Trim = "SUBMIT" Then
            resetfiledata()
        ElseIf btn_submit.Text.Trim = "UPDATE" Then
            getfiledata(CInt(Me.txt_fileid.Text.Trim))
        End If
    End Sub
    Private Sub btn_pass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_pass.Click
        Dim a As DialogResult = MsgBox("Are you sure, you want to pass the record to supervisor?", MsgBoxStyle.OkCancel, "Data Entry")
        If a = Windows.Forms.DialogResult.Cancel Then Exit Sub
        add_data()
        If conn.State = ConnectionState.Closed Then
            conn.Open()
        End If
        Try
            Dim cmd As New SqlCommand("SO_FrmDataentry_Pass", conn)
            cmd.CommandType = CommandType.StoredProcedure

            cmd.Parameters.AddWithValue("@dataentryby", commonUser.Common.uID)
            cmd.Parameters.AddWithValue("@passedby", commonUser.Common.uID)
            cmd.Parameters.AddWithValue("@remark", Me.txt_passcomment.Text.Trim)
            cmd.Parameters.AddWithValue("@fileid", Me.txt_fileid.Text.Trim)
            'Dim cmd As New SqlCommand("update tbl_parent set status = 'P' , dataentry_date = getdate() ,  dataentry_by = " & commonUser.Common.uID & " , passed_date = getdate() ,  passed_by = " & commonUser.Common.uID & ", last_remark = '" & Me.txt_passcomment.Text.Trim & "' where file_id = " & Me.txt_fileid.Text.Trim & "", conn)
            cmd.ExecuteNonQuery()
            'btn_Update.Text = "Update"
            txt_passcomment.Text = ""
        Catch ex As Exception
        End Try
        If (getnext_fileid(CInt(Me.txt_fileid.Text.Trim)) > 0) Then
            getfiledetail(getnext_fileid(CInt(Me.txt_fileid.Text.Trim)))
        Else
            MsgBox("No More image files available.", MsgBoxStyle.Information, "Next Image")
        End If
        If conn.State = ConnectionState.Open Then
            conn.Close()
        End If
    End Sub
    Private Sub btn_rewind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_rewind.Click
        Dim file_id As Integer = CInt(getprev_fileid(Me.txt_fileid.Text.Trim))
        If file_id = 0 Then
            MsgBox("No Previous Record available.", MsgBoxStyle.Information, "Rewind Data")
            Exit Sub
        Else
            If conn.State = 0 Then
                conn.Open()
            End If
            Dim dr As SqlDataReader = Nothing
            cmd = New SqlCommand("SO_FrmDataentry_Rewind", conn)
            cmd.CommandType = CommandType.StoredProcedure
            cmd.Parameters.AddWithValue("@fileid", file_id)

            'cmd = New SqlCommand("select * from tbl_servicewo  where file_id = " & file_id, conn)
            dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
            If (dr.Read) Then
                Me.cmb_formtype.Text = dr(2).ToString


                ''Rewind 100BLK
                If dr(2).ToString = "FORM-100BLK" Then
                    txt_100b_add1.Text = dr(3).ToString
                    cmb_100b_add2.Text = dr(4).ToString
                    cmb_100b_add2_1.Text = dr(5).ToString
                    cmb_100b_add3.Text = dr(6).ToString
                    cmb_100b_add4_1.Text = dr(7).ToString
                    cmb_100b_add4.Text = dr(8).ToString
                    'txt_100b_name.Text = dr(9).ToString
                    If CDate(dr(10).ToString) = #1/1/1900# Then
                        txt_100b_dated.Text = ""
                    Else
                        txt_100b_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                    End If
                    If CDate(dr(50).ToString) = #1/1/1900# Then
                        txt_100b_dateabandon.Text = ""
                    Else
                        txt_100b_dateabandon.Text = Format(dr(50), "MM/dd/yyyy").ToString()
                    End If
                    cmb_100b_city.Text = dr(11).ToString
                    'txt_100b_subdiv.Text = dr(12).ToString
                    'txt_100b_serno.Text = dr(13).ToString
                    cmb_100b_pipesize.SelectedValue = dr(14).ToString
                    cmb_100b_pipekind.SelectedValue = dr(15).ToString
                    cmb_100b_pressure.SelectedValue = dr(16).ToString
                    cmb_100b_tapsize.SelectedValue = dr(17).ToString
                    'txt_100b_ser_ft.Text = dr(18).ToString
                    'txt_100b_ser_in.Text = dr(19).ToString
                    'txt_100b_depser_ft.Text = dr(20).ToString
                    'txt_100b_depser_in.Text = dr(21).ToString
                    txt_100b_mainln_ft.Text = dr(22).ToString
                    'txt_100b_mainln_in.Text = dr(23).ToString
                    txt_100b_propln_ft.Text = dr(24).ToString
                    'txt_100b_propln_in.Text = dr(25).ToString
                    cmb_100b_mainsize.SelectedValue = dr(26).ToString
                    cmb_100b_maintype.SelectedValue = dr(27).ToString
                    txt_100b_deptmain.Text = dr(28).ToString
                    cmb_100b_testedwith.SelectedValue = dr(29).ToString
                    cmb_100b_testedto.SelectedValue = dr(30).ToString
                    txt_100b_psigmin.Text = dr(31).ToString
                    'txt_100b_installedby.Text = dr(32).ToString
                    'txt_100b_foreman.Text = dr(33).ToString
                    txt_100b_remark.Text = dr(34).ToString
                    txt_100b_premiseno.Text = dr(35).ToString
                    txt_100b_lenmtrtomain.Text = dr(42).ToString

                    'chk_stub.Checked = dr(36).ToString
                    'chk_inserted.Checked = dr(37).ToString
                    'chk_retired.Checked = dr(38).ToString
                    'ckh_leak.Checked = dr(39).ToString
                    'chk_split.Checked = dr(40).ToString
                    'chk_relocate.Checked = dr(71).ToString
                    'chk_replace.Checked = dr(72).ToString
                    'cmb_loccd_1.Text = dr(73).ToString
                    'txt_loccd_2.Text = dr(74).ToString

                    txt_100b_installedyear.Text = dr(75).ToString
                    txt_100b_a_ps_reading.Text = dr(76).ToString
                    txt_100b_tot_anodes_1.Text = dr(77).ToString
                    txt_100b_tot_anodes_17.Text = dr(78).ToString
                    txt_100b_lr.Text = dr(79).ToString
                    txt_100b_incheswc.Text = dr(85).ToString
                    txt_100b_add1.Focus()

                    ''Rewind FORM-100BLK-MISC
                ElseIf dr(2).ToString = "FORM-100BLK-MISC" Then
                    txt_100b_m_add1.Text = dr(3).ToString
                    cmb_100b_m_add2.Text = dr(4).ToString
                    cmb_100b_m_add2_1.Text = dr(5).ToString
                    cmb_100b_m_add3.Text = dr(6).ToString
                    cmb_100b_m_add4_1.Text = dr(7).ToString
                    cmb_100b_m_add4.Text = dr(8).ToString
                    'txt_100b_m_name.Text = dr(9).ToString
                    If CDate(dr(10).ToString) = #1/1/1900# Then
                        txt_100b_m_dated.Text = ""
                    Else
                        txt_100b_m_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                    End If
                    If CDate(dr(50).ToString) = #1/1/1900# Then
                        txt_100b_m_dateabandon.Text = ""
                    Else
                        txt_100b_m_dateabandon.Text = Format(dr(50), "MM/dd/yyyy").ToString()
                    End If

                    cmb_100b_m_city.Text = dr(11).ToString
                    'txt_100b_m_subdiv.Text = dr(12).ToString
                    'txt_100b_m_serno.Text = dr(13).ToString
                    cmb_100b_m_pipesize.SelectedValue = dr(14).ToString
                    cmb_100b_m_pipekind.SelectedValue = dr(15).ToString
                    cmb_100b_m_pressure.SelectedValue = dr(16).ToString
                    cmb_100b_m_tapsize.SelectedValue = dr(17).ToString
                    'txt_100b_m_ser_ft.Text = dr(18).ToString
                    'txt_100b_m_ser_in.Text = dr(19).ToString
                    'txt_100b_m_depser_ft.Text = dr(20).ToString
                    'txt_100b_m_depser_in.Text = dr(21).ToString
                    txt_100b_m_mainln_ft.Text = dr(22).ToString
                    'txt_100b_m_mainln_in.Text = dr(23).ToString
                    txt_100b_m_propln_ft.Text = dr(24).ToString
                    'txt_100b_m_propln_in.Text = dr(25).ToString
                    cmb_100b_m_mainsize.SelectedValue = dr(26).ToString
                    cmb_100b_m_maintype.SelectedValue = dr(27).ToString
                    txt_100b_m_deptmain.Text = dr(28).ToString
                    cmb_100b_m_testedwith.SelectedValue = dr(29).ToString
                    cmb_100b_m_testedto.SelectedValue = dr(30).ToString
                    txt_100b_m_psigmin.Text = dr(31).ToString
                    'txt_100b_m_installedby.Text = dr(32).ToString
                    'txt_100b_m_foreman.Text = dr(33).ToString
                    txt_100b_m_remark.Text = dr(34).ToString
                    txt_100b_m_premiseno.Text = dr(35).ToString
                    txt_100b_m_lenmtrtomain.Text = dr(42).ToString

                    'chk_stub.Checked = dr(36).ToString
                    'chk_inserted.Checked = dr(37).ToString
                    'chk_retired.Checked = dr(38).ToString
                    'ckh_leak.Checked = dr(39).ToString
                    'chk_split.Checked = dr(40).ToString
                    'chk_relocate.Checked = dr(71).ToString
                    'chk_replace.Checked = dr(72).ToString
                    'cmb_loccd_1.Text = dr(73).ToString
                    'txt_loccd_2.Text = dr(74).ToString

                    txt_100b_m_installedyear.Text = dr(75).ToString
                    txt_100b_m_a_ps_reading.Text = dr(76).ToString
                    txt_100b_m_tot_anodes_1.Text = dr(77).ToString
                    txt_100b_m_tot_anodes_17.Text = dr(78).ToString
                    txt_100b_m_lr.Text = dr(79).ToString
                    txt_100b_m_incheswc.Text = dr(85).ToString
                    txt_100b_m_add1.Focus()

                    ''Rewind 200BLK
                ElseIf dr(2).ToString = "FORM-200BLK" Then
                    'txt_fileid.Text = ""
                    'txt_filedesc.Text = ""
                    'cmb_formtype.Text = ""
                    txthouseNo1.Text = dr(3).ToString
                    cmbPrefix11.Text = dr(4).ToString
                    cmbPrefix22.Text = dr(5).ToString
                    cmbStreetname1.Text = dr(6).ToString
                    cmbsuffix12.Text = dr(7).ToString
                    cmbsuffix22.Text = dr(8).ToString
                    'txt_y_name.Text = dr(9).ToString

                    If CDate(dr(10).ToString) = #1/1/1900# Then
                        txtDate1.Text = ""
                    Else
                        txtDate1.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                    End If
                    If CDate(dr(50).ToString) = #1/1/1900# Then
                        txt_Retired_date.Text = ""
                    Else
                        txt_Retired_date.Text = Format(dr(50), "MM/dd/yyyy").ToString()
                    End If

                    cmb_200b_city.Text = dr(11).ToString
                    cmb_pipe_size.SelectedValue = dr(14).ToString
                    cmb_typeofservice.SelectedValue = dr(15).ToString
                    cmbTapSize.SelectedValue = dr(17).ToString
                    txtmainToBackOfCurb.Text = dr(18).ToString
                    cmb_main_size.SelectedValue = dr(26).ToString
                    cmb_main_type.SelectedValue = dr(27).ToString
                    txtDepthMain.Text = dr(28).ToString
                    cmbMedium.SelectedValue = dr(29).ToString
                    cmbPressure.SelectedValue = dr(30).ToString
                    txt_length1.Text = dr(31).ToString
                    txt_Remarks.Text = dr(34).ToString
                    txt_200b_premiseno.Text = dr(35).ToString
                    txt_pipesize_length.Text = dr(42).ToString

                    chk2lbSystem.Checked = dr(80).ToString
                    'chk2lbSystemNo1.Checked = dr(112).ToString
                    txtPS_Reading.Text = dr(76).ToString
                    cmbRetiredSize.SelectedValue = dr(81).ToString
                    txtUnitsRetired.Text = dr(82).ToString
                    txtLengthRetired.Text = dr(83).ToString
                    txtRetiredQnty.Text = dr(84).ToString
                    txthouseNo1.Focus()
                    'chk_stub.Checked = dr(36).ToString
                    'chk_inserted.Checked = dr(37).ToString
                    'chk_retired.Checked = dr(38).ToString
                    'ckh_leak.Checked = dr(39).ToString
                    'chk_split.Checked = dr(40).ToString
                    'chk_relocate.Checked = dr(71).ToString
                    'chk_replace.Checked = dr(72).ToString
                    'cmb_loccd_1.Text = dr(73).ToString
                    'txt_loccd_2.Text = dr(74).ToString

                ElseIf dr(2).ToString = "FORM-200BLK_PAGE1" Then
                    txthouseNo.Text = dr(3).ToString
                    cmbPrefix1.Text = dr(4).ToString
                    cmbPrefix2.Text = dr(5).ToString
                    cmbStreetname.Text = dr(6).ToString
                    cmbsuffix1.Text = dr(7).ToString
                    cmbsuffix2.Text = dr(8).ToString
                    'txt_y_name.Text = dr(9).ToString

                    If CDate(dr(10).ToString) = #1/1/1900# Then
                        txtDate_p1.Text = ""
                    Else
                        txtDate_p1.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                    End If
                    If CDate(dr(50).ToString) = #1/1/1900# Then
                        txt_Retired_date_p1.Text = ""
                    Else
                        txt_Retired_date_p1.Text = Format(dr(50), "MM/dd/yyyy").ToString()
                    End If

                    cmb_200b_city_p1.Text = dr(11).ToString
                    cmb_pipe_size_p1.SelectedValue = dr(14).ToString
                    cmb_typeofservice_p1.SelectedValue = dr(15).ToString
                    cmbTapSize_p1.SelectedValue = dr(17).ToString
                    txtmainToBackOfCurb.Text = dr(18).ToString
                    cmb_main_size_p1.SelectedValue = dr(26).ToString
                    cmb_main_type_p1.SelectedValue = dr(27).ToString
                    txtDepthMain_p1.Text = dr(28).ToString
                    cmbMedium_p1.SelectedValue = dr(29).ToString
                    cmbPressure_p1.SelectedValue = dr(30).ToString
                    txt_length1_p1.Text = dr(31).ToString
                    txt_Remarks_p1.Text = dr(34).ToString
                    txt_200b_premiseno_p1.Text = dr(35).ToString
                    txt_pipesize_length_p1.Text = dr(42).ToString

                    chk2lbSystem_p1.Checked = dr(80).ToString
                    'chk2lbSystemNo1.Checked = dr(112).ToString
                    txtPS_Reading_p1.Text = dr(76).ToString
                    cmbRetiredSize_p1.SelectedValue = dr(81).ToString
                    txtUnitsRetired_p1.Text = dr(82).ToString
                    txtLengthRetired_p1.Text = dr(83).ToString
                    txtRetiredQnty_p1.Text = dr(84).ToString
                    txthouseNo.Focus()
                    'chk_stub.Checked = dr(36).ToString
                    'chk_inserted.Checked = dr(37).ToString
                    'chk_retired.Checked = dr(38).ToString
                    'ckh_leak.Checked = dr(39).ToString
                    'chk_split.Checked = dr(40).ToString
                    'chk_relocate.Checked = dr(71).ToString
                    'chk_replace.Checked = dr(72).ToString
                    'cmb_loccd_1.Text = dr(73).ToString
                    'txt_loccd_2.Text = dr(74).ToString

                ElseIf dr(2).ToString = "Yellow" Then
                    txt_y_add1.Text = dr(3).ToString
                    cmb_y_add2.Text = dr(4).ToString
                    cmb_y_add2_1.Text = dr(5).ToString
                    cmb_y_add3.Text = dr(6).ToString
                    cmb_y_add4_1.Text = dr(7).ToString
                    cmb_y_add4.Text = dr(8).ToString
                    'txt_y_name.Text = dr(9).ToString
                    txt_y_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                    cmb_y_city.Text = dr(11).ToString
                    txt_y_subdiv.Text = dr(12).ToString
                    txt_y_serno.Text = dr(13).ToString
                    cmb_y_pipesize.SelectedValue = dr(14).ToString
                    cmb_y_pipekind.SelectedValue = dr(15).ToString
                    cmb_y_pressure.SelectedValue = dr(16).ToString
                    cmb_y_tapzize.SelectedValue = dr(17).ToString
                    txt_y_ser_ft.Text = dr(18).ToString
                    txt_y_ser_in.Text = dr(19).ToString
                    txt_y_depser_ft.Text = dr(20).ToString
                    txt_y_depser_in.Text = dr(21).ToString
                    txt_y_mainln_ft.Text = dr(22).ToString
                    txt_y_mainln_in.Text = dr(23).ToString
                    txt_y_propln_ft.Text = dr(24).ToString
                    txt_y_propln_in.Text = dr(25).ToString
                    cmb_y_mainsize.SelectedValue = dr(26).ToString
                    cmb_y_maintype.SelectedValue = dr(27).ToString
                    txt_y_deptmain.Text = dr(28).ToString
                    cmb_y_testedwith.SelectedValue = dr(29).ToString
                    cmb_y_testedto.SelectedValue = dr(30).ToString
                    txt_y_psigmin.Text = dr(31).ToString
                    txt_y_installedby.Text = dr(32).ToString
                    txt_y_foreman.Text = dr(33).ToString
                    txt_y_remark.Text = dr(34).ToString
                    txt_y_premiseno.Text = dr(35).ToString
                    cmb_loccd_1.Text = dr(73).ToString
                    txt_loccd_2.Text = dr(74).ToString
                ElseIf dr(2).ToString = "ORIGINAL" Then
                    txt_q_add1.Text = dr(3).ToString
                    cmb_q_add2.Text = dr(4).ToString
                    cmb_q_add2_1.Text = dr(5).ToString
                    cmb_q_add3.Text = dr(6).ToString
                    cmb_q_add4_1.Text = dr(7).ToString
                    cmb_q_add4.Text = dr(8).ToString
                    txt_q_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                    cmb_q_city.Text = dr(11).ToString
                    cmb_q_pipesize.SelectedValue = dr(14).ToString
                    cmb_q_pipekind.SelectedValue = dr(15).ToString
                    cmb_q_mainsize.SelectedValue = dr(26).ToString
                    cmb_q_maintype.SelectedValue = dr(27).ToString
                    cmb_q_testedwith.SelectedValue = dr(29).ToString
                    cmb_q_testedto.SelectedValue = dr(30).ToString
                    txt_q_psigmin.Text = dr(31).ToString
                    txt_q_remark.Text = dr(34).ToString
                    txt_q_premiseno.Text = dr(35).ToString
                    txt_q_lenmtrtomain.Text = dr(42).ToString
                    cmb_q_coating.Text = dr(49).ToString
                    chk_q_noblow.Checked = dr(52).ToString
                    chk_q_defcoatcor.Checked = dr(56).ToString
                    chk_q_multimeter.Checked = dr(57).ToString
                    chk_q_serstop.Checked = dr(58).ToString
                    chk_q_cathodpro.Checked = dr(59).ToString
                    chk_q_tee.Checked = dr(60).ToString
                    chk_q_taptee.Checked = dr(61).ToString
                    chk_q_galvanized.Checked = dr(62).ToString
                    txt_q_ttsize.Text = dr(63).ToString
                    txt_q_ttinlet.Text = dr(64).ToString
                    txt_q_ttoutlet.Text = dr(65).ToString
                    chk_q_insulated.Checked = dr(66).ToString
                    chk_q_anoderiser.Checked = dr(67).ToString
                    txt_q_otheranode.Text = dr(68).ToString
                    cmb_loccd_1.Text = dr(73).ToString
                    txt_loccd_2.Text = dr(74).ToString
                ElseIf dr(2).ToString = "MISC" Then
                    txt_l_add1.Text = dr(3).ToString
                    cmb_l_add2.Text = dr(4).ToString
                    cmb_l_add2_1.Text = dr(5).ToString
                    cmb_l_add3.Text = dr(6).ToString
                    cmb_l_add4_1.Text = dr(7).ToString
                    cmb_l_add4.Text = dr(8).ToString
                    cmb_l_city.Text = dr(11).ToString
                    txt_l_remark.Text = dr(34).ToString
                    txt_l_premiseno.Text = dr(35).ToString
                    cmb_l_misCtype.Text = dr(70).ToString
                    cmb_loccd_1.Text = dr(73).ToString
                    txt_loccd_2.Text = dr(74).ToString
                ElseIf dr(2).ToString = "ORIGINAL-R" Then
                    txt_r_add1.Text = dr(3).ToString
                    cmb_r_add2.Text = dr(4).ToString
                    cmb_r_add2_1.Text = dr(5).ToString
                    cmb_r_add3.Text = dr(6).ToString
                    cmb_r_add4_1.Text = dr(7).ToString
                    cmb_r_add4.Text = dr(8).ToString
                    txt_r_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                    cmb_r_city.Text = dr(11).ToString
                    cmb_r_pipesize.SelectedValue = dr(14).ToString
                    cmb_r_pipekind.SelectedValue = dr(15).ToString
                    cmb_r_mainsize.SelectedValue = dr(26).ToString
                    cmb_r_maintype.SelectedValue = dr(27).ToString
                    cmb_r_testedwith.SelectedValue = dr(29).ToString
                    cmb_r_testedto.SelectedValue = dr(30).ToString
                    txt_r_psigmin.Text = dr(31).ToString
                    txt_r_remark.Text = dr(34).ToString
                    txt_r_premiseno.Text = dr(35).ToString
                    txt_r_lenmtrtomain.Text = dr(42).ToString
                    chk_r_noblow.Checked = dr(52).ToString
                    chk_r_defcoatcor.Checked = dr(56).ToString
                    chk_r_serstop.Checked = dr(58).ToString
                    chk_r_cathodpro.Checked = dr(59).ToString
                    txt_r_ttsize.Text = dr(63).ToString
                    txt_r_ttinlet.Text = dr(64).ToString
                    txt_r_ttoutlet.Text = dr(65).ToString
                    chk_r_insulated.Checked = dr(66).ToString
                    chk_r_anoderiser.Checked = dr(67).ToString
                    txt_r_otheranode.Text = dr(68).ToString
                    cmb_r_connection_data.Text = dr(69).ToString
                    cmb_loccd_1.Text = dr(73).ToString
                    txt_loccd_2.Text = dr(74).ToString
                ElseIf dr(2).ToString = "ABANDON-II" Then
                    txt_a_add1.Text = dr(3).ToString
                    cmb_a_add2.Text = dr(4).ToString
                    cmb_a_add2_1.Text = dr(5).ToString
                    cmb_a_add3.Text = dr(6).ToString
                    cmb_a_add4_1.Text = dr(7).ToString
                    cmb_a_add4.Text = dr(8).ToString
                    cmb_a_city.Text = dr(11).ToString
                    cmb_a_mainsize.SelectedValue = dr(26).ToString
                    cmb_a_maintype.SelectedValue = dr(27).ToString
                    cmb_a_testedwith.SelectedValue = dr(29).ToString
                    txt_a_installedby.Text = dr(32).ToString
                    txt_a_remark.Text = dr(34).ToString
                    txt_a_premiseno.Text = dr(35).ToString
                    txt_a_lenmtrtomain.Text = dr(42).ToString
                    txt_a_dateabandon.Text = Format(dr(50), "MM/dd/yyyy").ToString()
                    cmb_a_reasonabandon.SelectedValue = dr(51).ToString
                    chk_a_noblow.Checked = dr(52).ToString
                    chk_a_gassource.Checked = dr(53).ToString
                    chk_a_tappingtee.Checked = dr(54).ToString
                    chk_a_linesealed.Checked = dr(55).ToString
                    cmb_loccd_1.Text = dr(73).ToString
                    txt_loccd_2.Text = dr(74).ToString
                ElseIf dr(2).ToString = "Form-X" Then
                    txt_x_add1.Text = dr(3).ToString
                    cmb_x_add2.Text = dr(4).ToString
                    cmb_x_add2_1.Text = dr(5).ToString
                    cmb_x_add3.Text = dr(6).ToString
                    cmb_x_add4_1.Text = dr(7).ToString
                    cmb_x_add4.Text = dr(8).ToString
                    txt_x_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                    cmb_x_city.Text = dr(11).ToString
                    cmb_x_pipesize.SelectedValue = dr(14).ToString
                    cmb_x_pipekind.SelectedValue = dr(15).ToString
                    txt_x_mainln_ft.Text = dr(22).ToString
                    txt_x_mainln_in.Text = dr(23).ToString
                    txt_x_propln_ft.Text = dr(24).ToString
                    txt_x_propln_in.Text = dr(25).ToString
                    cmb_x_mainsize.SelectedValue = dr(26).ToString
                    cmb_x_maintype.SelectedValue = dr(27).ToString
                    cmb_x_testedwith.SelectedValue = dr(29).ToString
                    cmb_x_testedto.SelectedValue = dr(30).ToString
                    txt_x_installedby.Text = dr(32).ToString
                    txt_x_remark.Text = dr(34).ToString
                    txt_x_premiseno.Text = dr(35).ToString
                    txt_x_lenmtrtomain.Text = dr(42).ToString
                    cmb_x_coating.Text = dr(49).ToString
                    cmb_loccd_1.Text = dr(73).ToString
                    txt_loccd_2.Text = dr(74).ToString
                ElseIf dr(2).ToString = "FORM-IX" Then
                    txt_9_add1.Text = dr(3).ToString
                    cmb_9_add2.Text = dr(4).ToString
                    cmb_9_add2_1.Text = dr(5).ToString
                    cmb_9_add3.Text = dr(6).ToString
                    cmb_9_add4_1.Text = dr(7).ToString
                    cmb_9_add4.Text = dr(8).ToString
                    txt_9_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                    cmb_9_city.Text = dr(11).ToString
                    txt_9_serno.Text = dr(13).ToString
                    cmb_9_pipesize.SelectedValue = dr(14).ToString
                    cmb_9_pipekind.SelectedValue = dr(15).ToString
                    cmb_9_tapzize.SelectedValue = dr(17).ToString
                    cmb_9_mainsize.SelectedValue = dr(26).ToString
                    cmb_9_maintype.SelectedValue = dr(27).ToString
                    txt_9_foreman.Text = dr(33).ToString
                    txt_9_remark.Text = dr(34).ToString
                    txt_9_premiseno.Text = dr(35).ToString
                    txt_9_lenmtrtomain.Text = dr(42).ToString
                    cmb_9_coating.Text = dr(49).ToString
                    cmb_loccd_1.Text = dr(73).ToString
                    txt_loccd_2.Text = dr(74).ToString
                ElseIf cmb_formtype.Text.Trim = "Form-954" Then
                    txt_7_add1.Text = dr(3).ToString
                    cmb_7_add2.Text = dr(4).ToString
                    cmb_7_add2_1.Text = dr(5).ToString
                    cmb_7_add3.Text = dr(6).ToString
                    cmb_7_add4_1.Text = dr(7).ToString
                    cmb_7_add4.Text = dr(8).ToString
                    txt_7_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                    cmb_7_city.Text = dr(11).ToString
                    cmb_7_pipesize.SelectedValue = dr(14).ToString
                    cmb_7_pipekind.SelectedValue = dr(15).ToString
                    cmb_7_tapzize.SelectedValue = dr(17).ToString
                    txt_7_mainln_ft.Text = dr(22).ToString
                    txt_7_mainln_in.Text = dr(23).ToString
                    cmb_7_mainsize.SelectedValue = dr(26).ToString
                    cmb_7_maintype.SelectedValue = dr(27).ToString
                    txt_7_remark.Text = dr(34).ToString
                    txt_7_premiseno.Text = dr(35).ToString
                    txt_7_lenmtrtomain.Text = dr(42).ToString
                    cmb_7_naturework.SelectedValue = dr(44).ToString
                    cmb_7_kindjoint.SelectedValue = dr(45).ToString
                    txt_7_splitsleeve.Text = dr(46).ToString
                    txt_7_loccock.Text = dr(47).ToString
                    txt_7_kindbox.Text = dr(48).ToString
                    cmb_7_coating.Text = dr(49).ToString
                    cmb_loccd_1.Text = dr(73).ToString
                    txt_loccd_2.Text = dr(74).ToString
                ElseIf cmb_formtype.Text.Trim = "ABANDON-I" Then
                    txt_8_add1.Text = dr(3).ToString
                    cmb_8_add2.Text = dr(4).ToString
                    cmb_8_add2_1.Text = dr(5).ToString
                    cmb_8_add3.Text = dr(6).ToString
                    cmb_8_add4_1.Text = dr(7).ToString
                    cmb_8_add4.Text = dr(8).ToString

                    txt_8_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                    cmb_8_city.Text = dr(11).ToString

                    cmb_8_mainsize.SelectedValue = dr(26).ToString
                    cmb_8_maintype.SelectedValue = dr(27).ToString


                    txt_8_remark.Text = dr(34).ToString
                    txt_8_premiseno.Text = dr(35).ToString

                    cmb_8_coating.SelectedValue = dr(49).ToString
                    txt_8_dateabandon.Text = Format(dr(50), "MM/dd/yyyy").ToString()
                    cmb_loccd_1.Text = dr(73).ToString
                    txt_loccd_2.Text = dr(74).ToString
                ElseIf dr(2).ToString = "Form-80I" Then
                    'txt_fileid.Text = ""
                    'txt_filedesc.Text = ""
                    'cmb_formtype.Text = ""
                    txt_6_add1.Text = dr(3).ToString
                    cmb_6_add2.Text = dr(4).ToString
                    cmb_6_add2_1.Text = dr(5).ToString
                    cmb_6_add3.Text = dr(6).ToString
                    cmb_6_add4_1.Text = dr(7).ToString
                    cmb_6_add4.Text = dr(8).ToString

                    txt_6_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                    cmb_6_city.Text = dr(11).ToString

                    cmb_6_pipesize.SelectedValue = dr(14).ToString
                    cmb_6_pipekind.SelectedValue = dr(15).ToString

                    txt_6_ser_ft.Text = dr(18).ToString
                    txt_6_ser_in.Text = dr(19).ToString
                    txt_6_depser_ft.Text = dr(20).ToString
                    txt_6_depser_in.Text = dr(21).ToString

                    cmb_6_mainsize.SelectedValue = dr(26).ToString
                    cmb_6_maintype.SelectedValue = dr(27).ToString
                    txt_6_deptmain.Text = dr(28).ToString
                    cmb_6_testedwith.SelectedValue = dr(29).ToString
                    cmb_6_testedto.SelectedValue = dr(30).ToString
                    txt_6_psigmin.Text = dr(31).ToString

                    txt_6_remark.Text = dr(34).ToString
                    txt_6_premiseno.Text = dr(35).ToString
                    txt_6_lenmtrtomain.Text = dr(42).ToString
                    cmb_loccd_1.Text = dr(73).ToString
                    txt_loccd_2.Text = dr(74).ToString
                ElseIf dr(2).ToString = "OD-9-6-38" Then
                    'txt_fileid.Text = ""
                    'txt_filedesc.Text = ""
                    'cmb_formtype.Text = ""
                    txt_5_add1.Text = dr(3).ToString
                    cmb_5_add2.Text = dr(4).ToString
                    cmb_5_add2_1.Text = dr(5).ToString
                    cmb_5_add3.Text = dr(6).ToString
                    cmb_5_add4_1.Text = dr(7).ToString
                    cmb_5_add4.Text = dr(8).ToString
                    txt_5_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                    cmb_5_city.Text = dr(11).ToString
                    txt_5_serno.Text = dr(13).ToString
                    cmb_5_pipesize.SelectedValue = dr(14).ToString
                    cmb_5_pipekind.SelectedValue = dr(15).ToString
                    txt_5_ser_ft.Text = dr(18).ToString
                    txt_5_depser_ft.Text = dr(20).ToString
                    txt_5_propln_ft.Text = dr(24).ToString
                    txt_5_remark.Text = dr(34).ToString
                    txt_5_premiseno.Text = dr(35).ToString
                    cmb_loccd_1.Text = dr(73).ToString
                    txt_loccd_2.Text = dr(74).ToString
                ElseIf dr(2).ToString = "Form235-B-702" Then
                    'txt_fileid.Text = ""
                    'txt_filedesc.Text = ""
                    'cmb_formtype.Text = ""
                    txt_4_add1.Text = dr(3).ToString
                    cmb_4_add2.Text = dr(4).ToString
                    cmb_4_add2_1.Text = dr(5).ToString
                    cmb_4_add3.Text = dr(6).ToString
                    cmb_4_add4_1.Text = dr(7).ToString
                    cmb_4_add4.Text = dr(8).ToString
                    'txt_4_name.Text = dr(9).ToString
                    txt_4_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                    cmb_4_city.Text = dr(11).ToString
                    cmb_4_pipesize.SelectedValue = dr(14).ToString
                    cmb_4_pipekind.SelectedValue = dr(15).ToString
                    cmb_4_pressure.SelectedValue = dr(16).ToString
                    cmb_4_mainsize.SelectedValue = dr(26).ToString
                    cmb_4_maintype.SelectedValue = dr(27).ToString
                    txt_4_deptmain.Text = dr(28).ToString
                    cmb_4_testedwith.SelectedValue = dr(29).ToString
                    cmb_4_testedto.SelectedValue = dr(30).ToString
                    txt_4_psigmin.Text = dr(31).ToString
                    txt_4_installedby.Text = dr(32).ToString
                    txt_4_foreman.Text = dr(33).ToString
                    txt_4_remark.Text = dr(34).ToString
                    txt_4_premiseno.Text = dr(35).ToString
                    cmb_4_condition.Text = dr(41).ToString
                    txt_4_lenmtrtomain.Text = dr(42).ToString
                    txt_4_sceginspect.Text = dr(43).ToString
                    cmb_loccd_1.Text = dr(73).ToString
                    txt_loccd_2.Text = dr(74).ToString
                ElseIf dr(2).ToString = "Orange" Then
                    'txt_fileid.Text = ""
                    'txt_filedesc.Text = ""
                    'cmb_formtype.Text = ""
                    txt_3_add1.Text = dr(3).ToString
                    cmb_3_add2.Text = dr(4).ToString
                    cmb_3_add2_1.Text = dr(5).ToString
                    cmb_3_add3.Text = dr(6).ToString
                    cmb_3_add4_1.Text = dr(7).ToString
                    cmb_3_add4.Text = dr(8).ToString
                    txt_3_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                    cmb_3_city.Text = dr(11).ToString
                    txt_3_serno.Text = dr(13).ToString
                    cmb_3_pipesize.SelectedValue = dr(14).ToString
                    cmb_3_pipekind.SelectedValue = dr(15).ToString
                    cmb_3_pressure.SelectedValue = dr(16).ToString
                    cmb_3_tapzize.SelectedValue = dr(17).ToString
                    txt_3_ser_ft.Text = dr(18).ToString
                    txt_3_depser_ft.Text = dr(20).ToString
                    txt_3_mainln_ft.Text = dr(22).ToString
                    txt_3_propln_ft.Text = dr(24).ToString
                    cmb_3_mainsize.SelectedValue = dr(26).ToString
                    cmb_3_maintype.SelectedValue = dr(27).ToString
                    txt_3_installedby.Text = dr(32).ToString
                    txt_3_remark.Text = dr(34).ToString
                    txt_3_premiseno.Text = dr(35).ToString
                    cmb_loccd_1.Text = dr(73).ToString
                    txt_loccd_2.Text = dr(74).ToString
                ElseIf dr(2).ToString = "White" Then
                    'txt_fileid.Text = ""
                    'txt_filedesc.Text = ""
                    'cmb_formtype.Text = ""
                    txt_w_add1.Text = dr(3).ToString
                    cmb_w_add2.Text = dr(4).ToString
                    cmb_w_add2_1.Text = dr(5).ToString
                    cmb_w_add3.Text = dr(6).ToString
                    cmb_w_add4_1.Text = dr(7).ToString
                    cmb_w_add4.Text = dr(8).ToString
                    ' txt_w_name.Text = dr(9).ToString
                    txt_w_dated.Text = Format(dr(10), "MM/dd/yyyy").ToString()
                    cmb_w_city.Text = dr(11).ToString
                    txt_w_subdiv.Text = dr(12).ToString
                    txt_w_serno.Text = dr(13).ToString
                    cmb_w_pipesize.SelectedValue = dr(14).ToString
                    cmb_w_pipekind.SelectedValue = dr(15).ToString
                    cmb_w_pressure.SelectedValue = dr(16).ToString
                    cmb_w_tapzize.SelectedValue = dr(17).ToString
                    txt_w_ser_ft.Text = dr(18).ToString
                    txt_w_ser_in.Text = dr(19).ToString
                    txt_w_depser_ft.Text = dr(20).ToString
                    cmb_w_mainsize.SelectedValue = dr(26).ToString
                    cmb_w_maintype.SelectedValue = dr(27).ToString
                    txt_w_deptmain.Text = dr(28).ToString
                    cmb_w_testedwith.SelectedValue = dr(29).ToString
                    cmb_w_testedto.SelectedValue = dr(30).ToString
                    txt_w_psigmin.Text = dr(31).ToString
                    txt_w_installedby.Text = dr(32).ToString
                    txt_w_foreman.Text = dr(33).ToString
                    txt_w_remark.Text = dr(34).ToString
                    txt_w_premiseno.Text = dr(35).ToString
                    cmb_loccd_1.Text = dr(73).ToString
                    txt_loccd_2.Text = dr(74).ToString
                End If

                dr.Close()
            End If
        End If
    End Sub
    'Private Sub cmb_w_add4_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_w_add4.Leave
    '    Me.txt_w_premiseno.Text = Me.get_premiseno(Me.txt_w_add1.Text.Trim, cmb_w_add2.Text.Trim, cmb_w_add2_1.Text.Trim, cmb_w_add3.Text.Trim, cmb_w_add4.Text.Trim, cmb_w_add4_1.Text.Trim)
    'End Sub
    Private Sub txt_y_add1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs)
        'Fill_Streetname(Me.cmb_y_add3, Me.txt_y_add1.Text.Trim, cmb_y_add2.Text.Trim, cmb_y_add2_1.Text.Trim)

    End Sub
    Private Sub cmb_w_add3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_w_add3.Enter
        Fill_Streetname(Me.cmb_w_add3, Me.txt_w_add1.Text.Trim, cmb_w_add2.Text.Trim, Me.cmb_w_add2_1.Text.Trim)
    End Sub
    Private Sub cmb_w_add3_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_w_add3.Leave, cmb_w_add4_1.Leave
        Me.Fill_Streetprefix(Me.cmb_w_add4, Me.txt_w_add1.Text.Trim, cmb_w_add2.Text.Trim, cmb_w_add2_1.Text.Trim, cmb_w_add3.Text.Trim, cmb_w_add4_1.Text.Trim)
    End Sub
    Private Sub cmb_y_add3_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_y_add3.Leave
        Me.Fill_Streetprefix(Me.cmb_y_add4, Me.txt_y_add1.Text.Trim, cmb_y_add2.Text.Trim, cmb_y_add2_1.Text.Trim, cmb_y_add3.Text.Trim, cmb_w_add4_1.Text.Trim)
    End Sub
    Private Sub cmb_y_add3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_y_add3.Enter
        Fill_Streetname(Me.cmb_y_add3, Me.txt_y_add1.Text.Trim, cmb_y_add2.Text.Trim, cmb_y_add2_1.Text.Trim)

    End Sub

    'Private Sub cmb_y_add4_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_y_add4.Leave
    '    Me.txt_y_premiseno.Text = Me.get_premiseno(Me.txt_y_add1.Text.Trim, Me.cmb_y_add2.Text.Trim, cmb_y_add2_1.Text.Trim, cmb_y_add3.Text.Trim, cmb_y_add4.Text.Trim, cmb_y_add4_1.Text.Trim)

    'End Sub

    Private Sub cmb_y_add4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_y_add4.Enter
        Me.Fill_Streetprefix(Me.cmb_y_add4, Me.txt_y_add1.Text.Trim, Me.cmb_y_add2.Text.Trim, cmb_y_add2_1.Text.Trim, cmb_y_add3.Text.Trim, cmb_y_add4_1.Text.Trim)

    End Sub

    Private Sub cmb_w_add4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_w_add4.Enter
        Me.Fill_Streetprefix(Me.cmb_w_add4, Me.txt_w_add1.Text.Trim, cmb_w_add2.Text.Trim, cmb_w_add2_1.Text.Trim, cmb_w_add3.Text.Trim, cmb_w_add4_1.Text.Trim)

    End Sub

    Private Sub btn_quckview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_quckview.Click

        commonUser.Common.imageid = txt_fileid.Text.Trim
        Dim newquickview As New frm_quickview()
        newquickview.ShowDialog()
        newquickview.BringToFront()
        newquickview.Focus()
    End Sub
    Private Function get_max_duplicate_records_allowed(ByVal file_Id As Integer)
        Dim nos As Integer = 0
        If conn.State = 0 Then
            conn.Open()
        End If

        Dim SQLCmd As New SqlCommand
        SQLCmd.CommandText = "get_max_duplicate_records_allowed" ' Stored Procedure
        SQLCmd.CommandType = CommandType.StoredProcedure
        SQLCmd.Connection = conn
        SQLCmd.Parameters.AddWithValue("file_id", file_Id)

        Dim dr As SqlDataReader = Nothing
        'cmd = New SqlCommand(sqlst, conn)
        dr = SQLCmd.ExecuteReader(CommandBehavior.CloseConnection)
        If (dr.Read) Then
            nos = CInt(dr(0).ToString)
        Else
            nos = 0
        End If
        dr.Close()
        Return nos
    End Function
    Private Sub btn_create_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_create.Click
        Dim allowed_nos As Integer
        allowed_nos = get_max_duplicate_records_allowed(CInt(txt_fileid.Text.Trim))
        If txt_nos.Text.Trim > allowed_nos Or txt_nos.Text.Trim < 1 Then
            MessageBox.Show("Duplicate image records could not be created less than 1 or more than " & allowed_nos & " nos")
            txt_nos.Focus()
        Else

            Dim a As DialogResult = MsgBox("Are you sure, you want to create Duplicate image records?", MsgBoxStyle.OkCancel, "Data Entry")
            If a = Windows.Forms.DialogResult.Cancel Then Exit Sub
            Dim file_id, nos As Integer
            Try
                file_id = CInt(txt_fileid.Text.Trim)
                nos = CInt(txt_nos.Text.Trim)
            Catch ex As Exception
                MessageBox.Show("File ID or no of duplicate Numbers should be numeric.")
                Exit Sub
            End Try
            If conn.State = ConnectionState.Closed Then
                conn.Open()
            End If
            Try
                Dim cmd As New SqlCommand("AddDuplicateRecord", conn)
                cmd.CommandType = CommandType.StoredProcedure
                cmd.Parameters.Add(New SqlParameter("@file_id", file_id))
                cmd.Parameters.Add(New SqlParameter("@nos", nos))

                cmd.ExecuteNonQuery()
            Catch ex As Exception
                MsgBox(ex.ToString, MsgBoxStyle.Information, "Error!")
                Exit Sub
            Finally
                If conn.State = ConnectionState.Open Then
                    conn.Close()
                End If
            End Try


            'Dim file_id, fileid As Integer
            'file_id = txt_fileid.Text.Trim
            'fileid = file_id + 1
            'Dim i As Integer = 0
            'Do While Not i >= txt_nos.Text.Trim


            '    cmd = New SqlCommand("insert  tbl_parent  select " & fileid & ", * from (select file_name, file_type, city, street_name, drawer_no, seq_no, status, received_date, received_by, assigned_date, assigned_to, dataentry_date, dataentry_by, passed_date, passed_by,  qa_verify_date, qa_verify_by, submitted_date, submitted_by, last_remark, service_order from tbl_parent where file_id =" & file_id & "  ) q", conn)
            '    fileid = fileid + 1
            '    Try
            '        If conn.State = 0 Then
            '            conn.Open()
            '        End If
            '        cmd.ExecuteNonQuery()
            '    Catch ex As Exception

            '    End Try
            '    i = i + 1
            'Loop
            MessageBox.Show("Duplicate image records" & txt_nos.Text.Trim & "(nos) are created.")
            txt_nos.Text = 1
        End If
    End Sub
    Private Sub cmb_w_add2_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_w_add2_1.Leave, cmb_w_add2.Leave
        Fill_Streetname(Me.cmb_w_add3, Me.txt_w_add1.Text.Trim, Me.cmb_w_add2.Text.Trim, cmb_w_add2_1.Text.Trim)
    End Sub
    Private Sub cmb_y_add2_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_y_add2_1.Leave, cmb_y_add2.Leave
        'Fill_Streetname(Me.cmb_y_add3, Me.txt_y_add1.Text.Trim, cmb_y_add2.Text.Trim, cmb_y_add2_1.Text.Trim)
    End Sub
    Private Sub cmb_y_add4_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_y_add4_1.Leave
        Me.Fill_Streetprefix(Me.cmb_y_add4, Me.txt_y_add1.Text.Trim, cmb_y_add2.Text.Trim, cmb_y_add2_1.Text.Trim, cmb_y_add3.Text.Trim, cmb_y_add4_1.Text.Trim)
    End Sub
    Private Sub btn_flip_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If conn.State = 0 Then
            conn.Open()
        End If
        Dim file_desc As String
        file_desc = Me.txt_filedesc.Text.Trim
        Dim dr As SqlDataReader = Nothing
        Dim cmd As New SqlCommand("SO_FrmDataentry_Flip", conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@fileid", Me.txt_fileid.Text.Trim)
        cmd.Parameters.AddWithValue("@filedesc", file_desc)
        'cmd = New SqlCommand("select replace(substring(externalref,charindex('Page',externalref),25),'.tif','.pdf') as externalref from tbl_so_imagefiles where service_order = (select service_order from tbl_parent where file_id = " & Me.txt_fileid.Text.Trim & " ) and substring(externalref,charindex('Page',externalref),25) <> replace('" & file_desc & "','.pdf','.tif')", conn)
        dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        If (dr.Read) Then
            btn_flip.Enabled = True
            btn_flip2.Enabled = True
            AxPdf1.LoadFile(im_loc & dr(0).ToString)
            txt_filedesc.Text = dr(0).ToString
        End If
        dr.Close()
        If conn.State = ConnectionState.Open Then
            conn.Close()
        End If
    End Sub
    '---100 block  Address
    Private Sub cmb_100b_add2_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_100b_add2_1.Leave
        Fill_Streetname(Me.cmb_100b_add3, Me.txt_100b_add1.Text.Trim, cmb_100b_add2.Text.Trim, cmb_100b_add2_1.Text.Trim)
    End Sub
    Private Sub cmb_100b_add3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_100b_add3.Enter
        Fill_Streetname(Me.cmb_100b_add3, Me.txt_100b_add1.Text.Trim, cmb_100b_add2.Text.Trim, cmb_100b_add2_1.Text.Trim)
    End Sub
    Private Sub cmb_100b_add3_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_100b_add3.Leave
        Me.Fill_Streetprefix(Me.cmb_100b_add4, Me.txt_100b_add1.Text.Trim, cmb_100b_add2.Text.Trim, cmb_100b_add2_1.Text.Trim, cmb_100b_add3.Text.Trim, cmb_100b_add4_1.Text.Trim)
    End Sub
    Private Sub cmb_100b_add4_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_100b_add4_1.Leave
        Me.Fill_Streetprefix(Me.cmb_100b_add4, Me.txt_100b_add1.Text.Trim, cmb_100b_add2.Text.Trim, cmb_100b_add2_1.Text.Trim, cmb_100b_add3.Text.Trim, cmb_100b_add4_1.Text.Trim)
    End Sub
    Private Sub cmb_100b_add4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_100b_add4.Enter
        Me.Fill_Streetprefix(Me.cmb_100b_add4, Me.txt_100b_add1.Text.Trim, Me.cmb_100b_add2.Text.Trim, cmb_100b_add2_1.Text.Trim, cmb_100b_add3.Text.Trim, cmb_100b_add4_1.Text.Trim)
    End Sub
    Private Sub cmb_100b_add4_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_100b_add4.Leave
        Me.txt_100b_premiseno.Text = Me.get_premiseno(Me.txt_100b_add1.Text.Trim, Me.cmb_100b_add2.Text.Trim, cmb_100b_add2_1.Text.Trim, cmb_100b_add3.Text.Trim, cmb_100b_add4.Text.Trim, cmb_100b_add4_1.Text.Trim, cmb_loccd_1.Text.Trim, txt_loccd_2.Text.Trim)
    End Sub

    '--200 block Address
    Private Sub cmbPrefix22_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbPrefix22.Leave
        Fill_Streetname(Me.cmbStreetname1, Me.txthouseNo1.Text.Trim, cmbPrefix11.Text.Trim, cmbPrefix22.Text.Trim)
    End Sub
    Private Sub cmbStreetname1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbStreetname1.Enter
        Fill_Streetname(Me.cmbStreetname1, Me.txthouseNo1.Text.Trim, cmbPrefix11.Text.Trim, cmbPrefix22.Text.Trim)
    End Sub
    Private Sub cmbStreetname1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbStreetname1.Leave
        Me.Fill_Streetprefix(Me.cmbsuffix22, Me.txthouseNo1.Text.Trim, cmbPrefix11.Text.Trim, cmbPrefix22.Text.Trim, cmbStreetname1.Text.Trim, cmbsuffix12.Text.Trim)
    End Sub
    Private Sub cmbsuffix12_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbsuffix12.Leave
        Me.Fill_Streetprefix(Me.cmbsuffix22, Me.txthouseNo1.Text.Trim, cmbPrefix11.Text.Trim, cmbPrefix22.Text.Trim, cmbStreetname1.Text.Trim, cmbsuffix12.Text.Trim)
    End Sub
    Private Sub cmbsuffix22_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbsuffix22.Enter
        Me.Fill_Streetprefix(Me.cmbsuffix22, Me.txthouseNo1.Text.Trim, Me.cmbPrefix11.Text.Trim, cmbPrefix22.Text.Trim, cmbStreetname1.Text.Trim, cmbsuffix12.Text.Trim)
    End Sub
    Private Sub cmbsuffix22_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbsuffix22.Leave
        Me.txt_200b_premiseno.Text = Me.get_premiseno(Me.txthouseNo1.Text.Trim, Me.cmbPrefix11.Text.Trim, cmbPrefix22.Text.Trim, cmbStreetname1.Text.Trim, cmbsuffix22.Text.Trim, cmbsuffix12.Text.Trim, cmb_loccd_1.Text.Trim, txt_loccd_2.Text.Trim)
    End Sub

    ''FORM-100BLK-MISC Address
    Private Sub cmb_100b_m_add2_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_100b_m_add2_1.Leave
        Fill_Streetname(Me.cmb_100b_m_add3, Me.txt_100b_m_add1.Text.Trim, cmb_100b_m_add2.Text.Trim, cmb_100b_m_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_100b_m_add3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_100b_m_add3.Enter
        Fill_Streetname(Me.cmb_100b_m_add3, Me.txt_100b_m_add1.Text.Trim, cmb_100b_m_add2.Text.Trim, cmb_100b_m_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_100b_m_add3_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_100b_m_add3.Leave
        Me.Fill_Streetprefix(Me.cmb_100b_m_add4, Me.txt_100b_m_add1.Text.Trim, cmb_100b_m_add2.Text.Trim, cmb_100b_m_add2_1.Text.Trim, cmb_100b_m_add3.Text.Trim, cmb_100b_m_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_100b_m_add4_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_100b_m_add4_1.Leave
        Me.Fill_Streetprefix(Me.cmb_100b_m_add4, Me.txt_100b_m_add1.Text.Trim, cmb_100b_add2.Text.Trim, cmb_100b_add2_1.Text.Trim, cmb_100b_m_add3.Text.Trim, cmb_100b_m_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_100b_m_add4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_100b_m_add4.Enter
        Me.Fill_Streetprefix(Me.cmb_100b_m_add4, Me.txt_100b_m_add1.Text.Trim, Me.cmb_100b_m_add2.Text.Trim, cmb_100b_m_add2_1.Text.Trim, cmb_100b_m_add3.Text.Trim, cmb_100b_m_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_100b_m_add4_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_100b_m_add4.Leave
        Me.txt_100b_m_premiseno.Text = Me.get_premiseno(Me.txt_100b_m_add1.Text.Trim, Me.cmb_100b_m_add2.Text.Trim, cmb_100b_m_add2_1.Text.Trim, cmb_100b_m_add3.Text.Trim, cmb_100b_m_add4.Text.Trim, cmb_100b_m_add4_1.Text.Trim, cmb_loccd_1.Text.Trim, txt_loccd_2.Text.Trim)
    End Sub



    Private Sub cmb_3_add2_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_3_add2_1.Leave
        Fill_Streetname(Me.cmb_3_add3, Me.txt_3_add1.Text.Trim, cmb_3_add2.Text.Trim, cmb_3_add2_1.Text.Trim)
    End Sub
    Private Sub cmb_3_add3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_3_add3.Enter
        Fill_Streetname(Me.cmb_3_add3, Me.txt_3_add1.Text.Trim, cmb_3_add2.Text.Trim, cmb_3_add2_1.Text.Trim)
    End Sub
    Private Sub cmb_3_add3_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_3_add3.Leave
        Me.Fill_Streetprefix(Me.cmb_3_add4, Me.txt_3_add1.Text.Trim, cmb_3_add2.Text.Trim, cmb_3_add2_1.Text.Trim, cmb_3_add3.Text.Trim, cmb_3_add4_1.Text.Trim)
    End Sub
    Private Sub cmb_3_add4_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_3_add4_1.Leave
        Me.Fill_Streetprefix(Me.cmb_3_add4, Me.txt_3_add1.Text.Trim, cmb_3_add2.Text.Trim, cmb_3_add2_1.Text.Trim, cmb_3_add3.Text.Trim, cmb_3_add4_1.Text.Trim)
    End Sub
    Private Sub cmb_3_add4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_3_add4.Enter
        Me.Fill_Streetprefix(Me.cmb_3_add4, Me.txt_3_add1.Text.Trim, Me.cmb_3_add2.Text.Trim, cmb_3_add2_1.Text.Trim, cmb_3_add3.Text.Trim, cmb_3_add4_1.Text.Trim)
    End Sub
    'Private Sub cmb_3_add4_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_3_add4.Leave
    '    Me.txt_3_premiseno.Text = Me.get_premiseno(Me.txt_3_add1.Text.Trim, Me.cmb_3_add2.Text.Trim, cmb_3_add2_1.Text.Trim, cmb_3_add3.Text.Trim, cmb_3_add4.Text.Trim, cmb_3_add4_1.Text.Trim)
    'End Sub
    Private Sub cmb_4_add2_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_4_add2_1.Leave
        Fill_Streetname(Me.cmb_4_add3, Me.txt_4_add1.Text.Trim, cmb_4_add2.Text.Trim, cmb_4_add2_1.Text.Trim)
    End Sub
    Private Sub cmb_4_add3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_4_add3.Enter
        Fill_Streetname(Me.cmb_4_add3, Me.txt_4_add1.Text.Trim, cmb_4_add2.Text.Trim, cmb_4_add2_1.Text.Trim)
    End Sub
    Private Sub cmb_4_add3_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_4_add3.Leave
        Me.Fill_Streetprefix(Me.cmb_4_add4, Me.txt_4_add1.Text.Trim, cmb_4_add2.Text.Trim, cmb_4_add2_1.Text.Trim, cmb_4_add3.Text.Trim, cmb_4_add4_1.Text.Trim)
    End Sub
    Private Sub cmb_4_add4_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_4_add4_1.Leave
        Me.Fill_Streetprefix(Me.cmb_4_add4, Me.txt_4_add1.Text.Trim, cmb_4_add2.Text.Trim, cmb_4_add2_1.Text.Trim, cmb_4_add3.Text.Trim, cmb_4_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_4_add4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_4_add4.Enter
        Me.Fill_Streetprefix(Me.cmb_4_add4, Me.txt_4_add1.Text.Trim, Me.cmb_4_add2.Text.Trim, cmb_4_add2_1.Text.Trim, cmb_4_add3.Text.Trim, cmb_4_add4_1.Text.Trim)
    End Sub

    'Private Sub cmb_4_add4_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_4_add4.Leave
    '    Me.txt_4_premiseno.Text = Me.get_premiseno(Me.txt_4_add1.Text.Trim, Me.cmb_4_add2.Text.Trim, cmb_4_add2_1.Text.Trim, cmb_4_add3.Text.Trim, cmb_4_add4.Text.Trim, cmb_4_add4_1.Text.Trim)
    'End Sub

    Private Sub cmb_5_add2_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_5_add2_1.Leave
        Fill_Streetname(Me.cmb_5_add3, Me.txt_5_add1.Text.Trim, cmb_5_add2.Text.Trim, cmb_5_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_5_add3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_5_add3.Enter
        Fill_Streetname(Me.cmb_5_add3, Me.txt_5_add1.Text.Trim, cmb_5_add2.Text.Trim, cmb_5_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_5_add3_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_5_add3.Leave
        Me.Fill_Streetprefix(Me.cmb_5_add4, Me.txt_5_add1.Text.Trim, cmb_5_add2.Text.Trim, cmb_5_add2_1.Text.Trim, cmb_5_add3.Text.Trim, cmb_5_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_5_add4_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_5_add4_1.Leave
        Me.Fill_Streetprefix(Me.cmb_5_add4, Me.txt_5_add1.Text.Trim, cmb_5_add2.Text.Trim, cmb_5_add2_1.Text.Trim, cmb_5_add3.Text.Trim, cmb_5_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_5_add4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_5_add4.Enter
        Me.Fill_Streetprefix(Me.cmb_5_add4, Me.txt_5_add1.Text.Trim, Me.cmb_5_add2.Text.Trim, cmb_5_add2_1.Text.Trim, cmb_5_add3.Text.Trim, cmb_5_add4_1.Text.Trim)
    End Sub

    'Private Sub cmb_5_add4_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_5_add4.Leave
    '    Me.txt_5_premiseno.Text = Me.get_premiseno(Me.txt_5_add1.Text.Trim, Me.cmb_5_add2.Text.Trim, cmb_5_add2_1.Text.Trim, cmb_5_add3.Text.Trim, cmb_5_add4.Text.Trim, cmb_5_add4_1.Text.Trim)
    'End Sub

    Private Sub cmb_6_add2_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_6_add2_1.Leave
        Fill_Streetname(Me.cmb_6_add3, Me.txt_6_add1.Text.Trim, cmb_6_add2.Text.Trim, cmb_6_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_6_add3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_6_add3.Enter
        Fill_Streetname(Me.cmb_6_add3, Me.txt_6_add1.Text.Trim, cmb_6_add2.Text.Trim, cmb_6_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_6_add3_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_6_add3.Leave
        Me.Fill_Streetprefix(Me.cmb_6_add4, Me.txt_6_add1.Text.Trim, cmb_6_add2.Text.Trim, cmb_6_add2_1.Text.Trim, cmb_6_add3.Text.Trim, cmb_6_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_6_add4_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_6_add4_1.Leave
        Me.Fill_Streetprefix(Me.cmb_6_add4, Me.txt_6_add1.Text.Trim, cmb_6_add2.Text.Trim, cmb_6_add2_1.Text.Trim, cmb_6_add3.Text.Trim, cmb_6_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_6_add4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_6_add4.Enter
        Me.Fill_Streetprefix(Me.cmb_6_add4, Me.txt_6_add1.Text.Trim, Me.cmb_6_add2.Text.Trim, cmb_6_add2_1.Text.Trim, cmb_6_add3.Text.Trim, cmb_6_add4_1.Text.Trim)
    End Sub

    'Private Sub cmb_6_add4_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_6_add4.Leave
    '    Me.txt_6_premiseno.Text = Me.get_premiseno(Me.txt_6_add1.Text.Trim, Me.cmb_6_add2.Text.Trim, cmb_6_add2_1.Text.Trim, cmb_6_add3.Text.Trim, cmb_6_add4.Text.Trim, cmb_6_add4_1.Text.Trim)
    'End Sub

    Private Sub cmb_7_add2_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_7_add2_1.Leave
        Fill_Streetname(Me.cmb_7_add3, Me.txt_7_add1.Text.Trim, cmb_7_add2.Text.Trim, cmb_7_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_7_add3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_7_add3.Enter
        Fill_Streetname(Me.cmb_7_add3, Me.txt_7_add1.Text.Trim, cmb_7_add2.Text.Trim, cmb_7_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_7_add3_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_7_add3.Leave
        Me.Fill_Streetprefix(Me.cmb_7_add4, Me.txt_7_add1.Text.Trim, cmb_7_add2.Text.Trim, cmb_7_add2_1.Text.Trim, cmb_7_add3.Text.Trim, cmb_7_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_7_add4_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_7_add4_1.Leave
        Me.Fill_Streetprefix(Me.cmb_7_add4, Me.txt_7_add1.Text.Trim, cmb_7_add2.Text.Trim, cmb_7_add2_1.Text.Trim, cmb_7_add3.Text.Trim, cmb_7_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_7_add4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_7_add4.Enter
        Me.Fill_Streetprefix(Me.cmb_7_add4, Me.txt_7_add1.Text.Trim, Me.cmb_7_add2.Text.Trim, cmb_7_add2_1.Text.Trim, cmb_7_add3.Text.Trim, cmb_7_add4_1.Text.Trim)
    End Sub

    'Private Sub cmb_7_add4_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_7_add4.Leave
    '    Me.txt_7_premiseno.Text = Me.get_premiseno(Me.txt_7_add1.Text.Trim, Me.cmb_7_add2.Text.Trim, cmb_7_add2_1.Text.Trim, cmb_7_add3.Text.Trim, cmb_7_add4.Text.Trim, cmb_7_add4_1.Text.Trim)
    'End Sub

    Private Sub cmb_8_add4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_8_add4.Enter
        Me.Fill_Streetprefix(Me.cmb_8_add4, Me.txt_8_add1.Text.Trim, Me.cmb_8_add2.Text.Trim, cmb_8_add2_1.Text.Trim, cmb_8_add3.Text.Trim, cmb_8_add4_1.Text.Trim)
    End Sub

    'Private Sub cmb_8_add4_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_8_add4.Leave
    '    Me.txt_8_premiseno.Text = Me.get_premiseno(Me.txt_8_add1.Text.Trim, Me.cmb_8_add2.Text.Trim, cmb_8_add2_1.Text.Trim, cmb_8_add3.Text.Trim, cmb_8_add4.Text.Trim, cmb_8_add4_1.Text.Trim)
    'End Sub

    Private Sub cmb_8_add4_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_8_add4_1.Leave
        Me.Fill_Streetprefix(Me.cmb_8_add4, Me.txt_8_add1.Text.Trim, cmb_8_add2.Text.Trim, cmb_8_add2_1.Text.Trim, cmb_8_add3.Text.Trim, cmb_8_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_8_add3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_8_add3.Enter
        Fill_Streetname(Me.cmb_8_add3, Me.txt_8_add1.Text.Trim, cmb_8_add2.Text.Trim, cmb_8_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_8_add3_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_8_add3.Leave
        Me.Fill_Streetprefix(Me.cmb_8_add4, Me.txt_8_add1.Text.Trim, cmb_8_add2.Text.Trim, cmb_8_add2_1.Text.Trim, cmb_8_add3.Text.Trim, cmb_8_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_8_add2_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_8_add2_1.Leave
        Fill_Streetname(Me.cmb_8_add3, Me.txt_8_add1.Text.Trim, cmb_8_add2.Text.Trim, cmb_8_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_9_add2_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_9_add2_1.Leave
        Fill_Streetname(Me.cmb_9_add3, Me.txt_9_add1.Text.Trim, cmb_9_add2.Text.Trim, cmb_9_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_9_add3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_9_add3.Enter
        Fill_Streetname(Me.cmb_9_add3, Me.txt_9_add1.Text.Trim, cmb_9_add2.Text.Trim, cmb_9_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_9_add3_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_9_add3.Leave
        Me.Fill_Streetprefix(Me.cmb_9_add4, Me.txt_9_add1.Text.Trim, cmb_9_add2.Text.Trim, cmb_9_add2_1.Text.Trim, cmb_9_add3.Text.Trim, cmb_9_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_9_add4_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_9_add4_1.Leave
        Me.Fill_Streetprefix(Me.cmb_9_add4, Me.txt_9_add1.Text.Trim, cmb_9_add2.Text.Trim, cmb_9_add2_1.Text.Trim, cmb_9_add3.Text.Trim, cmb_9_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_9_add4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_9_add4.Enter
        Me.Fill_Streetprefix(Me.cmb_9_add4, Me.txt_9_add1.Text.Trim, Me.cmb_9_add2.Text.Trim, cmb_9_add2_1.Text.Trim, cmb_9_add3.Text.Trim, cmb_9_add4_1.Text.Trim)
    End Sub

    'Private Sub cmb_9_add4_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_9_add4.Leave
    '    Me.txt_9_premiseno.Text = Me.get_premiseno(Me.txt_9_add1.Text.Trim, Me.cmb_9_add2.Text.Trim, cmb_9_add2_1.Text.Trim, cmb_9_add3.Text.Trim, cmb_9_add4.Text.Trim, cmb_9_add4_1.Text.Trim)
    'End Sub


    Private Sub cmb_x_add2_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_x_add2_1.Leave
        Fill_Streetname(Me.cmb_x_add3, Me.txt_x_add1.Text.Trim, cmb_x_add2.Text.Trim, cmb_x_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_x_add3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_x_add3.Enter
        Fill_Streetname(Me.cmb_x_add3, Me.txt_x_add1.Text.Trim, cmb_x_add2.Text.Trim, cmb_x_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_x_add3_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_x_add3.Leave
        Me.Fill_Streetprefix(Me.cmb_x_add4, Me.txt_x_add1.Text.Trim, cmb_x_add2.Text.Trim, cmb_x_add2_1.Text.Trim, cmb_x_add3.Text.Trim, cmb_x_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_x_add4_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_x_add4_1.Leave
        Me.Fill_Streetprefix(Me.cmb_x_add4, Me.txt_x_add1.Text.Trim, cmb_x_add2.Text.Trim, cmb_x_add2_1.Text.Trim, cmb_x_add3.Text.Trim, cmb_x_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_x_add4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_x_add4.Enter
        Me.Fill_Streetprefix(Me.cmb_x_add4, Me.txt_x_add1.Text.Trim, Me.cmb_x_add2.Text.Trim, cmb_x_add2_1.Text.Trim, cmb_x_add3.Text.Trim, cmb_x_add4_1.Text.Trim)
    End Sub

    'Private Sub cmb_x_add4_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_x_add4.Leave
    '    Me.txt_x_premiseno.Text = Me.get_premiseno(Me.txt_x_add1.Text.Trim, Me.cmb_x_add2.Text.Trim, cmb_x_add2_1.Text.Trim, cmb_x_add3.Text.Trim, cmb_x_add4.Text.Trim, cmb_x_add4_1.Text.Trim)
    'End Sub

    Private Sub cmb_a_add2_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Fill_Streetname(Me.cmb_a_add3, Me.txt_a_add1.Text.Trim, cmb_a_add2.Text.Trim, cmb_a_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_a_add3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Fill_Streetname(Me.cmb_a_add3, Me.txt_a_add1.Text.Trim, cmb_a_add2.Text.Trim, cmb_a_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_a_add3_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Fill_Streetprefix(Me.cmb_a_add4, Me.txt_a_add1.Text.Trim, cmb_a_add2.Text.Trim, cmb_a_add2_1.Text.Trim, cmb_a_add3.Text.Trim, cmb_a_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_a_add4_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Fill_Streetprefix(Me.cmb_a_add4, Me.txt_a_add1.Text.Trim, cmb_a_add2.Text.Trim, cmb_a_add2_1.Text.Trim, cmb_a_add3.Text.Trim, cmb_a_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_a_add4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Fill_Streetprefix(Me.cmb_a_add4, Me.txt_a_add1.Text.Trim, Me.cmb_a_add2.Text.Trim, cmb_a_add2_1.Text.Trim, cmb_a_add3.Text.Trim, cmb_a_add4_1.Text.Trim)
    End Sub

    'Private Sub cmb_a_add4_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs)
    '    Me.txt_a_premiseno.Text = Me.get_premiseno(Me.txt_a_add1.Text.Trim, Me.cmb_a_add2.Text.Trim, cmb_a_add2_1.Text.Trim, cmb_a_add3.Text.Trim, cmb_a_add4.Text.Trim, cmb_a_add4_1.Text.Trim)
    'End Sub

    Private Sub cmb_a_add2_1_Leave_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_a_add2_1.Leave
        Fill_Streetname(Me.cmb_a_add3, Me.txt_a_add1.Text.Trim, cmb_a_add2.Text.Trim, cmb_a_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_a_add3_Enter_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_a_add3.Enter
        Fill_Streetname(Me.cmb_a_add3, Me.txt_a_add1.Text.Trim, cmb_a_add2.Text.Trim, cmb_a_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_a_add3_Leave_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_a_add3.Leave
        Me.Fill_Streetprefix(Me.cmb_a_add4, Me.txt_a_add1.Text.Trim, cmb_a_add2.Text.Trim, cmb_a_add2_1.Text.Trim, cmb_a_add3.Text.Trim, cmb_a_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_a_add4_1_Leave_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_a_add4_1.Leave
        Me.Fill_Streetprefix(Me.cmb_a_add4, Me.txt_a_add1.Text.Trim, cmb_a_add2.Text.Trim, cmb_a_add2_1.Text.Trim, cmb_a_add3.Text.Trim, cmb_a_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_a_add4_Enter_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_a_add4.Enter
        Me.Fill_Streetprefix(Me.cmb_a_add4, Me.txt_a_add1.Text.Trim, Me.cmb_a_add2.Text.Trim, cmb_a_add2_1.Text.Trim, cmb_a_add3.Text.Trim, cmb_a_add4_1.Text.Trim)
    End Sub

    'Private Sub cmb_a_add4_Leave_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_a_add4.Leave
    '    Me.txt_a_premiseno.Text = Me.get_premiseno(Me.txt_a_add1.Text.Trim, Me.cmb_a_add2.Text.Trim, cmb_a_add2_1.Text.Trim, cmb_a_add3.Text.Trim, cmb_a_add4.Text.Trim, cmb_a_add4_1.Text.Trim)
    'End Sub

    Private Sub cmb_q_add2_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_q_add2_1.Leave
        Fill_Streetname(Me.cmb_q_add3, Me.txt_q_add1.Text.Trim, cmb_q_add2.Text.Trim, cmb_q_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_q_add3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_q_add3.Enter
        Fill_Streetname(Me.cmb_q_add3, Me.txt_q_add1.Text.Trim, cmb_q_add2.Text.Trim, cmb_q_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_q_add3_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_q_add3.Leave
        Me.Fill_Streetprefix(Me.cmb_q_add4, Me.txt_q_add1.Text.Trim, cmb_q_add2.Text.Trim, cmb_q_add2_1.Text.Trim, cmb_q_add3.Text.Trim, cmb_q_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_q_add4_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_q_add4_1.Leave
        Me.Fill_Streetprefix(Me.cmb_q_add4, Me.txt_q_add1.Text.Trim, cmb_q_add2.Text.Trim, cmb_q_add2_1.Text.Trim, cmb_q_add3.Text.Trim, cmb_q_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_q_add4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_q_add4.Enter
        Me.Fill_Streetprefix(Me.cmb_q_add4, Me.txt_q_add1.Text.Trim, Me.cmb_q_add2.Text.Trim, cmb_q_add2_1.Text.Trim, cmb_q_add3.Text.Trim, cmb_q_add4_1.Text.Trim)
    End Sub

    'Private Sub cmb_q_add4_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_q_add4.Leave
    '    Me.txt_q_premiseno.Text = Me.get_premiseno(Me.txt_q_add1.Text.Trim, Me.cmb_q_add2.Text.Trim, cmb_q_add2_1.Text.Trim, cmb_q_add3.Text.Trim, cmb_q_add4.Text.Trim, cmb_q_add4_1.Text.Trim)
    'End Sub

    Private Sub btn_flip_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_flip.Click, btn_flip2.Click
        If conn.State = 0 Then
            conn.Open()
        End If
        Dim file_desc As String
        file_desc = Me.txt_filedesc.Text.Trim

        'Dim dr As SqlDataReader = Nothing
        'cmd = New SqlCommand("select replace(substring(externalref,charindex('Page',externalref),25),'.tif','.pdf') as externalref from tbl_so_imagefiles where service_order = (select service_order from tbl_parent where file_id = " & Me.txt_fileid.Text.Trim & " ) and substring(externalref,charindex('Page',externalref),25) <> replace('" & file_desc & "','.pdf','.tif')", conn)
        'dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        'If (dr.Read) Then
        '    btn_flip.Enabled = True
        '    btn_flip2.Enabled = True
        '    AxPdf1.LoadFile(im_loc & dr(0).ToString)
        '    txt_filedesc.Text = dr(0).ToString
        'End If


        Dim dr As SqlDataReader = Nothing
        Dim cmd As New SqlCommand("SO_FrmDataentry_Flip1", conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@imagelocation", im_location)
        cmd.Parameters.AddWithValue("@fileid", Me.txt_fileid.Text.Trim)
        cmd.Parameters.AddWithValue("@filedesc", file_desc)
        'cmd = New SqlCommand("select replace(substring(externalref,charindex('Page',externalref),25),'.tif','.pdf') as externalref1, replace(replace(replace(externalref,'.tif','.pdf'),'C:\export test\','" & im_location & "'), '\\scana\shares\apps\apps\filenet\efi\Gas Project Files\','" & im_location & "') as externalref from tbl_so_imagefiles where service_order = (select service_order from tbl_parent where file_id = " & Me.txt_fileid.Text.Trim & " ) and substring(externalref,charindex('Page',externalref),25) <> replace('" & file_desc & "','.pdf','.tif')", conn)
        dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        If (dr.Read) Then
            btn_flip.Enabled = True
            btn_flip2.Enabled = True
            AxPdf1.LoadFile(dr(1).ToString)
            txt_filedesc.Text = dr(0).ToString
        End If

        dr.Close()
        If conn.State = ConnectionState.Open Then
            conn.Close()
        End If
    End Sub
    Private Sub cmb_r_add2_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_r_add2_1.Leave
        Fill_Streetname(Me.cmb_r_add3, Me.txt_r_add1.Text.Trim, cmb_r_add2.Text.Trim, cmb_r_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_r_add3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_r_add3.Enter
        Fill_Streetname(Me.cmb_r_add3, Me.txt_r_add1.Text.Trim, cmb_r_add2.Text.Trim, cmb_r_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_r_add3_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_r_add3.Leave
        Me.Fill_Streetprefix(Me.cmb_r_add4, Me.txt_r_add1.Text.Trim, cmb_r_add2.Text.Trim, cmb_r_add2_1.Text.Trim, cmb_r_add3.Text.Trim, cmb_r_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_r_add4_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_r_add4_1.Leave
        Me.Fill_Streetprefix(Me.cmb_r_add4, Me.txt_r_add1.Text.Trim, cmb_r_add2.Text.Trim, cmb_r_add2_1.Text.Trim, cmb_r_add3.Text.Trim, cmb_r_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_r_add4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_r_add4.Enter
        Me.Fill_Streetprefix(Me.cmb_r_add4, Me.txt_r_add1.Text.Trim, Me.cmb_r_add2.Text.Trim, cmb_r_add2_1.Text.Trim, cmb_r_add3.Text.Trim, cmb_r_add4_1.Text.Trim)
    End Sub

    'Private Sub cmb_r_add4_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_r_add4.Leave
    '    Me.txt_r_premiseno.Text = Me.get_premiseno(Me.txt_r_add1.Text.Trim, Me.cmb_r_add2.Text.Trim, cmb_r_add2_1.Text.Trim, cmb_r_add3.Text.Trim, cmb_r_add4.Text.Trim, cmb_r_add4_1.Text.Trim)
    'End Sub

    Private Sub cmb_l_add2_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_l_add2_1.Leave
        Fill_Streetname(Me.cmb_l_add3, Me.txt_l_add1.Text.Trim, cmb_l_add2.Text.Trim, cmb_l_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_l_add3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_l_add3.Enter
        Fill_Streetname(Me.cmb_l_add3, Me.txt_l_add1.Text.Trim, cmb_l_add2.Text.Trim, cmb_l_add2_1.Text.Trim)
    End Sub

    Private Sub cmb_l_add3_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_l_add3.Leave
        Me.Fill_Streetprefix(Me.cmb_l_add4, Me.txt_l_add1.Text.Trim, cmb_l_add2.Text.Trim, cmb_l_add2_1.Text.Trim, cmb_l_add3.Text.Trim, cmb_l_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_l_add4_1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_l_add4_1.Leave
        Me.Fill_Streetprefix(Me.cmb_l_add4, Me.txt_l_add1.Text.Trim, cmb_l_add2.Text.Trim, cmb_l_add2_1.Text.Trim, cmb_l_add3.Text.Trim, cmb_l_add4_1.Text.Trim)
    End Sub

    Private Sub cmb_l_add4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_l_add4.Enter
        Me.Fill_Streetprefix(Me.cmb_l_add4, Me.txt_l_add1.Text.Trim, Me.cmb_l_add2.Text.Trim, cmb_l_add2_1.Text.Trim, cmb_l_add3.Text.Trim, cmb_l_add4_1.Text.Trim)
    End Sub

    'Private Sub cmb_l_add4_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_l_add4.Leave
    '    Me.txt_l_premiseno.Text = Me.get_premiseno(Me.txt_l_add1.Text.Trim, Me.cmb_l_add2.Text.Trim, cmb_l_add2_1.Text.Trim, cmb_l_add3.Text.Trim, cmb_l_add4.Text.Trim, cmb_l_add4_1.Text.Trim)
    'End Sub

    Private Sub BTN_READD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTN_READD.Click
        Dim file_id As Integer = CInt(getprev_fileid(Me.txt_fileid.Text.Trim))
        If file_id = 0 Then
            MsgBox("No Previous Record available.", MsgBoxStyle.Information, "Rewind Data")
            Exit Sub
        Else
            If conn.State = 0 Then
                conn.Open()
            End If
            Dim dr As SqlDataReader = Nothing
            cmd = New SqlCommand("SO_FrmDataentry_Rewind", conn)
            cmd.CommandType = CommandType.StoredProcedure
            cmd.Parameters.AddWithValue("@fileid", file_id)

            'cmd = New SqlCommand("select * from tbl_servicewo  where file_id = " & file_id, conn)
            dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
            If (dr.Read) Then

                If cmb_formtype.Text.Trim = "FORM-100BLK" Then

                    txt_100b_add1.Text = dr(3).ToString
                    cmb_100b_add2.Text = dr(4).ToString
                    cmb_100b_add2_1.Text = dr(5).ToString
                    cmb_100b_add3.Text = dr(6).ToString
                    cmb_100b_add4_1.Text = dr(7).ToString
                    cmb_100b_add4.Text = dr(8).ToString
                    cmb_100b_city.Text = dr(11).ToString
                    txt_100b_premiseno.Text = dr(35).ToString

                ElseIf cmb_formtype.Text.Trim = "FORM-100BLK-MISC" Then

                    txt_100b_m_add1.Text = dr(3).ToString
                    cmb_100b_m_add2.Text = dr(4).ToString
                    cmb_100b_m_add2_1.Text = dr(5).ToString
                    cmb_100b_m_add3.Text = dr(6).ToString
                    cmb_100b_m_add4_1.Text = dr(7).ToString
                    cmb_100b_m_add4.Text = dr(8).ToString
                    cmb_100b_m_city.Text = dr(11).ToString
                    txt_100b_m_premiseno.Text = dr(35).ToString

                ElseIf cmb_formtype.Text.Trim = "FORM-200BLK" Then

                    txthouseNo1.Text = dr(3).ToString
                    cmbPrefix11.Text = dr(4).ToString
                    cmbPrefix22.Text = dr(5).ToString
                    cmbStreetname1.Text = dr(6).ToString
                    cmbsuffix12.Text = dr(7).ToString
                    cmbsuffix22.Text = dr(8).ToString
                    cmb_200b_city.Text = dr(11).ToString
                    txt_200b_premiseno.Text = dr(35).ToString

                ElseIf Me.cmb_formtype.Text = "FORM-200BLK_PAGE1" Then

                    txthouseNo.Text = dr(3).ToString
                    cmbPrefix1.Text = dr(4).ToString
                    cmbPrefix2.Text = dr(5).ToString
                    cmbStreetname.Text = dr(6).ToString
                    cmbsuffix1.Text = dr(7).ToString
                    cmbsuffix2.Text = dr(8).ToString
                    cmb_200b_city_p1.Text = dr(11).ToString
                    txt_200b_premiseno_p1.Text = dr(35).ToString

                ElseIf cmb_formtype.Text.Trim = "Yellow" Then
                    txt_y_add1.Text = dr(3).ToString
                    cmb_y_add2.Text = dr(4).ToString
                    cmb_y_add2_1.Text = dr(5).ToString
                    cmb_y_add3.Text = dr(6).ToString
                    cmb_y_add4_1.Text = dr(7).ToString
                    cmb_y_add4.Text = dr(8).ToString
                    cmb_y_city.Text = dr(11).ToString
                    txt_y_premiseno.Text = dr(35).ToString

                ElseIf cmb_formtype.Text.Trim = "ORIGINAL" Then
                    txt_q_add1.Text = dr(3).ToString
                    cmb_q_add2.Text = dr(4).ToString
                    cmb_q_add2_1.Text = dr(5).ToString
                    cmb_q_add3.Text = dr(6).ToString
                    cmb_q_add4_1.Text = dr(7).ToString
                    cmb_q_add4.Text = dr(8).ToString
                    cmb_q_city.Text = dr(11).ToString
                    txt_q_premiseno.Text = dr(35).ToString
                ElseIf cmb_formtype.Text.Trim = "MISC" Then
                    txt_l_add1.Text = dr(3).ToString
                    cmb_l_add2.Text = dr(4).ToString
                    cmb_l_add2_1.Text = dr(5).ToString
                    cmb_l_add3.Text = dr(6).ToString
                    cmb_l_add4_1.Text = dr(7).ToString
                    cmb_l_add4.Text = dr(8).ToString
                    cmb_l_city.Text = dr(11).ToString
                    txt_l_premiseno.Text = dr(35).ToString

                ElseIf cmb_formtype.Text.Trim = "ORIGINAL-R" Then

                    txt_r_add1.Text = dr(3).ToString
                    cmb_r_add2.Text = dr(4).ToString
                    cmb_r_add2_1.Text = dr(5).ToString
                    cmb_r_add3.Text = dr(6).ToString
                    cmb_r_add4_1.Text = dr(7).ToString
                    cmb_r_add4.Text = dr(8).ToString
                    cmb_r_city.Text = dr(11).ToString
                    txt_r_premiseno.Text = dr(35).ToString

                ElseIf cmb_formtype.Text.Trim = "ABANDON-II" Then

                    txt_a_add1.Text = dr(3).ToString
                    cmb_a_add2.Text = dr(4).ToString
                    cmb_a_add2_1.Text = dr(5).ToString
                    cmb_a_add3.Text = dr(6).ToString
                    cmb_a_add4_1.Text = dr(7).ToString
                    cmb_a_add4.Text = dr(8).ToString
                    cmb_a_city.Text = dr(11).ToString
                    txt_a_premiseno.Text = dr(35).ToString



                ElseIf cmb_formtype.Text.Trim = "Form-X" Then

                    txt_x_add1.Text = dr(3).ToString
                    cmb_x_add2.Text = dr(4).ToString
                    cmb_x_add2_1.Text = dr(5).ToString
                    cmb_x_add3.Text = dr(6).ToString
                    cmb_x_add4_1.Text = dr(7).ToString
                    cmb_x_add4.Text = dr(8).ToString
                    cmb_x_city.Text = dr(11).ToString
                    txt_x_premiseno.Text = dr(35).ToString

                ElseIf cmb_formtype.Text.Trim = "FORM-IX" Then

                    txt_9_add1.Text = dr(3).ToString
                    cmb_9_add2.Text = dr(4).ToString
                    cmb_9_add2_1.Text = dr(5).ToString
                    cmb_9_add3.Text = dr(6).ToString
                    cmb_9_add4_1.Text = dr(7).ToString
                    cmb_9_add4.Text = dr(8).ToString

                    cmb_9_city.Text = dr(11).ToString
                    txt_9_premiseno.Text = dr(35).ToString

                ElseIf cmb_formtype.Text.Trim = "Form-954" Then
                    txt_7_add1.Text = dr(3).ToString
                    cmb_7_add2.Text = dr(4).ToString
                    cmb_7_add2_1.Text = dr(5).ToString
                    cmb_7_add3.Text = dr(6).ToString
                    cmb_7_add4_1.Text = dr(7).ToString
                    cmb_7_add4.Text = dr(8).ToString
                    cmb_7_city.Text = dr(11).ToString
                    txt_7_premiseno.Text = dr(35).ToString

                ElseIf cmb_formtype.Text.Trim = "ABANDON-I" Then
                    txt_8_add1.Text = dr(3).ToString
                    cmb_8_add2.Text = dr(4).ToString
                    cmb_8_add2_1.Text = dr(5).ToString
                    cmb_8_add3.Text = dr(6).ToString
                    cmb_8_add4_1.Text = dr(7).ToString
                    cmb_8_add4.Text = dr(8).ToString
                    cmb_8_city.Text = dr(11).ToString
                    txt_8_premiseno.Text = dr(35).ToString


                ElseIf cmb_formtype.Text.Trim = "Form-80I" Then
                    txt_6_add1.Text = dr(3).ToString
                    cmb_6_add2.Text = dr(4).ToString
                    cmb_6_add2_1.Text = dr(5).ToString
                    cmb_6_add3.Text = dr(6).ToString
                    cmb_6_add4_1.Text = dr(7).ToString
                    cmb_6_add4.Text = dr(8).ToString
                    cmb_6_city.Text = dr(11).ToString
                    txt_6_premiseno.Text = dr(35).ToString

                ElseIf cmb_formtype.Text.Trim = "OD-9-6-38" Then

                    txt_5_add1.Text = dr(3).ToString
                    cmb_5_add2.Text = dr(4).ToString
                    cmb_5_add2_1.Text = dr(5).ToString
                    cmb_5_add3.Text = dr(6).ToString
                    cmb_5_add4_1.Text = dr(7).ToString
                    cmb_5_add4.Text = dr(8).ToString
                    cmb_5_city.Text = dr(11).ToString
                    txt_5_premiseno.Text = dr(35).ToString

                ElseIf cmb_formtype.Text.Trim = "Form235-B-702" Then

                    txt_4_add1.Text = dr(3).ToString
                    cmb_4_add2.Text = dr(4).ToString
                    cmb_4_add2_1.Text = dr(5).ToString
                    cmb_4_add3.Text = dr(6).ToString
                    cmb_4_add4_1.Text = dr(7).ToString
                    cmb_4_add4.Text = dr(8).ToString
                    cmb_4_city.Text = dr(11).ToString
                    txt_4_premiseno.Text = dr(35).ToString

                ElseIf cmb_formtype.Text.Trim = "Orange" Then

                    txt_3_add1.Text = dr(3).ToString
                    cmb_3_add2.Text = dr(4).ToString
                    cmb_3_add2_1.Text = dr(5).ToString
                    cmb_3_add3.Text = dr(6).ToString
                    cmb_3_add4_1.Text = dr(7).ToString
                    cmb_3_add4.Text = dr(8).ToString
                    cmb_3_city.Text = dr(11).ToString
                    txt_3_premiseno.Text = dr(35).ToString
                ElseIf cmb_formtype.Text.Trim = "White" Then

                    txt_w_add1.Text = dr(3).ToString
                    cmb_w_add2.Text = dr(4).ToString
                    cmb_w_add2_1.Text = dr(5).ToString
                    cmb_w_add3.Text = dr(6).ToString
                    cmb_w_add4_1.Text = dr(7).ToString
                    cmb_w_add4.Text = dr(8).ToString
                    cmb_w_city.Text = dr(11).ToString
                    txt_w_premiseno.Text = dr(35).ToString

                    'End by Dinesh
                End If
                dr.Close()
            End If
        End If
    End Sub
    'Function get_premiseno_CITY(ByVal HOUSE_NO As String, ByVal ADDR_PREFIX_1 As String, ByVal ADDR_PREFIX_2 As String, ByVal STREET_NM As String, ByVal STREET_SUFFIX_CD As String, ByVal TOWN_NM As String)
    Function get_premiseno_CITY(ByVal HOUSE_NO As String, ByVal ADDR_PREFIX_1 As String, ByVal ADDR_PREFIX_2 As String, ByVal STREET_NM As String, ByVal STREET_SUFFIX_CD As String, ByVal TOWN_NM As String, ByVal ADDR_SUFFIX_CD As String, ByVal STREET_LOCATION_1_CD As String, ByVal STREET_LOCATION_2_CD As String)    
    Dim PREMISE_NO As String
        If conn.State = 0 Then
            conn.Open()
        End If
        Dim house As String
        Dim add_prefix1 As String
        Dim add_prefix2 As String
        Dim street As String
        Dim street_suf As String
        'If HOUSE_NO.Trim.Length = 0 Then
        '    ' MsgBox("Address does not matches. Check it again.", MsgBoxStyle.Information, "Address Exception")
        '    PREMISE_NO = ""
        '    Return PREMISE_NO
        '    Exit Function
        '    house = " HOUSE_NO is NULL "
        'Else
        '    house = " HOUSE_NO = '" & HOUSE_NO & "'"
        'End If

        'Dim TOWN As String

        'If TOWN_NM.Trim.Length = 0 Then
        '    ' MsgBox("Address does not matches. Check it again.", MsgBoxStyle.Information, "Address Exception")
        '    ''PREMISE_NO = ""
        '    ''Return PREMISE_NO
        '    ''Exit Function
        '    TOWN = " TOWN_NM is NULL "
        'Else
        '    TOWN = " TOWN_NM = '" & TOWN_NM & "'"
        'End If


        'Dim cities As String
        'If txt_div.Text.Trim = "CENTRAL" Then
        '    cities = "LOCAL_OFFICE_NO IN ('002' ,'005' ,'010', '008' ,'012' ,'014' ,'020' ,'053' ,'054' ,'083', '050' ) "
        'ElseIf txt_div.Text.Trim = "EASTERN" Then
        '    cities = "LOCAL_OFFICE_NO IN ('073', '075', '076', '084', '085', '086' )"
        'ElseIf txt_div.Text.Trim = "COASTAL" Then
        '    cities = "LOCAL_OFFICE_NO IN ('087','088','094')"
        'ElseIf txt_div.Text.Trim = "LOW COUNTRY" Then
        '    cities = "LOCAL_OFFICE_NO IN ('042', '060', '061', '065','080')"
        'ElseIf txt_div.Text.Trim = "SOUTHERN" Then
        '    cities = "LOCAL_OFFICE_NO IN ('023','070', '071', '080','090','091','020' ,'092','095')"
        'ElseIf txt_div.Text.Trim = "WESTERN" Then
        '    cities = "LOCAL_OFFICE_NO IN ('010', '011', '030', '031', '032', '033', '035', '050','052','055', '089')"
        'End If

        'If ADDR_PREFIX_1.Trim.Length = 0 Then
        '    add_prefix1 = " ADDR_PREFIX_1 is NULL "
        'Else
        '    add_prefix1 = " ADDR_PREFIX_1 = '" & ADDR_PREFIX_1 & "'"
        'End If
        'If ADDR_PREFIX_2.Trim.Length = 0 Then
        '    add_prefix2 = " ADDR_PREFIX_2 is NULL "
        'Else
        '    add_prefix2 = " ADDR_PREFIX_2 = '" & ADDR_PREFIX_2 & "'"
        'End If
        'If STREET_NM.Trim.Length = 0 Then
        '    street = " STREET_NM is NULL "
        'Else
        '    street = " STREET_NM = '" & STREET_NM & "'"
        'End If
        'If STREET_SUFFIX_CD.Trim.Length = 0 Then
        '    street_suf = " STREET_SUFFIX_CD is NULL "
        'Else
        '    street_suf = " STREET_SUFFIX_CD = '" & STREET_SUFFIX_CD & "'"
        'End If
        If HOUSE_NO.Trim.Length = 0 Then
            ' MsgBox("Address does not matches. Check it again.", MsgBoxStyle.Information, "Address Exception")
            PREMISE_NO = ""
            Return PREMISE_NO
            Exit Function
            house = ""
        Else
            house = HOUSE_NO
        End If

        Dim TOWN As String

        If TOWN_NM.Trim.Length = 0 Then
            ' MsgBox("Address does not matches. Check it again.", MsgBoxStyle.Information, "Address Exception")
            'PREMISE_NO = ""
            'Return PREMISE_NO
            ''Exit Function
            TOWN = ""
        Else
            TOWN = TOWN_NM
        End If

        Dim cities As String = ""
        If txt_div.Text.Trim = "Durham" Then
            cities = "DURHAM"
        ElseIf txt_div.Text.Trim = "Asheville" Then
            cities = "ASHEVILLE"
        ElseIf txt_div.Text.Trim = "Gastonia" Then
            cities = "GASTONIA"
        ElseIf txt_div.Text.Trim = "Raleigh" Then
            cities = "RALEIGH"

        ElseIf txt_div.Text.Trim = "CENTRAL" Then
            cities = "CENTRAL "
        ElseIf txt_div.Text.Trim = "EASTERN" Then
            cities = "EASTERN"
        ElseIf txt_div.Text.Trim = "COASTAL" Then
            cities = "COASTAL"
        ElseIf txt_div.Text.Trim = "LOW COUNTRY" Then
            cities = "LOW COUNTRY"
        ElseIf txt_div.Text.Trim = "SOUTHERN" Then
            cities = "SOUTHERN"
        ElseIf txt_div.Text.Trim = "WESTERN" Then
            cities = "WESTERN"
        End If

        If ADDR_PREFIX_1.Trim.Length = 0 Then
            add_prefix1 = ""
        Else
            add_prefix1 = ADDR_PREFIX_1
        End If
        If ADDR_PREFIX_2.Trim.Length = 0 Then
            add_prefix2 = ""
        Else
            add_prefix2 = ADDR_PREFIX_2
        End If
        If STREET_NM.Trim.Length = 0 Then
            street = ""
        Else
            street = STREET_NM
        End If
        If STREET_SUFFIX_CD.Trim.Length = 0 Then
            street_suf = ""
        Else
            street_suf = STREET_SUFFIX_CD
        End If

        Dim add_suf As String
        If ADDR_SUFFIX_CD.Trim.Length = 0 Then
            add_suf = ""
        Else
            add_suf = ADDR_SUFFIX_CD
        End If

        Dim st_loc_1_cd As String
        If STREET_LOCATION_1_CD.Trim.Length = 0 Then
            st_loc_1_cd = ""
        Else
            st_loc_1_cd = STREET_LOCATION_1_CD
        End If

        Dim st_loc_2_cd As String
        If STREET_LOCATION_2_CD.Trim.Length = 0 Then
            st_loc_2_cd = ""
        Else
            st_loc_2_cd = STREET_LOCATION_2_CD
        End If

        Dim dr As SqlDataReader = Nothing
        cmd = New SqlCommand("Get_premise_no_city", conn)
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@HOUSE_NO", house)
        cmd.Parameters.AddWithValue("@ADDR_PREFIX_1", add_prefix1)
        cmd.Parameters.AddWithValue("@ADDR_PREFIX_2", add_prefix2)
        cmd.Parameters.AddWithValue("@STREET_NM", street)
        cmd.Parameters.AddWithValue("@TOWN_NM", TOWN)
        cmd.Parameters.AddWithValue("@STREET_SUFFIX_CD", street_suf)
        cmd.Parameters.AddWithValue("@divison", cities)
        cmd.Parameters.AddWithValue("@ADDR_SUFFIX_CD", add_suf)
        cmd.Parameters.AddWithValue("@STREET_LOCATION_1_CD", st_loc_1_cd)
        cmd.Parameters.AddWithValue("@STREET_LOCATION_2_CD", st_loc_2_cd)

        'Dim dr As SqlDataReader = Nothing
        'cmd = New SqlCommand("select ISNULL(max(PREMISE_NO),0) from Address  where " & house & " and " & add_prefix1 & " and " & add_prefix2 & "  and " & street & " and " & street_suf & " and " & cities & " and " & TOWN, conn)
        dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
        If (dr.Read) Then
            If dr(0).ToString = 0 Then
                MsgBox("Address does not matches. Check it again.", MsgBoxStyle.Information, "Address Exception")
                PREMISE_NO = ""
            Else
                PREMISE_NO = dr(0).ToString
            End If
        Else
            PREMISE_NO = ""
        End If
        dr.Close()
        Return PREMISE_NO
    End Function

    Private Sub cmb_l_city_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_100b_m_city.Leave, cmb_200b_city.Leave, cmb_200b_city_p1.Leave, cmb_100b_city.Leave, cmb_y_city.Leave, cmb_l_city.Leave, cmb_q_city.Leave, cmb_r_city.Leave, cmb_a_city.Leave, cmb_x_city.Leave, cmb_9_city.Leave, cmb_8_city.Leave, cmb_7_city.Leave, cmb_6_city.Leave, cmb_5_city.Leave, cmb_4_city.Leave, cmb_3_city.Leave, cmb_w_city.Leave, Panel_200b_Page1.Leave
        'Private Sub cmb_l_city_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_y_city.Leave, cmb_l_city.Leave, cmb_q_city.Leave, cmb_r_city.Leave, cmb_a_city.Leave, cmb_x_city.Leave, cmb_9_city.Leave, cmb_8_city.Leave, cmb_7_city.Leave, cmb_6_city.Leave, cmb_5_city.Leave, cmb_4_city.Leave, cmb_3_city.Leave, cmb_w_city.Leave

        'FORM-100BLK
        If cmb_formtype.Text.Trim = "FORM-100BLK" Then
            Me.txt_100b_premiseno.Text = Me.get_premiseno_CITY(Me.txt_100b_add1.Text.Trim, Me.cmb_100b_add2.Text.Trim, cmb_100b_add2_1.Text.Trim, cmb_100b_add3.Text.Trim, cmb_100b_add4.Text.Trim, cmb_100b_city.Text.Trim, cmb_100b_add4_1.Text.Trim, cmb_loccd_1.Text.Trim, txt_loccd_2.Text.Trim)

            'FORM-100BLK-MISC
        ElseIf cmb_formtype.Text.Trim = "FORM-100BLK-MISC" Then
            Me.txt_100b_m_premiseno.Text = Me.get_premiseno_CITY(Me.txt_100b_m_add1.Text.Trim, Me.cmb_100b_m_add2.Text.Trim, cmb_100b_m_add2_1.Text.Trim, cmb_100b_m_add3.Text.Trim, cmb_100b_m_add4.Text.Trim, cmb_100b_m_city.Text.Trim, cmb_100b_m_add4_1.Text.Trim, cmb_loccd_1.Text.Trim, txt_loccd_2.Text.Trim)

            'FORM-200BLK
        ElseIf cmb_formtype.Text.Trim = "FORM-200BLK" Then
            Me.txt_200b_premiseno.Text = Me.get_premiseno_CITY(Me.txthouseNo1.Text.Trim, Me.cmbPrefix11.Text.Trim, cmbPrefix22.Text.Trim, cmbStreetname1.Text.Trim, cmbsuffix22.Text.Trim, cmb_200b_city.Text.Trim, cmbsuffix12.Text.Trim, cmb_loccd_1.Text.Trim, txt_loccd_2.Text.Trim)

        ElseIf cmb_formtype.Text.Trim = "FORM-200BLK_PAGE1" Then
            Me.txt_200b_premiseno_p1.Text = Me.get_premiseno_CITY(Me.txthouseNo.Text.Trim, Me.cmbPrefix1.Text.Trim, cmbPrefix2.Text.Trim, cmbStreetname.Text.Trim, cmbsuffix2.Text.Trim, cmb_200b_city_p1.Text.Trim, cmbsuffix1.Text.Trim, cmb_loccd_1.Text.Trim, txt_loccd_2.Text.Trim)


            'ElseIf cmb_formtype.Text.Trim = "Yellow" Then
            '    Me.txt_y_premiseno.Text = Me.get_premiseno_CITY(Me.txt_y_add1.Text.Trim, Me.cmb_y_add2.Text.Trim, cmb_y_add2_1.Text.Trim, cmb_y_add3.Text.Trim, cmb_y_add4.Text.Trim, cmb_y_city.Text.Trim)


            'ElseIf cmb_formtype.Text.Trim = "MISC" Then
            '    Me.txt_l_premiseno.Text = Me.get_premiseno_CITY(Me.txt_l_add1.Text.Trim, Me.cmb_l_add2.Text.Trim, cmb_l_add2_1.Text.Trim, cmb_l_add3.Text.Trim, cmb_l_add4.Text.Trim, cmb_l_city.Text.Trim)


            'ElseIf cmb_formtype.Text.Trim = "ORIGINAL" Then
            '    Me.txt_q_premiseno.Text = Me.get_premiseno_CITY(Me.txt_q_add1.Text.Trim, Me.cmb_q_add2.Text.Trim, cmb_q_add2_1.Text.Trim, cmb_q_add3.Text.Trim, cmb_q_add4.Text.Trim, cmb_q_city.Text.Trim)
            'ElseIf cmb_formtype.Text.Trim = "ORIGINAL-R" Then
            '    Me.txt_r_premiseno.Text = Me.get_premiseno_CITY(Me.txt_r_add1.Text.Trim, Me.cmb_r_add2.Text.Trim, cmb_r_add2_1.Text.Trim, cmb_r_add3.Text.Trim, cmb_r_add4.Text.Trim, cmb_r_city.Text.Trim)
            'ElseIf cmb_formtype.Text.Trim = "ABANDON-II" Then
            '    Me.txt_a_premiseno.Text = Me.get_premiseno_CITY(Me.txt_a_add1.Text.Trim, Me.cmb_a_add2.Text.Trim, cmb_a_add2_1.Text.Trim, cmb_a_add3.Text.Trim, cmb_a_add4.Text.Trim, cmb_a_city.Text.Trim)

            'ElseIf cmb_formtype.Text.Trim = "Form-X" Then
            '    Me.txt_x_premiseno.Text = Me.get_premiseno_CITY(Me.txt_x_add1.Text.Trim, Me.cmb_x_add2.Text.Trim, cmb_x_add2_1.Text.Trim, cmb_x_add3.Text.Trim, cmb_x_add4.Text.Trim, cmb_x_city.Text.Trim)

            'ElseIf cmb_formtype.Text.Trim = "FORM-IX" Then
            '    Me.txt_9_premiseno.Text = Me.get_premiseno_CITY(Me.txt_9_add1.Text.Trim, Me.cmb_9_add2.Text.Trim, cmb_9_add2_1.Text.Trim, cmb_9_add3.Text.Trim, cmb_9_add4.Text.Trim, cmb_9_city.Text.Trim)

            'ElseIf cmb_formtype.Text.Trim = "ABANDON-I" Then
            '    Me.txt_8_premiseno.Text = Me.get_premiseno_CITY(Me.txt_8_add1.Text.Trim, Me.cmb_8_add2.Text.Trim, cmb_8_add2_1.Text.Trim, cmb_8_add3.Text.Trim, cmb_8_add4.Text.Trim, cmb_8_city.Text.Trim)

            'ElseIf cmb_formtype.Text.Trim = "Form-954" Then
            '    Me.txt_7_premiseno.Text = Me.get_premiseno_CITY(Me.txt_7_add1.Text.Trim, Me.cmb_7_add2.Text.Trim, cmb_7_add2_1.Text.Trim, cmb_7_add3.Text.Trim, cmb_7_add4.Text.Trim, cmb_7_city.Text.Trim)
            'ElseIf cmb_formtype.Text.Trim = "Form-80I" Then
            '    Me.txt_6_premiseno.Text = Me.get_premiseno_CITY(Me.txt_6_add1.Text.Trim, Me.cmb_6_add2.Text.Trim, cmb_6_add2_1.Text.Trim, cmb_6_add3.Text.Trim, cmb_6_add4.Text.Trim, cmb_6_city.Text.Trim)

            'ElseIf cmb_formtype.Text.Trim = "White" Then
            '    Me.txt_w_premiseno.Text = Me.get_premiseno_CITY(Me.txt_w_add1.Text.Trim, Me.cmb_w_add2.Text.Trim, cmb_w_add2_1.Text.Trim, cmb_w_add3.Text.Trim, cmb_w_add4.Text.Trim, cmb_w_city.Text.Trim)

            'ElseIf cmb_formtype.Text.Trim = "Orange" Then
            '    Me.txt_3_premiseno.Text = Me.get_premiseno_CITY(Me.txt_3_add1.Text.Trim, Me.cmb_3_add2.Text.Trim, cmb_3_add2_1.Text.Trim, cmb_3_add3.Text.Trim, cmb_3_add4.Text.Trim, cmb_3_city.Text.Trim)

            'ElseIf cmb_formtype.Text.Trim = "Form235-B-702" Then
            '    Me.txt_4_premiseno.Text = Me.get_premiseno_CITY(Me.txt_4_add1.Text.Trim, Me.cmb_4_add2.Text.Trim, cmb_4_add2_1.Text.Trim, cmb_4_add3.Text.Trim, cmb_4_add4.Text.Trim, cmb_4_city.Text.Trim)

            'ElseIf cmb_formtype.Text.Trim = "OD-9-6-38" Then
            '    Me.txt_5_premiseno.Text = Me.get_premiseno_CITY(Me.txt_5_add1.Text.Trim, Me.cmb_5_add2.Text.Trim, cmb_5_add2_1.Text.Trim, cmb_5_add3.Text.Trim, cmb_5_add4.Text.Trim, cmb_5_city.Text.Trim)

        End If

    End Sub

    Private Sub btn_premiselookup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_premiselookup.Click
        Dim house_no As String = ""
        Dim ADDR_PREFIX_1 As String = ""
        Dim ADDR_PREFIX_2 As String = ""
        Dim STREET_NM As String = ""
        Dim ADDR_SUFFIX_CD As String = ""
        Dim STREET_SUFFIX_CD As String = ""
        Dim TOWN_NM As String = ""

       
        'FORM-100BLK
        If cmb_formtype.Text.Trim = "FORM-100BLK" Then
            house_no = txt_100b_add1.Text
            ADDR_PREFIX_1 = cmb_100b_add2.Text
            ADDR_PREFIX_2 = cmb_100b_add2_1.Text
            STREET_NM = cmb_100b_add3.Text
            ADDR_SUFFIX_CD = cmb_100b_add4_1.Text
            STREET_SUFFIX_CD = cmb_100b_add4.Text
            TOWN_NM = cmb_100b_city.Text
            ' Me.txt_100b_premiseno.Text = ""

            'FORM-100BLK-MISC
        ElseIf cmb_formtype.Text.Trim = "FORM-100BLK-MISC" Then
            house_no = txt_100b_m_add1.Text
            ADDR_PREFIX_1 = cmb_100b_m_add2.Text
            ADDR_PREFIX_2 = cmb_100b_m_add2_1.Text
            STREET_NM = cmb_100b_m_add3.Text
            ADDR_SUFFIX_CD = cmb_100b_m_add4_1.Text
            STREET_SUFFIX_CD = cmb_100b_m_add4.Text
            TOWN_NM = cmb_100b_m_city.Text
            ' Me.txt_100b_m_premiseno.Text = ""

        'FORM-200BLK N
        ElseIf cmb_formtype.Text.Trim = "FORM-200BLK" Then
            house_no = txthouseNo1.Text
            ADDR_PREFIX_1 = cmbPrefix11.Text
            ADDR_PREFIX_2 = cmbPrefix22.Text
            STREET_NM = cmbStreetname1.Text
            ADDR_SUFFIX_CD = cmbsuffix12.Text
            STREET_SUFFIX_CD = cmbsuffix22.Text
            TOWN_NM = cmb_200b_city.Text
            '' Me.txt_200b_premiseno.Text = ""

        ElseIf cmb_formtype.Text.Trim = "FORM-200BLK_PAGE1" Then
            house_no = txthouseNo.Text
            ADDR_PREFIX_1 = cmbPrefix1.Text
            ADDR_PREFIX_2 = cmbPrefix2.Text
            STREET_NM = cmbStreetname.Text
            ADDR_SUFFIX_CD = cmbsuffix1.Text
            STREET_SUFFIX_CD = cmbsuffix2.Text
            TOWN_NM = cmb_200b_city_p1.Text
            '' Me.txt_200b_premiseno.Text = ""

        ElseIf cmb_formtype.Text.Trim = "Yellow" Then
            house_no = txt_y_add1.Text
            ADDR_PREFIX_1 = cmb_y_add2.Text
            ADDR_PREFIX_2 = cmb_y_add2_1.Text
            STREET_NM = cmb_y_add3.Text
            ADDR_SUFFIX_CD = cmb_y_add4_1.Text
            STREET_SUFFIX_CD = cmb_y_add4.Text
            TOWN_NM = cmb_y_city.Text
            ' Me.txt_y_premiseno.Text = ""

        ElseIf cmb_formtype.Text.Trim = "ORIGINAL" Then
            house_no = txt_q_add1.Text
            ADDR_PREFIX_1 = cmb_q_add2.Text
            ADDR_PREFIX_2 = cmb_q_add2_1.Text
            STREET_NM = cmb_q_add3.Text
            ADDR_SUFFIX_CD = cmb_q_add4_1.Text
            STREET_SUFFIX_CD = cmb_q_add4.Text
            TOWN_NM = cmb_q_city.Text
            ' Me.txt_q_premiseno.Text = ""
        ElseIf cmb_formtype.Text.Trim = "MISC" Then
            house_no = txt_l_add1.Text
            ADDR_PREFIX_1 = cmb_l_add2.Text
            ADDR_PREFIX_2 = cmb_l_add2_1.Text
            STREET_NM = cmb_l_add3.Text
            ADDR_SUFFIX_CD = cmb_l_add4_1.Text
            STREET_SUFFIX_CD = cmb_l_add4.Text
            TOWN_NM = cmb_l_city.Text
            'Me.txt_l_premiseno.Text = ""
        ElseIf cmb_formtype.Text.Trim = "ORIGINAL-R" Then
            house_no = txt_r_add1.Text
            ADDR_PREFIX_1 = cmb_r_add2.Text
            ADDR_PREFIX_2 = cmb_r_add2_1.Text
            STREET_NM = cmb_r_add3.Text
            ADDR_SUFFIX_CD = cmb_r_add4_1.Text
            STREET_SUFFIX_CD = cmb_r_add4.Text
            TOWN_NM = cmb_r_city.Text
            'Me.txt_r_premiseno.Text = ""
        ElseIf cmb_formtype.Text.Trim = "ABANDON-II" Then
            house_no = txt_a_add1.Text
            ADDR_PREFIX_1 = cmb_a_add2.Text
            ADDR_PREFIX_2 = cmb_a_add2_1.Text
            STREET_NM = cmb_a_add3.Text
            ADDR_SUFFIX_CD = cmb_a_add4_1.Text
            STREET_SUFFIX_CD = cmb_a_add4.Text
            TOWN_NM = cmb_a_city.Text
            'Me.txt_a_premiseno.Text = ""
        ElseIf cmb_formtype.Text.Trim = "Form-X" Then
            house_no = txt_x_add1.Text
            ADDR_PREFIX_1 = cmb_x_add2.Text
            ADDR_PREFIX_2 = cmb_x_add2_1.Text
            STREET_NM = cmb_x_add3.Text
            ADDR_SUFFIX_CD = cmb_x_add4_1.Text
            STREET_SUFFIX_CD = cmb_x_add4.Text
            TOWN_NM = cmb_x_city.Text
            'Me.txt_x_premiseno.Text = ""
        ElseIf cmb_formtype.Text.Trim = "FORM-IX" Then
            house_no = txt_9_add1.Text
            ADDR_PREFIX_1 = cmb_9_add2.Text
            ADDR_PREFIX_2 = cmb_9_add2_1.Text
            STREET_NM = cmb_9_add3.Text
            ADDR_SUFFIX_CD = cmb_9_add4_1.Text
            STREET_SUFFIX_CD = cmb_9_add4.Text
            TOWN_NM = cmb_9_city.Text
            'Me.txt_9_premiseno.Text = ""
        ElseIf cmb_formtype.Text.Trim = "Form-954" Then
            house_no = txt_7_add1.Text
            ADDR_PREFIX_1 = cmb_7_add2.Text
            ADDR_PREFIX_2 = cmb_7_add2_1.Text
            STREET_NM = cmb_7_add3.Text
            ADDR_SUFFIX_CD = cmb_7_add4_1.Text
            STREET_SUFFIX_CD = cmb_7_add4.Text
            TOWN_NM = cmb_7_city.Text
            'Me.txt_7_premiseno.Text = ""
        ElseIf cmb_formtype.Text.Trim = "ABANDON-I" Then
            house_no = txt_8_add1.Text
            ADDR_PREFIX_1 = cmb_8_add2.Text
            ADDR_PREFIX_2 = cmb_8_add2_1.Text
            STREET_NM = cmb_8_add3.Text
            ADDR_SUFFIX_CD = cmb_8_add4_1.Text
            STREET_SUFFIX_CD = cmb_8_add4.Text
            TOWN_NM = cmb_8_city.Text
            'Me.txt_8_premiseno.Text = ""
        ElseIf cmb_formtype.Text.Trim = "Form-80I" Then
            house_no = txt_6_add1.Text
            ADDR_PREFIX_1 = cmb_6_add2.Text
            ADDR_PREFIX_2 = cmb_6_add2_1.Text
            STREET_NM = cmb_6_add3.Text
            ADDR_SUFFIX_CD = cmb_6_add4_1.Text
            STREET_SUFFIX_CD = cmb_6_add4.Text
            TOWN_NM = cmb_6_city.Text
            'Me.txt_6_premiseno.Text = ""
        ElseIf cmb_formtype.Text.Trim = "OD-9-6-38" Then
            house_no = txt_5_add1.Text
            ADDR_PREFIX_1 = cmb_5_add2.Text
            ADDR_PREFIX_2 = cmb_5_add2_1.Text
            STREET_NM = cmb_5_add3.Text
            ADDR_SUFFIX_CD = cmb_5_add4_1.Text
            STREET_SUFFIX_CD = cmb_5_add4.Text
            TOWN_NM = cmb_5_city.Text
            'Me.txt_5_premiseno.Text = ""
        ElseIf cmb_formtype.Text.Trim = "Form235-B-702" Then
            house_no = txt_4_add1.Text
            ADDR_PREFIX_1 = cmb_4_add2.Text
            ADDR_PREFIX_2 = cmb_4_add2_1.Text
            STREET_NM = cmb_4_add3.Text
            ADDR_SUFFIX_CD = cmb_4_add4_1.Text
            STREET_SUFFIX_CD = cmb_4_add4.Text
            TOWN_NM = cmb_4_city.Text
            'txt_4_premiseno.Text = ""
        ElseIf cmb_formtype.Text.Trim = "White" Then
            house_no = txt_w_add1.Text
            ADDR_PREFIX_1 = cmb_w_add2.Text
            ADDR_PREFIX_2 = cmb_w_add2_1.Text
            STREET_NM = cmb_w_add3.Text
            ADDR_SUFFIX_CD = cmb_w_add4_1.Text
            STREET_SUFFIX_CD = cmb_w_add4.Text
            TOWN_NM = cmb_w_city.Text
            'Me.txt_w_premiseno.Text = ""
        ElseIf Me.cmb_formtype.Text.Trim = "Orange" Then
            house_no = txt_3_add1.Text
            ADDR_PREFIX_1 = cmb_3_add2.Text
            ADDR_PREFIX_2 = cmb_3_add2_1.Text
            STREET_NM = cmb_3_add3.Text
            ADDR_SUFFIX_CD = cmb_3_add4_1.Text
            STREET_SUFFIX_CD = cmb_3_add4.Text
            TOWN_NM = cmb_3_city.Text
            'txt_3_premiseno.Text = ""
        End If
        Dim Get_premise As New Get_premise(house_no, ADDR_PREFIX_1, ADDR_PREFIX_2, STREET_NM, ADDR_SUFFIX_CD, STREET_SUFFIX_CD, TOWN_NM)
        Get_premise.ShowDialog()

        Get_premise.BringToFront()
        Get_premise.Focus()
    End Sub
    Private Sub testdate(ByVal txtbox As TextBox)
        If txtbox.Text.Trim <> "" Then
            Try
                Dim a As Date
                a = Format(CDate(txtbox.Text.Trim), "MM/dd/yyyy")
                txtbox.Text = Format(a, "MM/dd/yyyy")
            Catch ex As Exception
                MsgBox("Invalid Date Format.", MsgBoxStyle.Critical, "Date Exception")
                txtbox.Focus()
            End Try
        End If
    End Sub
    Private Sub txt_q_dated_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt_q_dated.Leave, txt_y_dated.Leave, txt_r_dated.Leave, txt_a_dateabandon.Leave, txt_x_dated.Leave, txt_9_dated.Leave, txt_7_dated.Leave, txt_8_dateabandon.Leave, txt_8_dated.Leave, txt_6_dated.Leave, txt_5_dated.Leave, txt_4_dated.Leave, txt_3_dated.Leave, txt_w_dated.Leave
        testdate(sender)
    End Sub

    Private Sub txt_100b_dated_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt_100b_dated.Leave
        testdate(sender)
    End Sub

    Private Sub txt_100b_dateabandon_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt_100b_dateabandon.Leave
        testdate(sender)
    End Sub

    Private Sub txt_100b_m_dated_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt_100b_m_dated.Leave
        testdate(sender)
    End Sub

    Private Sub txt_100b_m_dateabandon_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt_100b_m_dateabandon.Leave
        testdate(sender)
    End Sub

    Private Sub txtDate1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDate1.Leave
        testdate(sender)
    End Sub

    Private Sub txt_Retired_date_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt_Retired_date.Leave
        testdate(sender)
    End Sub

    Private Sub txtDate_p1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDate_p1.Leave
        testdate(sender)
    End Sub

    Private Sub txt_Retired_date_p1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt_Retired_date_p1.Leave
        testdate(sender)
    End Sub

    Private Sub lnk100blkGetInYear_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnk100blkGetInYear.LinkClicked
        GetDateFromInstalledDate(txt_100b_dated, txt_100b_installedyear) 
    End Sub

    Private Sub lnk100blkMiscGetInYear_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnk100blkMiscGetInYear.LinkClicked
        GetDateFromInstalledDate(txt_100b_m_dated, txt_100b_m_installedyear)
    End Sub

    Private Sub GetDateFromInstalledDate(ByVal textBoxInDate As TextBox, ByVal textBoxInYear As TextBox)
        If textBoxInDate.Text.Trim <> "" Then
            Try
                textBoxInYear.Text = CDate(textBoxInDate.Text.Trim).Year
            Catch ex As Exception
                MsgBox("Invalid Date Format.", MsgBoxStyle.Critical, "Date Exception")
                textBoxInYear.Focus()
            End Try
        Else
            MsgBox("Can not get year from Installed Date", MsgBoxStyle.Critical, "Date Exception")
        End If
    End Sub

    '200blk-PAGE1 block Address
    Private Sub cmbPrefix2_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbPrefix2.Leave
        Fill_Streetname(Me.cmbStreetname, Me.txthouseNo.Text.Trim, cmbPrefix1.Text.Trim, cmbPrefix2.Text.Trim)
    End Sub

    Private Sub cmbStreetname_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbStreetname.Enter
        Fill_Streetname(Me.cmbStreetname, Me.txthouseNo.Text.Trim, cmbPrefix1.Text.Trim, cmbPrefix2.Text.Trim)
    End Sub

    Private Sub cmbStreetname_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbStreetname.Leave
        Me.Fill_Streetprefix(Me.cmbsuffix2, Me.txthouseNo.Text.Trim, cmbPrefix1.Text.Trim, cmbPrefix2.Text.Trim, cmbStreetname.Text.Trim, cmbsuffix1.Text.Trim)
    End Sub

    Private Sub cmbsuffix1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbsuffix1.Leave
        Me.Fill_Streetprefix(Me.cmbsuffix2, Me.txthouseNo.Text.Trim, cmbPrefix1.Text.Trim, cmbPrefix2.Text.Trim, cmbStreetname.Text.Trim, cmbsuffix1.Text.Trim)
    End Sub

    Private Sub cmbsuffix2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbsuffix2.Enter
        Me.Fill_Streetprefix(Me.cmbsuffix2, Me.txthouseNo1.Text.Trim, Me.cmbPrefix1.Text.Trim, cmbPrefix2.Text.Trim, cmbStreetname.Text.Trim, cmbsuffix1.Text.Trim)
    End Sub

    Private Sub cmbsuffix2_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbsuffix2.Leave
        Me.txt_200b_premiseno_p1.Text = Me.get_premiseno(Me.txthouseNo.Text.Trim, Me.cmbPrefix1.Text.Trim, cmbPrefix2.Text.Trim, cmbStreetname.Text.Trim, cmbsuffix2.Text.Trim, cmbsuffix1.Text.Trim, cmb_loccd_1.Text.Trim, txt_loccd_2.Text.Trim)
    End Sub
End Class

''FORM-100BLK
''FORM-200BLK
''FORM-100BLK-MISC
''Yellow
''White
''Orange
''Form235-B-702
''OD-9-6-38
''Form-80I
''Form-954
''ABANDON-I
''FORM-IX
''Form-X
''ABANDON-II
''ORIGINAL
''ORIGINAL-R
''MISC