SHARE
TWEET

Display

a guest Jul 19th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public MyTagGroup As TagGroup
  2.  
  3. Private Declare Sub SetCursorArrow Lib "C:\projects\FtvSeCrsr.dll" ()
  4. Private Declare Sub SetCursorWait Lib "C:\projects\FtvSeCrsr.dll" ()
  5.  
  6. Private Type MoveProduct
  7.     cnSrc As ADODB.Connection
  8.     cnDst As ADODB.Connection
  9.     strTable As String
  10.     strId As String
  11.     iGrade As Integer
  12.     iRough As Integer
  13. End Type
  14.  
  15. Private Type HMITag
  16.     cnSrc As ADODB.Connection
  17.     RcpID As String
  18. End Type
  19.  
  20. Private Type FlexgridData
  21.     RcpID As String
  22.     Grade As String
  23.     Rough As String
  24.     Finish As String
  25.     Dsc As String
  26. End Type
  27.  
  28. Public clLtDb As New Scripting.Dictionary
  29. Public strTable As String
  30. Public clType As New Scripting.Dictionary
  31. Public strSql As String
  32. Public strCdn As String
  33.  
  34. Public Function Contains(ByRef cl As Collection, ByRef strKey As String)
  35.     Contains = 0
  36. End Function
  37.  
  38. Public Sub ClearCbLtDb()
  39.     clLtDb.Clear
  40. End Sub
  41. Public Function AddCbLt(ByRef strKey As String)
  42.     If clLtDb.Exists(strKey) Then
  43.         AddCbLt = -1
  44.     End If
  45.  
  46.     Dim clLt As New Scripting.Dictionary
  47.     Dim clVal As New Scripting.Dictionary
  48.     Dim clDsc As New Scripting.Dictionary
  49.  
  50.     clLt.Add "val", clVal
  51.     clLt.Add "dsc", clDsc
  52.     clLtDb.Add strKey, clLt
  53.  
  54.     AddCbLt = 0
  55. End Function
  56.    
  57. Public Function AddLtEntry(ByRef strKey As String, ByRef strVal As String, ByRef strDsc As String)
  58.     Dim clLt As Scripting.Dictionary
  59.     Dim clVal As Scripting.Dictionary
  60.     Dim clDsc As Scripting.Dictionary
  61.  
  62.     If (clLtDb.Exists(strKey) = False) Then
  63.         AddLtEntry = 1
  64.         Exit Function
  65.     End If
  66.  
  67.     Set clLt = clLtDb(strKey)
  68.     Set clVal = clLt("val")
  69.     Set clDsc = clLt("dsc")
  70.  
  71.     If (clVal.Exists(strDsc)) Then
  72.         AddLtEntry = -2
  73.         Exit Function
  74.     End If
  75.  
  76.     clVal.Add strDsc, strVal
  77.     clDsc.Add strVal, strDsc
  78.  
  79.     AddLtEntry = 0
  80. End Function
  81.    
  82. Public Function GetLtDsc(ByRef strKey As String, ByRef objVal, ByRef strDsc As String)
  83.     Dim iVal As Integer
  84.     Dim strVal As String
  85.     Dim clLt As Scripting.Dictionary
  86.     Dim clDsc As Scripting.Dictionary
  87.  
  88.     strDsc = ""
  89.     If (clLtDb.Exists(strKey) = False) Then
  90.         GetLtDsc = -1
  91.         Exit Function
  92.     End If
  93.  
  94.     Set clLt = clLtDb(strKey)
  95.     Set clDsc = clLt("dsc")
  96.  
  97.     strVal = TypeName(objVal)
  98.     If (TypeName(objVal) = "Long") Then
  99.         iVal = objVal
  100.  
  101.         If (clDsc.Count < iVal) Then
  102.             GetLtDsc = -2
  103.             Exit Function
  104.         End If
  105.  
  106.         strDsc = clDsc(iVal)
  107.     ElseIf (TypeName(objVal) = "String") Then
  108.         strVal = objVal
  109.  
  110.         If (clDsc.Exists(strVal) = False) Then
  111.             GetLtDsc = -2
  112.             Exit Function
  113.         End If
  114.  
  115.         strDsc = clDsc(strVal)
  116.     Else
  117.         GetLtDsc = -3
  118.         Exit Function
  119.     End If
  120.  
  121.     GetLtDsc = 0
  122. End Function
  123.  
  124. Public Function GetLtVal(ByRef strKey As String, ByRef objDsc, ByRef strVal As String)
  125.     Dim iDsc As Integer
  126.     Dim strDsc As String
  127.     Dim clLt As Scripting.Dictionary
  128.     Dim clVal As Scripting.Dictionary
  129.  
  130.     strVal = ""
  131.     If (clLtDb.Exists(strKey) = False) Then
  132.         GetLtVal = -1
  133.         Exit Function
  134.     End If
  135.  
  136.     Set clLt = clLtDb(strKey)
  137.     Set clVal = clLt("val")
  138.  
  139.     If (TypeName(objDsc) = "Integer") Then
  140.         iDsc = objDsc
  141.  
  142.         If (clVal.Count < iDsc) Then
  143.             GetLtVal = -2
  144.             Exit Function
  145.         End If
  146.  
  147.         strVal = clVal(iDsc)
  148.     ElseIf (TypeName(objDsc) = "String") Then
  149.         strDsc = objDsc
  150.  
  151.         If (clVal.Exists(strDsc) = False) Then
  152.             GetLtVal = -2
  153.             Exit Function
  154.         End If
  155.  
  156.         strVal = clVal(strDsc)
  157.     Else
  158.         GetLtVal = -3
  159.         Exit Function
  160.     End If
  161.  
  162.     GetLtVal = strVal
  163. End Function
  164. Public Function GetLtLen(ByRef strKey As String) As Integer
  165.     Dim clLt As Scripting.Dictionary
  166.     Dim clVal As Scripting.Dictionary
  167.  
  168.     If (clLtDb.Exists(strKey) = False) Then
  169.         GetLtLen = -1
  170.         Exit Function
  171.     End If
  172.  
  173.     Set clLt = clLtDb(strKey)
  174.     Set clVal = clLt("val")
  175.     GetLtLen = clVal.Count
  176.  
  177. End Function
  178. Private Sub BtnSaveOLD_Inducto_A_Released()
  179.  
  180.   Set MyTagGroup = Application.CreateTagGroup(Me.AreaName)
  181.   MyTagGroup.Add "{RCP\Select\Inducto_A_LifeTime}"
  182.   Dim Inducto_A_LifeTime As Tag
  183.  
  184.      
  185. 'Check to see if tag group was succesfully created on display start
  186.    If MyTagGroup Is Nothing Then
  187. '        WriteSystemLog ftDiagAudienceOperator, ftDiagSeverityError, Me.Name, Me.ActiveElement.Name, "Tag Group Not Created on Display Start", Err.Number, Err.Description
  188.         Exit Sub
  189.    End If
  190.  
  191.     Set Inducto_A_LifeTime = MyTagGroup.Item("{RCP\Select\Inducto_A_LifeTime}")
  192.     Inducto_A_LifeTime.Value = 100
  193.      
  194.      For i = 0 To 50000000
  195.     i = i + 1
  196.     Next
  197.    
  198.      For i = 0 To 50000000
  199.     i = i + 1
  200.     Next
  201.    
  202.     Inducto_A_LifeTime.Value = 0
  203.     Set Inducto_A_LifeTime = Nothing
  204.  
  205.  
  206. End Sub
  207.  
  208. Private Sub BtnDnldAll_Released()
  209. Dim Source As String
  210. Dim Destination As String
  211. Source = "Tag"
  212. Destination = "PLC"
  213.  
  214.     ' Calls function that will copy the selected row into plc tags
  215.     InductoATagsModule.TransferInductoA Destination, Source
  216.     InductoBTagsModule.TransferInductoB Destination, Source
  217.     K2SetupTagModule.TransferK2Setup Destination, Source
  218.     KocksSetupTagModule.TransferKocksSetup Destination, Source
  219.     QSetupTagModule.TransferQSetup Destination, Source
  220.  
  221. End Sub
  222.  
  223.  
  224. Private Sub BtnDnldIndB_Released()
  225.  
  226. End Sub
  227.  
  228. Private Sub BtnDnldInductoA_Released()
  229.     Dim Source As String
  230.     Dim Destination As String
  231.     Source = "Tag"
  232.     Destination = "PLC"
  233.    
  234.     'Calls function that will copy the selected row into plc tags
  235.     InductoATagsModule.TransferInductoA Destination, Source
  236.    
  237. End Sub
  238.  
  239. Private Sub BtnDnldInductoB_Released()
  240.     Dim Source As String
  241.     Dim Destination As String
  242.     Source = "Tag"
  243.     Destination = "PLC"
  244.    
  245.     ' Calls function that will copy the selected row into plc tags
  246.     InductoBTagsModule.TransferInductoB Destination, Source
  247.    
  248. End Sub
  249.  
  250. Private Sub BtnDnldK2_Released()
  251.     Dim Source As String
  252.     Dim Destination As String
  253.     Source = "Tag"
  254.     Destination = "PLC"
  255.    
  256.     ' Calls function that will copy the selected row into plc tags
  257.     K2SetupTagModule.TransferK2Setup Destination, Source
  258.    
  259. End Sub
  260.  
  261. Private Sub BtnDnldKocks_Released()
  262.     Dim Source As String
  263.     Dim Destination As String
  264.     Source = "Tag"
  265.     Destination = "PLC"
  266.     Dim AllTags As KocksSetupGroup
  267.    
  268.     ' Calls function that will copy the selected row into plc tags
  269.     KocksSetupTagModule.TransferKocksSetup Destination, Source
  270.    
  271. End Sub
  272.  
  273. Private Sub BtnDnldQ_Released()
  274.     Dim Source As String
  275.     Dim Destination As String
  276.     Source = "Tag"
  277.     Destination = "PLC"
  278.    
  279.     ' Calls function that will copy the selected row to download into plc tags
  280.     QSetupTagModule.TransferQSetup Destination, Source
  281.    
  282. End Sub
  283.  
  284. Private Sub BtnSave_Inducto_A1_Released()
  285.  
  286. End Sub
  287.  
  288.  
  289. Private Sub BtnSelect_Released()
  290.    
  291.     Dim strVal As String
  292.     Dim htag As HMITag
  293.     Dim cnSrc As New ADODB.Connection
  294.     Dim cmd As New ADODB.Command
  295.     Dim rs As ADODB.Recordset
  296.     Dim str As String
  297.    
  298.     ' Get the Result from the Selected Row in the Flexgrid
  299.     iRow = flxResult.RowSel
  300.     If (iRow < 1) Then
  301.         Exit Sub
  302.     End If
  303.    
  304.     ' Saves the row clicked on by user and stores it so we can query all tables in the database with the selected row
  305.     htag.RcpID = flxResult.TextMatrix(iRow, 1)
  306.  
  307.     cnSrc.Open ("DSN=DSN_Perryman")
  308.     Set htag.cnSrc = cnSrc
  309.    
  310.     ' Creates all the tags corresponding to the selected row
  311.     InductoB_Tag htag
  312.     InductoA_Tag htag
  313.     KocksSetup_Tag htag
  314.     K2Setup_Tag htag
  315.     QSetup_Tag htag
  316.  
  317.     cnSrc.Close
  318.  
  319. End Sub
  320.  
  321. Private Sub BtnUpldAll_Released()
  322.     Dim Source As String
  323.     Dim Destination As String
  324.     Source = "PLC"
  325.     Destination = "Tag"
  326.    
  327.     ' Calls function that will copy the selected row into plc tags
  328.      InductoATagsModule.TransferInductoA Destination, Source
  329.      InductoBTagsModule.TransferInductoB Destination, Source
  330.      K2SetupTagModule.TransferK2Setup Destination, Source
  331.      KocksSetupTagModule.TransferKocksSetup Destination, Source
  332.      QSetupTagModule.TransferQSetup Destination, Source
  333.      
  334. End Sub
  335.  
  336. Private Sub BtnUpldIndB_Released()
  337.     Dim Source As String
  338.     Dim Destination As String
  339.     Source = "PLC"
  340.     Destination = "Tag"
  341.    
  342.     'Upload plc tags into hmi tags
  343.     InductoBTagsModule.TransferInductoB Destination, Source
  344.    
  345. End Sub
  346.  
  347. Private Sub BtnUpldK2_Released()
  348.     Dim Source As String
  349.     Dim Destination As String
  350.     Source = "PLC"
  351.     Destination = "Tag"
  352.  
  353.     K2SetupTagModule.TransferK2Setup Destination, Source
  354.    
  355. End Sub
  356.  
  357. Private Sub BtnUpldKocks_Released()
  358.     Dim Source As String
  359.     Dim Destination As String
  360.     Source = "PLC"
  361.     Destination = "Tag"
  362.  
  363.     KocksSetupTagModule.TransferKocksSetup Destination, Source
  364.    
  365. End Sub
  366.  
  367. Private Sub BtnSelect_Released_Released()
  368.    
  369.     Dim strVal As String
  370.     Dim htag As HMITag
  371.     Dim cnSrc As New ADODB.Connection
  372.     Dim cmd As New ADODB.Command
  373.     Dim rs As ADODB.Recordset
  374.     Dim str As String
  375.    
  376.     'Get the Result from the Selected Row in the Flexgrid
  377.     iRow = flxResult.RowSel
  378.     If (iRow < 1) Then
  379.         Exit Sub
  380.     End If
  381.    
  382.     ' Saves the row clicked on by user and stores it so we can query all tables in the database with the selected row
  383.     htag.RcpID = flxResult.TextMatrix(iRow, 1)
  384.  
  385.     cnSrc.Open ("DSN=DSN_Perryman")
  386.     Set htag.cnSrc = cnSrc
  387.    
  388.     'Creates all the tags corresponding to the selected row
  389.     InductoB_Tag htag
  390.     InductoA_Tag htag
  391.     KocksSetup_Tag htag
  392.     K2Setup_Tag htag
  393.     QSetup_Tag htag
  394.  
  395.     cnSrc.Close
  396.    
  397. End Sub
  398.  
  399. Private Sub BtnUpldQ_Released()
  400.     Dim Source As String
  401.     Dim Destination As String
  402.     Source = "PLC"
  403.     Destination = "Tag"
  404.    
  405.     QSetupTagModule.TransferQSetup Destination, Source
  406.    
  407. End Sub
  408.  
  409. Private Sub BtnDelete_Released()
  410.  
  411. End Sub
  412.  
  413.  
  414.  
  415. Private Sub Save_Released()
  416. Dim cnSrc As New ADODB.Connection
  417. Dim cmd As New ADODB.Command
  418. Dim rsSrc As New ADODB.Recordset
  419. Dim Tag As MasterTags
  420. Dim RcpIDInfo As String
  421. Dim strSql As String
  422. Dim PopUpTag As PopUpTags
  423. On Error GoTo ErrHandler
  424.  
  425.     Tag = TGroup.LoadMasterTags
  426.     PopUpTag = PopUpTagModule.LoadPopUpTags
  427.  
  428.     cnSrc.Open ("DSN=DSN_Perryman")
  429.     cmd.ActiveConnection = cnSrc
  430.     cmd.CommandText = "SELECT * FROM dbo.Master WHERE [RcpID]= '" & Tag.RcpID.Value & "'"
  431.     rsSrc.Open cmd.CommandText, cnSrc
  432.    
  433.     ' Case where the record does not exist, insert
  434.     If (rsSrc.BOF And rsSrc.EOF) Then
  435.    
  436.         rsSrc.Close
  437.        
  438.         'Inserting into Master table
  439.         SaveModule.InsertMaster Tag.RcpID.Value, cnSrc
  440.         PopUpTag.PopUp_MasterComplete.Value = 1
  441.         'Inserting into Inducto_A table
  442.         SaveModule.InductoAInsert Tag.RcpID.Value, cnSrc
  443.         PopUpTag.PopUp_IndAComplete.Value = 1
  444.         'Inserting into Inducto_B table
  445.         SaveModule.InductoBInsert Tag.RcpID.Value, cnSrc
  446.         PopUpTag.PopUp_IndBComplete.Value = 1
  447.         'Inserting into K2_Setup table
  448.         SaveModule.K2SetupInsert Tag.RcpID.Value, cnSrc
  449.         PopUpTag.PopUp_K2Complete.Value = 1
  450.         'Inserting into Kocks_Setup table
  451.         SaveModule.KocksSetupInsert Tag.RcpID.Value, cnSrc
  452.         PopUpTag.PopUp_KComplete.Value = 1
  453.         'Inserting into Q_Prod Table
  454.         SaveModule.QProdInsert Tag.RcpID.Value, cnSrc
  455.         PopUpTag.PopUp_QProdComplete.Value = 1
  456.         'Inserting into Q_Setup Table
  457.         SaveModule.QSetupInsert Tag.RcpID.Value, cnSrc
  458.         PopUpTag.PopUp_QComplete.Value = 1
  459.  
  460.         PopUpTag.PopUp_SaveRcpSaved.Value = 1
  461.  
  462.     ' Case where record exists, update
  463.     Else
  464.         rsSrc.Close
  465.        
  466.         'Updating Master table
  467.         SaveModule.MasterUpdate Tag.RcpID.Value, cnSrc
  468.         PopUpTag.PopUp_MasterComplete.Value = 1
  469.         'Updating Inducto_A table
  470.         SaveModule.UpdateInductoA Tag.RcpID.Value, cnSrc
  471.         PopUpTag.PopUp_IndAComplete.Value = 1
  472.         'Upating Inducto_B table
  473.         SaveModule.UpdateInductoB Tag.RcpID.Value, cnSrc
  474.         PopUpTag.PopUp_IndBComplete.Value = 1
  475.         'Updating K2_Setup table
  476.         SaveModule.UpdateK2Setup Tag.RcpID.Value, cnSrc
  477.         PopUpTag.PopUp_K2Complete.Value = 1
  478.         'Updating Kocks_Setup table
  479.         SaveModule.UpdateKocksSetup Tag.RcpID.Value, cnSrc
  480.         PopUpTag.PopUp_KComplete.Value = 1
  481.         'Updating Q_Prod Table
  482.         SaveModule.UpdateQProd Tag.RcpID.Value, cnSrc
  483.         PopUpTag.PopUp_QProdComplete.Value = 1
  484.         'Updating Q_Setup table
  485.         SaveModule.UpdateQSetup Tag.RcpID.Value, cnSrc
  486.         PopUpTag.PopUp_QComplete.Value = 1
  487.    
  488.         PopUpTag.PopUp_SaveRcpUpdated.Value = 1
  489.  
  490.     End If
  491.     Exit Sub
  492.    
  493. ErrHandler:
  494.     PopUpTag.PopUp_SaveFailed.Value = 1
  495.  
  496. End Sub
  497.  
  498. Private Sub Display_BeforeAnimationStop()
  499. Set MyTagGroup = Nothing
  500. End Sub
  501.  
  502. ' ALEEMA ----------------------------------------------------------------------------------------------------------------------------------------------
  503. Private Sub InductoA_Tag(ByRef htag As HMITag)
  504.     Dim cmd As New ADODB.Command
  505.     Dim rsSrc As New ADODB.Recordset
  506.     Dim AllATags As InductoAGroup
  507.     On Error GoTo ErrHandler
  508.    
  509.     ' Creates all HMI Tags
  510.     AllATags = TGroup.LoadInductoAGroup
  511.  
  512.     ' Creates path to the table desired
  513.     cmd.ActiveConnection = htag.cnSrc
  514.     cmd.CommandText = "SELECT * FROM dbo.Inducto_A WHERE [RcpID]= '" & htag.RcpID & "'"
  515.     rsSrc.Open cmd.CommandText, htag.cnSrc
  516.    
  517.     ' Case where the table is empty
  518.     If (rsSrc.BOF And rsSrc.EOF) Then
  519.             Exit Sub
  520.         End If
  521.    
  522.     ' Case where not at the beginning of the table
  523.     If (rsSrc.BOF = False) Then
  524.         rsSrc.MoveFirst
  525.     End If
  526.    
  527.     ' Case where empty row selected
  528.     If (htag.RcpID = "") Then
  529.         Exit Sub
  530.     End If
  531.    
  532.     ' Create HMI Tags
  533.     AllATags.DB.RcpID.Value = rsSrc.Fields("RcpID").Value
  534.     AllATags.DB.Q_inda_bil_SIZE.Value = rsSrc.Fields("Q_inda_bil_SIZE").Value
  535.     AllATags.DB.Q_inda_EXRATE.Value = rsSrc.Fields("Q_inda_EXRATE").Value
  536.     AllATags.DB.Q_inda_MINTEMP.Value = rsSrc.Fields("Q_inda_MINTEMP").Value
  537.     AllATags.DB.Q_inda_RATE.Value = rsSrc.Fields("Q_inda_RATE").Value
  538.     AllATags.DB.Q_inda_RBARS.Value = rsSrc.Fields("Q_inda_RBARS").Value
  539.     AllATags.DB.Q_inda_SQBARS.Value = rsSrc.Fields("Q_inda_SQBARS").Value
  540.     AllATags.DB.Q_inda_TEMP.Value = rsSrc.Fields("Q_inda_TEMP").Value
  541.     AllATags.DB.RcpGrade.Value = rsSrc.Fields("RcpGrade").Value
  542.     AllATags.DB.RI_DCH_RcpSET_1.Value = rsSrc.Fields("RI_DCH_RcpSET_1").Value
  543.     AllATags.DB.RI_DCH_RcpSET_2.Value = rsSrc.Fields("RI_DCH_RcpSET_2").Value
  544.     AllATags.DB.RI_DCH_RcpSET_3.Value = rsSrc.Fields("RI_DCH_RcpSET_3").Value
  545.     AllATags.DB.RI_DCH_RcpSET_4.Value = rsSrc.Fields("RI_DCH_RcpSET_4").Value
  546.     AllATags.DB.RI_DCH_RcpSET_5.Value = rsSrc.Fields("RI_DCH_RcpSET_5").Value
  547.     AllATags.DB.RI_DCH_RcpSET_6.Value = rsSrc.Fields("RI_DCH_RcpSET_6").Value
  548.     AllATags.DB.RI_DCH_RcpSET_7.Value = rsSrc.Fields("RI_DCH_RcpSET_7").Value
  549.     AllATags.DB.RI_DCH_RcpSET_8.Value = rsSrc.Fields("RI_DCH_RcpSET_8").Value
  550.     AllATags.DB.RI_DCH_RcpSET_9.Value = rsSrc.Fields("RI_DCH_RcpSET_9").Value
  551.     AllATags.DB.RI_DCH_RcpSET_10.Value = rsSrc.Fields("RI_DCH_RcpSET_10").Value
  552.     AllATags.DB.RI_DCH_RcpSET_11.Value = rsSrc.Fields("RI_DCH_RcpSET_11").Value
  553.     AllATags.DB.RI_DCH_RcpSET_12.Value = rsSrc.Fields("RI_DCH_RcpSET_12").Value
  554.     AllATags.DB.RI_DCH_RcpSET_13.Value = rsSrc.Fields("RI_DCH_RcpSET_13").Value
  555.     AllATags.DB.RI_DCH_RcpSET_14.Value = rsSrc.Fields("RI_DCH_RcpSET_14").Value
  556.     AllATags.DB.RI_DCH_RcpSET_15.Value = rsSrc.Fields("RI_DCH_RcpSET_15").Value
  557.     AllATags.DB.RI_ECH_RcpSET_1.Value = rsSrc.Fields("RI_ECH_RcpSET_1").Value
  558.     AllATags.DB.RI_ECH_RcpSET_2.Value = rsSrc.Fields("RI_ECH_RcpSET_2").Value
  559.     AllATags.DB.RI_ECH_RcpSET_3.Value = rsSrc.Fields("RI_ECH_RcpSET_3").Value
  560.     AllATags.DB.RI_ECH_RcpSET_4.Value = rsSrc.Fields("RI_ECH_RcpSET_4").Value
  561.     AllATags.DB.RI_ECH_RcpSET_5.Value = rsSrc.Fields("RI_ECH_RcpSET_5").Value
  562.     AllATags.DB.RI_ECH_RcpSET_6.Value = rsSrc.Fields("RI_ECH_RcpSET_6").Value
  563.     AllATags.DB.RI_ECH_RcpSET_7.Value = rsSrc.Fields("RI_ECH_RcpSET_7").Value
  564.     AllATags.DB.RI_ECH_RcpSET_8.Value = rsSrc.Fields("RI_ECH_RcpSET_8").Value
  565.     AllATags.DB.RI_ECH_RcpSET_9.Value = rsSrc.Fields("RI_ECH_RcpSET_9").Value
  566.     AllATags.DB.RI_ECH_RcpSET_10.Value = rsSrc.Fields("RI_ECH_RcpSET_10").Value
  567.     AllATags.DB.RI_ECH_RcpSET_11.Value = rsSrc.Fields("RI_ECH_RcpSET_11").Value
  568.     AllATags.DB.RI_ECH_RcpSET_12.Value = rsSrc.Fields("RI_ECH_RcpSET_12").Value
  569.     AllATags.DB.RI_ECH_RcpSET_13.Value = rsSrc.Fields("RI_ECH_RcpSET_13").Value
  570.     AllATags.DB.RI_ECH_RcpSET_14.Value = rsSrc.Fields("RI_ECH_RcpSET_14").Value
  571.     AllATags.DB.RI_ECH_RcpSET_15.Value = rsSrc.Fields("RI_ECH_RcpSET_15").Value
  572.  
  573.     Exit Sub
  574.    
  575. ErrHandler:
  576.     MsgBox Err.Description
  577.    
  578. End Sub
  579. Private Sub InductoB_Tag(ByRef htag As HMITag)
  580.     Dim cmd As New ADODB.Command
  581.     Dim rsSrc As New ADODB.Recordset
  582.     Dim AllBTags As InductoBGroup
  583.     On Error GoTo ErrHandler
  584.    
  585.     ' Creates all HMI Tags
  586.     AllBTags = TGroup.LoadInductoBGroup
  587.    
  588.     ' Creates path to the table desired
  589.     cmd.ActiveConnection = htag.cnSrc
  590.     cmd.CommandText = "SELECT * FROM dbo.Inducto_B WHERE [RcpID]= '" & htag.RcpID & "'"
  591.     rsSrc.Open cmd.CommandText, htag.cnSrc
  592.    
  593.     ' Case where the table is empty
  594.     If (rsSrc.BOF And rsSrc.EOF) Then
  595.             Exit Sub
  596.         End If
  597.    
  598.     ' Case where not at the beginning of the table
  599.     If (rsSrc.BOF = False) Then
  600.         rsSrc.MoveFirst
  601.     End If
  602.    
  603.     ' Case where there's no RcpID row selected
  604.     If (htag.RcpID = "") Then
  605.         Exit Sub
  606.     End If
  607.    
  608.     ' Setting valus of the Tags with data from the record set
  609.     AllBTags.DB.K_indb_MINTEMP.Value = rsSrc.Fields("K_indb_MINTEMP").Value
  610.     AllBTags.DB.K_indb_TEMP.Value = rsSrc.Fields("K_indb_TEMP").Value
  611.     AllBTags.DB.K_rcp_bil_SIZE.Value = rsSrc.Fields("K_rcp_bil_SIZE").Value
  612.     AllBTags.DB.RcpID.Value = rsSrc.Fields("RcpID").Value
  613.     AllBTags.DB.K_indb_MINTEMP.Value = rsSrc.Fields("K_indb_MINTEMP").Value
  614.     AllBTags.DB.K_indb_TEMP.Value = rsSrc.Fields("K_indb_TEMP").Value
  615.     AllBTags.DB.K_rcp_bil_SIZE.Value = rsSrc.Fields("K_rcp_bil_SIZE").Value
  616.     AllBTags.DB.RcpGrade.Value = rsSrc.Fields("RcpGrade").Value
  617.     AllBTags.DB.RcpID.Value = rsSrc.Fields("RcpID").Value
  618.     AllBTags.DB.STD_CylConstant_RCP_RI_1.Value = rsSrc.Fields("STD_CylConstant_RCP_RI_1").Value
  619.     AllBTags.DB.STD_CylConstant_RCP_RI_2.Value = rsSrc.Fields("STD_CylConstant_RCP_RI_2").Value
  620.     AllBTags.DB.STD_CylConstant_RCP_RI_3.Value = rsSrc.Fields("STD_CylConstant_RCP_RI_3").Value
  621.     AllBTags.DB.STD_CylConstant_RCP_RI_4.Value = rsSrc.Fields("STD_CylConstant_RCP_RI_4").Value
  622.     AllBTags.DB.STD_CylConstant_RCP_RI_5.Value = rsSrc.Fields("STD_CylConstant_RCP_RI_5").Value
  623.     AllBTags.DB.STD_CylConstant_RCP_RI_6.Value = rsSrc.Fields("STD_CylConstant_RCP_RI_6").Value
  624.     AllBTags.DB.STD_CylConstant_RCP_RI_7.Value = rsSrc.Fields("STD_CylConstant_RCP_RI_7").Value
  625.     AllBTags.DB.STD_CylConstant_RCP_RI_8.Value = rsSrc.Fields("STD_CylConstant_RCP_RI_8").Value
  626.     AllBTags.DB.STD_CylConstant_RCP_RI_9.Value = rsSrc.Fields("STD_CylConstant_RCP_RI_9").Value
  627.     AllBTags.DB.STD_CylConstant_RCP_RI_10.Value = rsSrc.Fields("STD_CylConstant_RCP_RI_10").Value
  628.     AllBTags.DB.STD_CylConstantActual_RCP_RO_1.Value = rsSrc.Fields("STD_CylConstantActual_RCP_RO_1").Value
  629.     AllBTags.DB.STD_CylConstantActual_RCP_RO_2.Value = rsSrc.Fields("STD_CylConstantActual_RCP_RO_2").Value
  630.     AllBTags.DB.STD_CylConstantActual_RCP_RO_3.Value = rsSrc.Fields("STD_CylConstantActual_RCP_RO_3").Value
  631.     AllBTags.DB.STD_CylConstantActual_RCP_RO_4.Value = rsSrc.Fields("STD_CylConstantActual_RCP_RO_4").Value
  632.     AllBTags.DB.STD_CylConstantActual_RCP_RO_5.Value = rsSrc.Fields("STD_CylConstantActual_RCP_RO_5").Value
  633.     AllBTags.DB.STD_CylConstantActual_RCP_RO_6.Value = rsSrc.Fields("STD_CylConstantActual_RCP_RO_6").Value
  634.     AllBTags.DB.STD_CylConstantActual_RCP_RO_7.Value = rsSrc.Fields("STD_CylConstantActual_RCP_RO_7").Value
  635.     AllBTags.DB.STD_CylConstantActual_RCP_RO_8.Value = rsSrc.Fields("STD_CylConstantActual_RCP_RO_8").Value
  636.     AllBTags.DB.STD_CylConstantActual_RCP_RO_9.Value = rsSrc.Fields("STD_CylConstantActual_RCP_RO_9").Value
  637.     AllBTags.DB.STD_CylConstantActual_RCP_RO_10.Value = rsSrc.Fields("STD_CylConstantActual_RCP_RO_10").Value
  638.     AllBTags.DB.STD_SpareInt_RCP_RI_1.Value = rsSrc.Fields("indb_STD_SpareInt_RCP_RI_1").Value
  639.     AllBTags.DB.STD_SpareInt_RCP_RI_2.Value = rsSrc.Fields("indb_STD_SpareInt_RCP_RI_2").Value
  640.    
  641.     Exit Sub
  642.    
  643. ErrHandler:
  644.     MsgBox Err.Description
  645.  
  646. End Sub
  647. Private Sub KocksSetup_Tag(ByRef htag As HMITag)
  648.     Dim cmd As New ADODB.Command
  649.     Dim rsSrc As New ADODB.Recordset
  650.     Dim AllKTags As KocksSetupGroup
  651.     On Error GoTo ErrHandler
  652.    
  653.     ' Creates all HMI Tags
  654.     AllKTags = TGroup.LoadKocksSetupGroup
  655.    
  656.    
  657.     ' Creates path to the table desired
  658.     cmd.ActiveConnection = htag.cnSrc
  659.     cmd.CommandText = "SELECT * FROM dbo.Kocks_Setup WHERE [RcpID]= '" & htag.RcpID & "'"
  660.     rsSrc.Open cmd.CommandText, htag.cnSrc
  661.    
  662.     ' Case where the table is empty
  663.     If (rsSrc.BOF And rsSrc.EOF) Then
  664.             Exit Sub
  665.         End If
  666.    
  667.     ' Case where not at the beginning of the table
  668.     If (rsSrc.BOF = False) Then
  669.         rsSrc.MoveFirst
  670.     End If
  671.    
  672.     ' Case where empty row selected
  673.     If (htag.RcpID = "") Then
  674.         Exit Sub
  675.     End If
  676.    
  677.  
  678.     ' Create HMI Tags
  679.     AllKTags.DB.RcpID.Value = rsSrc.Fields("RcpID").Value
  680.     AllKTags.DB.K_rcp_COIL_AMP.Value = rsSrc.Fields("K_rcp_COIL_AMP").Value
  681.     AllKTags.DB.K_rcp_COIL_FREQ.Value = rsSrc.Fields("K_rcp_COIL_FREQ").Value
  682.     AllKTags.DB.K_rcp_COIL_SREF.Value = rsSrc.Fields("K_rcp_COIL_SREF").Value
  683.     AllKTags.DB.K_rcp_COIL_TRIM.Value = rsSrc.Fields("K_rcp_COIL_TRIM").Value
  684.     AllKTags.DB.K_rcp_COIL_WOBBLE.Value = rsSrc.Fields("K_rcp_COIL_WOBBLE").Value
  685.     AllKTags.DB.K_rcp_CONV_SREF.Value = rsSrc.Fields("K_rcp_CONV_SREF").Value
  686.     AllKTags.DB.K_rcp_CONV_TRIM.Value = rsSrc.Fields("K_rcp_CONV_TRIM").Value
  687.     AllKTags.DB.K_rcp_EPR_SREF.Value = rsSrc.Fields("K_rcp_EPR_SREF").Value
  688.     AllKTags.DB.K_rcp_EPR_Trim.Value = rsSrc.Fields("K_rcp_EPR_Trim").Value
  689.     AllKTags.DB.K_rcp_H10_AQ.Value = rsSrc.Fields("K_rcp_H10_AQ").Value
  690.     AllKTags.DB.K_rcp_H10_DI.Value = rsSrc.Fields("K_rcp_H10_DI").Value
  691.     AllKTags.DB.K_rcp_H10_DS.Value = rsSrc.Fields("K_rcp_H10_DS").Value
  692.     AllKTags.DB.K_rcp_H10_GEAR_ratio.Value = rsSrc.Fields("K_rcp_H10_GEAR_ratio").Value
  693.     AllKTags.DB.K_rcp_H10_headSREF.Value = rsSrc.Fields("K_rcp_H10_headSREF").Value
  694.     AllKTags.DB.K_rcp_H10_LEAD.Value = rsSrc.Fields("K_rcp_H10_LEAD").Value
  695.     AllKTags.DB.K_rcp_H10_SREF.Value = rsSrc.Fields("K_rcp_H10_SREF").Value
  696.     AllKTags.DB.K_rcp_H10_tailSREF.Value = rsSrc.Fields("K_rcp_H10_tailSREF").Value
  697.     AllKTags.DB.K_rcp_H20_AQ.Value = rsSrc.Fields("K_rcp_H20_AQ").Value
  698.     AllKTags.DB.K_rcp_H20_DI.Value = rsSrc.Fields("K_rcp_H20_DI").Value
  699.     AllKTags.DB.K_rcp_H20_DS.Value = rsSrc.Fields("K_rcp_H20_DS").Value
  700.     AllKTags.DB.K_rcp_H20_GEAR_ratio.Value = rsSrc.Fields("K_rcp_H20_GEAR_ratio").Value
  701.     AllKTags.DB.K_rcp_H20_headSREF.Value = rsSrc.Fields("K_rcp_H20_headSREF").Value
  702.     AllKTags.DB.K_rcp_H20_LEAD.Value = rsSrc.Fields("K_rcp_H20_LEAD").Value
  703.     AllKTags.DB.K_rcp_H20_SREF.Value = rsSrc.Fields("K_rcp_H20_SREF").Value
  704.     AllKTags.DB.K_rcp_H20_tailSREF.Value = rsSrc.Fields("K_rcp_H20_tailSREF").Value
  705.     AllKTags.DB.K_rcp_H30_AQ.Value = rsSrc.Fields("K_rcp_H30_AQ").Value
  706.     AllKTags.DB.K_rcp_H30_DI.Value = rsSrc.Fields("K_rcp_H30_DI").Value
  707.     AllKTags.DB.K_rcp_H30_DS.Value = rsSrc.Fields("K_rcp_H30_DS").Value
  708.     AllKTags.DB.K_rcp_H30_GEAR_ratio.Value = rsSrc.Fields("K_rcp_H30_GEAR_ratio").Value
  709.     AllKTags.DB.K_rcp_H30_LEAD.Value = rsSrc.Fields("K_rcp_H30_LEAD").Value
  710.     AllKTags.DB.K_rcp_H30_SREF.Value = rsSrc.Fields("K_rcp_H30_SREF").Value
  711.     AllKTags.DB.K_rcp_HEC_HdDlyT.Value = rsSrc.Fields("K_rcp_HEC_HdDlyT").Value
  712.     AllKTags.DB.K_rcp_HEC_HdRampT.Value = rsSrc.Fields("K_rcp_HEC_HdRampT").Value
  713.     AllKTags.DB.K_rcp_HEC_TlDlyT.Value = rsSrc.Fields("K_rcp_HEC_TlDlyT").Value
  714.     AllKTags.DB.K_rcp_HEC_TlRampT.Value = rsSrc.Fields("K_rcp_HEC_TlRampT").Value
  715.     AllKTags.DB.K_rcp_mill_CONFIG_1.Value = rsSrc.Fields("K_rcp_mill_CONFIG_1").Value
  716.     AllKTags.DB.K_rcp_mill_CONFIG_2.Value = rsSrc.Fields("K_rcp_mill_CONFIG_2").Value
  717.     AllKTags.DB.K_rcp_mill_CONFIG_3.Value = rsSrc.Fields("K_rcp_mill_CONFIG_3").Value
  718.     AllKTags.DB.K_rcp_mill_CONFIG_4.Value = rsSrc.Fields("K_rcp_mill_CONFIG_4").Value
  719.     AllKTags.DB.K_rcp_mill_CONFIG_5.Value = rsSrc.Fields("K_rcp_mill_CONFIG_5").Value
  720.     AllKTags.DB.K_rcp_mill_CONFIG_6.Value = rsSrc.Fields("K_rcp_mill_CONFIG_6").Value
  721.     AllKTags.DB.K_rcp_mill_CONFIG_7.Value = rsSrc.Fields("K_rcp_mill_CONFIG_7").Value
  722.     AllKTags.DB.K_rcp_mill_CONFIG_8.Value = rsSrc.Fields("K_rcp_mill_CONFIG_8").Value
  723.     AllKTags.DB.K_rcp_mill_CONFIG_9.Value = rsSrc.Fields("K_rcp_mill_CONFIG_9").Value
  724.     AllKTags.DB.K_rcp_mill_CONFIG_10.Value = rsSrc.Fields("K_rcp_mill_CONFIG_10").Value
  725.     AllKTags.DB.K_rcp_mill_EntrySpeed.Value = rsSrc.Fields("K_rcp_mill_EntrySpeed").Value
  726.     AllKTags.DB.K_rcp_mill_GEAR_ratio.Value = rsSrc.Fields("K_rcp_mill_GEAR_ratio").Value
  727.     AllKTags.DB.K_rcp_mill_SPEED.Value = rsSrc.Fields("K_rcp_mill_SPEED").Value
  728.     AllKTags.DB.K_rcp_PR1_SREF.Value = rsSrc.Fields("K_rcp_PR1_SREF").Value
  729.     AllKTags.DB.K_rcp_PR1_TRIM.Value = rsSrc.Fields("K_rcp_PR1_TRIM").Value
  730.     AllKTags.DB.K_rcp_PR2_SREF.Value = rsSrc.Fields("K_rcp_PR2_SREF").Value
  731.     AllKTags.DB.K_rcp_PR2_TRIM.Value = rsSrc.Fields("K_rcp_PR2_TRIM").Value
  732.     AllKTags.DB.K_rcp_PR3_DI.Value = rsSrc.Fields("K_rcp_PR3_DI").Value
  733.     AllKTags.DB.K_rcp_PR3_GearPos1.Value = rsSrc.Fields("K_rcp_PR3_GearPos1").Value
  734.     AllKTags.DB.K_rcp_PR3_GearPos2.Value = rsSrc.Fields("K_rcp_PR3_GearPos2").Value
  735.     AllKTags.DB.K_rcp_PR3_SREF.Value = rsSrc.Fields("K_rcp_PR3_SREF").Value
  736.     AllKTags.DB.K_rcp_PR3_TRIM.Value = rsSrc.Fields("K_rcp_PR3_TRIM").Value
  737.     AllKTags.DB.K_rcp_prod_SIZE.Value = rsSrc.Fields("K_rcp_prod_SIZE").Value
  738.     AllKTags.DB.K_rcp_pshear_head_CROP.Value = rsSrc.Fields("K_rcp_pshear_head_CROP").Value
  739.     AllKTags.DB.K_rcp_pshear_tail_CROP.Value = rsSrc.Fields("K_rcp_pshear_tail_CROP").Value
  740.     AllKTags.DB.K_rcp_QuenchT.Value = rsSrc.Fields("K_rcp_QuenchT").Value
  741.     AllKTags.DB.K_rcp_Rsh_DivCut.Value = rsSrc.Fields("K_rcp_Rsh_DivCut").Value
  742.     AllKTags.DB.K_rcp_Rsh_DivTrim.Value = rsSrc.Fields("K_rcp_Rsh_DivTrim").Value
  743.     AllKTags.DB.K_rcp_Rsh_GearPos1.Value = rsSrc.Fields("K_rcp_Rsh_GearPos1").Value
  744.     AllKTags.DB.K_rcp_Rsh_GearPos2.Value = rsSrc.Fields("K_rcp_Rsh_GearPos2").Value
  745.     AllKTags.DB.K_rcp_Rsh_HdCrop.Value = rsSrc.Fields("K_rcp_Rsh_HdCrop").Value
  746.     AllKTags.DB.K_rcp_Rsh_HdCropCycT.Value = rsSrc.Fields("K_rcp_Rsh_HdCropCycT").Value
  747.     AllKTags.DB.K_rcp_Rsh_HdCropDlyT.Value = rsSrc.Fields("K_rcp_Rsh_HdCropDlyT").Value
  748.     AllKTags.DB.K_rcp_Rsh_HdCut.Value = rsSrc.Fields("K_rcp_Rsh_HdCut").Value
  749.     AllKTags.DB.K_rcp_Rsh_HdLength.Value = rsSrc.Fields("K_rcp_Rsh_HdLength").Value
  750.     AllKTags.DB.K_rcp_Rsh_HdTrim.Value = rsSrc.Fields("K_rcp_Rsh_HdTrim").Value
  751.     AllKTags.DB.K_rcp_Rsh_Length.Value = rsSrc.Fields("K_rcp_Rsh_Length").Value
  752.     AllKTags.DB.K_rcp_Rsh_STrim.Value = rsSrc.Fields("K_rcp_Rsh_STrim").Value
  753.     AllKTags.DB.K_rcp_Rsh_TlCrop.Value = rsSrc.Fields("K_rcp_Rsh_TlCrop").Value
  754.     AllKTags.DB.K_rcp_Rsh_TlCropCycT.Value = rsSrc.Fields("K_rcp_Rsh_TlCropCycT").Value
  755.     AllKTags.DB.K_rcp_Rsh_TlCropDlyT.Value = rsSrc.Fields("K_rcp_Rsh_TlCropDlyT").Value
  756.     AllKTags.DB.K_rcp_Rsh_TlCut.Value = rsSrc.Fields("K_rcp_Rsh_TlCut").Value
  757.     AllKTags.DB.K_rcp_Rsh_TlLength.Value = rsSrc.Fields("K_rcp_Rsh_TlLength").Value
  758.     AllKTags.DB.K_rcp_Rsh_TlTrim.Value = rsSrc.Fields("K_rcp_Rsh_TlTrim").Value
  759.     AllKTags.DB.K_rcp_SYS_Bar.Value = rsSrc.Fields("K_rcp_SYS_Bar").Value
  760.     AllKTags.DB.K_rcp_Sys_BarPassST.Value = rsSrc.Fields("K_rcp_Sys_BarPassST").Value
  761.     AllKTags.DB.K_rcp_Sys_BarPassT.Value = rsSrc.Fields("K_rcp_Sys_BarPassT").Value
  762.     AllKTags.DB.K_rcp_SYS_Coil.Value = rsSrc.Fields("K_rcp_SYS_Coil").Value
  763.     AllKTags.DB.K_rcp_Sys_LinSP_Perc.Value = rsSrc.Fields("K_rcp_Sys_LinSP_Perc").Value
  764.     AllKTags.DB.K_rcp_Sys_LinSP_Perc2.Value = rsSrc.Fields("K_rcp_Sys_LinSP_Perc2").Value
  765.     AllKTags.DB.K_rcp_Sys_LinSP_Rate.Value = rsSrc.Fields("K_rcp_Sys_LinSP_Rate").Value
  766.     AllKTags.DB.RcpGrade.Value = rsSrc.Fields("RcpGrade").Value
  767.     AllKTags.DB.K_rcp_bil_SIZE.Value = rsSrc.Fields("K_rcp_bil_SIZE").Value
  768.  
  769.     Exit Sub
  770.    
  771. ErrHandler:
  772.     MsgBox Err.Description
  773.  
  774. End Sub
  775. Private Sub QSetup_Tag(ByRef htag As HMITag)
  776.     Dim cmd As New ADODB.Command
  777.     Dim rsSrc As New ADODB.Recordset
  778.     Dim AllQTags As QSetupGroup
  779.     On Error GoTo ErrHandler
  780.    
  781.     ' Creates all HMI Tags
  782.     AllQTags = TGroup.LoadQSetupGroup
  783.    
  784.    
  785.     ' Creates path to the table desired
  786.     cmd.ActiveConnection = htag.cnSrc
  787.     cmd.CommandText = "SELECT * FROM dbo.Q_Setup WHERE [RcpID]= '" & htag.RcpID & "'"
  788.     rsSrc.Open cmd.CommandText, htag.cnSrc
  789.    
  790.     ' Case where the table is empty
  791.     If (rsSrc.BOF And rsSrc.EOF) Then
  792.             Exit Sub
  793.         End If
  794.    
  795.     ' Case where not at the beginning of the table
  796.     If (rsSrc.BOF = False) Then
  797.         rsSrc.MoveFirst
  798.     End If
  799.    
  800.     ' Case where empty row selected
  801.     If (htag.RcpID = "") Then
  802.         Exit Sub
  803.     End If
  804.        
  805.     ' Create HMI Tags
  806.     AllQTags.DB.RcpGrade.Value = rsSrc.Fields("RcpGrade").Value
  807.     AllQTags.DB.RcpID.Value = rsSrc.Fields("RcpID").Value
  808.     AllQTags.DB.RI_SYS_RcpLastPass.Value = rsSrc.Fields("RI_SYS_RcpLastPass").Value
  809.     AllQTags.DB.RO_DBT_MmiSET_1.Value = rsSrc.Fields("RO_DBT_MmiSET_1").Value
  810.     AllQTags.DB.RO_DBT_MmiSET_10.Value = rsSrc.Fields("RO_DBT_MmiSET_10").Value
  811.     AllQTags.DB.RO_DBT_MmiSET_11.Value = rsSrc.Fields("RO_DBT_MmiSET_11").Value
  812.     AllQTags.DB.RO_DBT_MmiSET_12.Value = rsSrc.Fields("RO_DBT_MmiSET_12").Value
  813.     AllQTags.DB.RO_DBT_MmiSET_13.Value = rsSrc.Fields("RO_DBT_MmiSET_13").Value
  814.     AllQTags.DB.RO_DBT_MmiSET_14.Value = rsSrc.Fields("RO_DBT_MmiSET_14").Value
  815.     AllQTags.DB.RO_DBT_MmiSET_15.Value = rsSrc.Fields("RO_DBT_MmiSET_15").Value
  816.     AllQTags.DB.RO_DBT_MmiSET_2.Value = rsSrc.Fields("RO_DBT_MmiSET_2").Value
  817.     AllQTags.DB.RO_DBT_MmiSET_3.Value = rsSrc.Fields("RO_DBT_MmiSET_3").Value
  818.     AllQTags.DB.RO_DBT_MmiSET_4.Value = rsSrc.Fields("RO_DBT_MmiSET_4").Value
  819.     AllQTags.DB.RO_DBT_MmiSET_5.Value = rsSrc.Fields("RO_DBT_MmiSET_5").Value
  820.     AllQTags.DB.RO_DBT_MmiSET_6.Value = rsSrc.Fields("RO_DBT_MmiSET_6").Value
  821.     AllQTags.DB.RO_DBT_MmiSET_7.Value = rsSrc.Fields("RO_DBT_MmiSET_7").Value
  822.     AllQTags.DB.RO_DBT_MmiSET_8.Value = rsSrc.Fields("RO_DBT_MmiSET_8").Value
  823.     AllQTags.DB.RO_DBT_MmiSET_9.Value = rsSrc.Fields("RO_DBT_MmiSET_9").Value
  824.     AllQTags.DB.RO_DCH_MmiSET_1.Value = rsSrc.Fields("RO_DCH_MmiSET_1").Value
  825.     AllQTags.DB.RO_DCH_MmiSET_10.Value = rsSrc.Fields("RO_DCH_MmiSET_10").Value
  826.     AllQTags.DB.RO_DCH_MmiSET_11.Value = rsSrc.Fields("RO_DCH_MmiSET_11").Value
  827.     AllQTags.DB.RO_DCH_MmiSET_12.Value = rsSrc.Fields("RO_DCH_MmiSET_12").Value
  828.     AllQTags.DB.RO_DCH_MmiSET_13.Value = rsSrc.Fields("RO_DCH_MmiSET_13").Value
  829.     AllQTags.DB.RO_DCH_MmiSET_14.Value = rsSrc.Fields("RO_DCH_MmiSET_14").Value
  830.     AllQTags.DB.RO_DCH_MmiSET_15.Value = rsSrc.Fields("RO_DCH_MmiSET_15").Value
  831.     AllQTags.DB.RO_DCH_MmiSET_2.Value = rsSrc.Fields("RO_DCH_MmiSET_2").Value
  832.     AllQTags.DB.RO_DCH_MmiSET_3.Value = rsSrc.Fields("RO_DCH_MmiSET_3").Value
  833.     AllQTags.DB.RO_DCH_MmiSET_4.Value = rsSrc.Fields("RO_DCH_MmiSET_4").Value
  834.     AllQTags.DB.RO_DCH_MmiSET_5.Value = rsSrc.Fields("RO_DCH_MmiSET_5").Value
  835.     AllQTags.DB.RO_DCH_MmiSET_6.Value = rsSrc.Fields("RO_DCH_MmiSET_6").Value
  836.     AllQTags.DB.RO_DCH_MmiSET_7.Value = rsSrc.Fields("RO_DCH_MmiSET_7").Value
  837.     AllQTags.DB.RO_DCH_MmiSET_8.Value = rsSrc.Fields("RO_DCH_MmiSET_8").Value
  838.     AllQTags.DB.RO_DCH_MmiSET_9.Value = rsSrc.Fields("RO_DCH_MmiSET_9").Value
  839.     AllQTags.DB.RO_DFR_MmiTRIM_1.Value = rsSrc.Fields("RO_DFR_MmiTRIM_1").Value
  840.     AllQTags.DB.RO_DFR_MmiTRIM_10.Value = rsSrc.Fields("RO_DFR_MmiTRIM_10").Value
  841.     AllQTags.DB.RO_DFR_MmiTRIM_11.Value = rsSrc.Fields("RO_DFR_MmiTRIM_11").Value
  842.     AllQTags.DB.RO_DFR_MmiTRIM_12.Value = rsSrc.Fields("RO_DFR_MmiTRIM_12").Value
  843.     AllQTags.DB.RO_DFR_MmiTRIM_13.Value = rsSrc.Fields("RO_DFR_MmiTRIM_13").Value
  844.     AllQTags.DB.RO_DFR_MmiTRIM_14.Value = rsSrc.Fields("RO_DFR_MmiTRIM_14").Value
  845.     AllQTags.DB.RO_DFR_MmiTRIM_15.Value = rsSrc.Fields("RO_DFR_MmiTRIM_15").Value
  846.     AllQTags.DB.RO_DFR_MmiTRIM_2.Value = rsSrc.Fields("RO_DFR_MmiTRIM_2").Value
  847.     AllQTags.DB.RO_DFR_MmiTRIM_3.Value = rsSrc.Fields("RO_DFR_MmiTRIM_3").Value
  848.     AllQTags.DB.RO_DFR_MmiTRIM_4.Value = rsSrc.Fields("RO_DFR_MmiTRIM_4").Value
  849.     AllQTags.DB.RO_DFR_MmiTRIM_5.Value = rsSrc.Fields("RO_DFR_MmiTRIM_5").Value
  850.     AllQTags.DB.RO_DFR_MmiTRIM_6.Value = rsSrc.Fields("RO_DFR_MmiTRIM_6").Value
  851.     AllQTags.DB.RO_DFR_MmiTRIM_7.Value = rsSrc.Fields("RO_DFR_MmiTRIM_7").Value
  852.     AllQTags.DB.RO_DFR_MmiTRIM_8.Value = rsSrc.Fields("RO_DFR_MmiTRIM_8").Value
  853.     AllQTags.DB.RO_DFR_MmiTRIM_9.Value = rsSrc.Fields("RO_DFR_MmiTRIM_9").Value
  854.    
  855.     Exit Sub
  856.    
  857. ErrHandler:
  858.     MsgBox Err.Description
  859.    
  860. End Sub
  861. Private Sub K2Setup_Tag(ByRef htag As HMITag)
  862.     Dim cmd As New ADODB.Command
  863.     Dim rsSrc As New ADODB.Recordset
  864.     Dim AllK2Tags As K2SetupGroup
  865.     On Error GoTo ErrHandler
  866.    
  867.     ' Creates all HMI Tags
  868.     AllK2Tags = TGroup.LoadK2SetupGroup
  869.    
  870.     ' Creates path to the table desired
  871.     cmd.ActiveConnection = htag.cnSrc
  872.     cmd.CommandText = "SELECT * FROM dbo.K2_Setup WHERE [RcpID]= '" & htag.RcpID & "'"
  873.     rsSrc.Open cmd.CommandText, htag.cnSrc
  874.    
  875.     ' Case where the table is empty
  876.     If (rsSrc.BOF And rsSrc.EOF) Then
  877.             Exit Sub
  878.         End If
  879.    
  880.     ' Case where not at the beginning of the table
  881.     If (rsSrc.BOF = False) Then
  882.         rsSrc.MoveFirst
  883.     End If
  884.    
  885.     ' Case where empty row selected
  886.     If (htag.RcpID = "") Then
  887.         Exit Sub
  888.     End If
  889.  
  890.  
  891.     ' Create HMI Tags
  892.     AllK2Tags.DB.RcpID.Value = rsSrc.Fields("RcpID").Value
  893.     AllK2Tags.DB.CNVR2_RPM_RCP_RO.Value = rsSrc.Fields("CNVR2_RPM_RCP_RO").Value
  894.     AllK2Tags.DB.CNVR2_SpeedRefRPM_RCP_RI.Value = rsSrc.Fields("CNVR2_SpeedRefRPM_RCP_RI").Value
  895.     AllK2Tags.DB.CNVR2_SpeedTrim_RCP_RI.Value = rsSrc.Fields("CNVR2_SpeedTrim_RCP_RI").Value
  896.     AllK2Tags.DB.CVNR2_SpareReal_RCP_RI.Value = rsSrc.Fields("CVNR2_SpareReal_RCP_RI").Value
  897.     AllK2Tags.DB.GEN_K2_BarPassageTime_RCP_RI.Value = rsSrc.Fields("GEN_K2_BarPassageTime_RCP_RI").Value
  898.     AllK2Tags.DB.GEN_K2_BarSafetyTime_RCP_RI.Value = rsSrc.Fields("GEN_K2_BarSafetyTime_RCP_RI").Value
  899.     AllK2Tags.DB.GEN_K2_BilletAreaHot_RCP_RI.Value = rsSrc.Fields("GEN_K2_BilletAreaHot_RCP_RI").Value
  900.     AllK2Tags.DB.GEN_K2_BilletEntryTemp_RCP_RI.Value = rsSrc.Fields("GEN_K2_BilletEntryTemp_RCP_RI").Value
  901.     AllK2Tags.DB.GEN_K2_BilletSizeHot_RCP_RI.Value = rsSrc.Fields("GEN_K2_BilletSizeHot_RCP_RI").Value
  902.     AllK2Tags.DB.GEN_K2_BlockID_RCP_RI.Value = rsSrc.Fields("GEN_K2_BlockID_RCP_RI").Value
  903.     AllK2Tags.DB.GEN_K2_ContThrghPut_RCP_RI.Value = rsSrc.Fields("GEN_K2_ContThrghPut_RCP_RI").Value
  904.     AllK2Tags.DB.GEN_K2_CurProdInCycle_RCP_RI.Value = rsSrc.Fields("GEN_K2_CurProdInCycle_RCP_RI").Value
  905.     AllK2Tags.DB.GEN_K2_EntrySpeed_RCP_RI.Value = rsSrc.Fields("GEN_K2_EntrySpeed_RCP_RI").Value
  906.     AllK2Tags.DB.GEN_K2_FinishingStand_RCP_RI.Value = rsSrc.Fields("GEN_K2_FinishingStand_RCP_RI").Value
  907.     AllK2Tags.DB.GEN_K2_FinishSpeed_RCP_RI.Value = rsSrc.Fields("GEN_K2_FinishSpeed_RCP_RI").Value
  908.     AllK2Tags.DB.GEN_K2_KFO_RCP_RI.Value = rsSrc.Fields("GEN_K2_KFO_RCP_RI").Value
  909.     AllK2Tags.DB.GEN_K2_LinSpeed_RCP_RI.Value = rsSrc.Fields("GEN_K2_LinSpeed_RCP_RI").Value
  910.     AllK2Tags.DB.GEN_K2_NxtProdInCycle_RCP_RI.Value = rsSrc.Fields("GEN_K2_NxtProdInCycle_RCP_RI").Value
  911.     AllK2Tags.DB.GEN_K2_ProdAreaCold_RCP_RI.Value = rsSrc.Fields("GEN_K2_ProdAreaCold_RCP_RI").Value
  912.     AllK2Tags.DB.GEN_K2_ProdSchNo_RCP_RO.Value = rsSrc.Fields("GEN_K2_ProdSchNo_RCP_RO").Value
  913.     AllK2Tags.DB.GEN_K2_ProdSize_RCP_RI.Value = rsSrc.Fields("GEN_K2_ProdSize_RCP_RI").Value
  914.     AllK2Tags.DB.GEN_K2_ProdSizeCold_RCP_RI.Value = rsSrc.Fields("GEN_K2_ProdSizeCold_RCP_RI").Value
  915.     AllK2Tags.DB.GEN_K2_ProdSizeHot_RCP_RI.Value = rsSrc.Fields("GEN_K2_ProdSizeHot_RCP_RI").Value
  916.     AllK2Tags.DB.GEN_K2_ShrinkFactor_RCP_RI.Value = rsSrc.Fields("GEN_K2_ShrinkFactor_RCP_RI").Value
  917.     AllK2Tags.DB.GEN_K2_SpareIntArr1_RCP_RI_1.Value = rsSrc.Fields("GEN_K2_SpareIntArr1_RCP_RI_1").Value
  918.     AllK2Tags.DB.GEN_K2_SpareIntArr1_RCP_RI_10.Value = rsSrc.Fields("GEN_K2_SpareIntArr1_RCP_RI_10").Value
  919.     AllK2Tags.DB.GEN_K2_SpareIntArr1_RCP_RI_2.Value = rsSrc.Fields("GEN_K2_SpareIntArr1_RCP_RI_2").Value
  920.     AllK2Tags.DB.GEN_K2_SpareIntArr1_RCP_RI_3.Value = rsSrc.Fields("GEN_K2_SpareIntArr1_RCP_RI_3").Value
  921.     AllK2Tags.DB.GEN_K2_SpareIntArr1_RCP_RI_4.Value = rsSrc.Fields("GEN_K2_SpareIntArr1_RCP_RI_4").Value
  922.     AllK2Tags.DB.GEN_K2_SpareIntArr1_RCP_RI_5.Value = rsSrc.Fields("GEN_K2_SpareIntArr1_RCP_RI_5").Value
  923.     AllK2Tags.DB.GEN_K2_SpareIntArr1_RCP_RI_6.Value = rsSrc.Fields("GEN_K2_SpareIntArr1_RCP_RI_6").Value
  924.     AllK2Tags.DB.GEN_K2_SpareIntArr1_RCP_RI_7.Value = rsSrc.Fields("GEN_K2_SpareIntArr1_RCP_RI_7").Value
  925.     AllK2Tags.DB.GEN_K2_SpareIntArr1_RCP_RI_8.Value = rsSrc.Fields("GEN_K2_SpareIntArr1_RCP_RI_8").Value
  926.     AllK2Tags.DB.GEN_K2_SpareIntArr1_RCP_RI_9.Value = rsSrc.Fields("GEN_K2_SpareIntArr1_RCP_RI_9").Value
  927.     AllK2Tags.DB.GEN_K2_SpareIntArr2_RCP_RI_1.Value = rsSrc.Fields("GEN_K2_SpareIntArr2_RCP_RI_1").Value
  928.     AllK2Tags.DB.GEN_K2_SpareIntArr2_RCP_RI_10.Value = rsSrc.Fields("GEN_K2_SpareIntArr2_RCP_RI_10").Value
  929.     AllK2Tags.DB.GEN_K2_SpareIntArr2_RCP_RI_2.Value = rsSrc.Fields("GEN_K2_SpareIntArr2_RCP_RI_2").Value
  930.     AllK2Tags.DB.GEN_K2_SpareIntArr2_RCP_RI_3.Value = rsSrc.Fields("GEN_K2_SpareIntArr2_RCP_RI_3").Value
  931.     AllK2Tags.DB.GEN_K2_SpareIntArr2_RCP_RI_4.Value = rsSrc.Fields("GEN_K2_SpareIntArr2_RCP_RI_4").Value
  932.     AllK2Tags.DB.GEN_K2_SpareIntArr2_RCP_RI_5.Value = rsSrc.Fields("GEN_K2_SpareIntArr2_RCP_RI_5").Value
  933.     AllK2Tags.DB.GEN_K2_SpareIntArr2_RCP_RI_6.Value = rsSrc.Fields("GEN_K2_SpareIntArr2_RCP_RI_6").Value
  934.     AllK2Tags.DB.GEN_K2_SpareIntArr2_RCP_RI_7.Value = rsSrc.Fields("GEN_K2_SpareIntArr2_RCP_RI_7").Value
  935.     AllK2Tags.DB.GEN_K2_SpareIntArr2_RCP_RI_8.Value = rsSrc.Fields("GEN_K2_SpareIntArr2_RCP_RI_8").Value
  936.     AllK2Tags.DB.GEN_K2_SpareIntArr2_RCP_RI_9.Value = rsSrc.Fields("GEN_K2_SpareIntArr2_RCP_RI_9").Value
  937.     AllK2Tags.DB.GEN_K2_SpareIntArr3_RCP_RI_1.Value = rsSrc.Fields("GEN_K2_SpareIntArr3_RCP_RI_1").Value
  938.     AllK2Tags.DB.GEN_K2_SpareIntArr3_RCP_RI_10.Value = rsSrc.Fields("GEN_K2_SpareIntArr3_RCP_RI_10").Value
  939.     AllK2Tags.DB.GEN_K2_SpareIntArr3_RCP_RI_2.Value = rsSrc.Fields("GEN_K2_SpareIntArr3_RCP_RI_2").Value
  940.     AllK2Tags.DB.GEN_K2_SpareIntArr3_RCP_RI_3.Value = rsSrc.Fields("GEN_K2_SpareIntArr3_RCP_RI_3").Value
  941.     AllK2Tags.DB.GEN_K2_SpareIntArr3_RCP_RI_4.Value = rsSrc.Fields("GEN_K2_SpareIntArr3_RCP_RI_4").Value
  942.     AllK2Tags.DB.GEN_K2_SpareIntArr3_RCP_RI_5.Value = rsSrc.Fields("GEN_K2_SpareIntArr3_RCP_RI_5").Value
  943.     AllK2Tags.DB.GEN_K2_SpareIntArr3_RCP_RI_6.Value = rsSrc.Fields("GEN_K2_SpareIntArr3_RCP_RI_6").Value
  944.     AllK2Tags.DB.GEN_K2_SpareIntArr3_RCP_RI_7.Value = rsSrc.Fields("GEN_K2_SpareIntArr3_RCP_RI_7").Value
  945.     AllK2Tags.DB.GEN_K2_SpareIntArr3_RCP_RI_8.Value = rsSrc.Fields("GEN_K2_SpareIntArr3_RCP_RI_8").Value
  946.     AllK2Tags.DB.GEN_K2_SpareIntArr3_RCP_RI_9.Value = rsSrc.Fields("GEN_K2_SpareIntArr3_RCP_RI_9").Value
  947.     AllK2Tags.DB.GEN_K2_SpareRealArr1_RCP_RI_1.Value = rsSrc.Fields("GEN_K2_SpareRealArr1_RCP_RI_1").Value
  948.     AllK2Tags.DB.GEN_K2_SpareRealArr1_RCP_RI_10.Value = rsSrc.Fields("GEN_K2_SpareRealArr1_RCP_RI_10").Value
  949.     AllK2Tags.DB.GEN_K2_SpareRealArr1_RCP_RI_2.Value = rsSrc.Fields("GEN_K2_SpareRealArr1_RCP_RI_2").Value
  950.     AllK2Tags.DB.GEN_K2_SpareRealArr1_RCP_RI_3.Value = rsSrc.Fields("GEN_K2_SpareRealArr1_RCP_RI_3").Value
  951.     AllK2Tags.DB.GEN_K2_SpareRealArr1_RCP_RI_4.Value = rsSrc.Fields("GEN_K2_SpareRealArr1_RCP_RI_4").Value
  952.     AllK2Tags.DB.GEN_K2_SpareRealArr1_RCP_RI_5.Value = rsSrc.Fields("GEN_K2_SpareRealArr1_RCP_RI_5").Value
  953.     AllK2Tags.DB.GEN_K2_SpareRealArr1_RCP_RI_6.Value = rsSrc.Fields("GEN_K2_SpareRealArr1_RCP_RI_6").Value
  954.     AllK2Tags.DB.GEN_K2_SpareRealArr1_RCP_RI_7.Value = rsSrc.Fields("GEN_K2_SpareRealArr1_RCP_RI_7").Value
  955.     AllK2Tags.DB.GEN_K2_SpareRealArr1_RCP_RI_8.Value = rsSrc.Fields("GEN_K2_SpareRealArr1_RCP_RI_8").Value
  956.     AllK2Tags.DB.GEN_K2_SpareRealArr1_RCP_RI_9.Value = rsSrc.Fields("GEN_K2_SpareRealArr1_RCP_RI_9").Value
  957.     AllK2Tags.DB.GEN_K2_SpareRealArr2_RCP_RI_1.Value = rsSrc.Fields("GEN_K2_SpareRealArr2_RCP_RI_1").Value
  958.     AllK2Tags.DB.GEN_K2_SpareRealArr2_RCP_RI_10.Value = rsSrc.Fields("GEN_K2_SpareRealArr2_RCP_RI_10").Value
  959.     AllK2Tags.DB.GEN_K2_SpareRealArr2_RCP_RI_2.Value = rsSrc.Fields("GEN_K2_SpareRealArr2_RCP_RI_2").Value
  960.     AllK2Tags.DB.GEN_K2_SpareRealArr2_RCP_RI_3.Value = rsSrc.Fields("GEN_K2_SpareRealArr2_RCP_RI_3").Value
  961.     AllK2Tags.DB.GEN_K2_SpareRealArr2_RCP_RI_4.Value = rsSrc.Fields("GEN_K2_SpareRealArr2_RCP_RI_4").Value
  962.     AllK2Tags.DB.GEN_K2_SpareRealArr2_RCP_RI_5.Value = rsSrc.Fields("GEN_K2_SpareRealArr2_RCP_RI_5").Value
  963.     AllK2Tags.DB.GEN_K2_SpareRealArr2_RCP_RI_6.Value = rsSrc.Fields("GEN_K2_SpareRealArr2_RCP_RI_6").Value
  964.     AllK2Tags.DB.GEN_K2_SpareRealArr2_RCP_RI_7.Value = rsSrc.Fields("GEN_K2_SpareRealArr2_RCP_RI_7").Value
  965.     AllK2Tags.DB.GEN_K2_SpareRealArr2_RCP_RI_8.Value = rsSrc.Fields("GEN_K2_SpareRealArr2_RCP_RI_8").Value
  966.     AllK2Tags.DB.GEN_K2_SpareRealArr2_RCP_RI_9.Value = rsSrc.Fields("GEN_K2_SpareRealArr2_RCP_RI_9").Value
  967.     AllK2Tags.DB.K2_HEC_SpareReal_RCP_RO.Value = rsSrc.Fields("K2_HEC_SpareReal_RCP_RO").Value
  968.     AllK2Tags.DB.K2_HEC_TfHead_RCP_RI.Value = rsSrc.Fields("K2_HEC_TfHead_RCP_RI").Value
  969.     AllK2Tags.DB.K2_HEC_TfHeadAccTime_RCP_RO.Value = rsSrc.Fields("K2_HEC_TfHeadAccTime_RCP_RO").Value
  970.     AllK2Tags.DB.K2_HEC_TfHeadRampRateFac_RCP_RI.Value = rsSrc.Fields("K2_HEC_TfHeadRampRateFac_RCP_RI").Value
  971.     AllK2Tags.DB.K2_HEC_TfTail_RCP_RI.Value = rsSrc.Fields("K2_HEC_TfTail_RCP_RI").Value
  972.     AllK2Tags.DB.K2_HEC_TfTailAccTime_RCP_RO.Value = rsSrc.Fields("K2_HEC_TfTailAccTime_RCP_RO").Value
  973.     AllK2Tags.DB.K2_HEC_TfTailRampRateFac_RCP_RI.Value = rsSrc.Fields("K2_HEC_TfTailRampRateFac_RCP_RI").Value
  974.     AllK2Tags.DB.K2_HEC_TfTailTimeDelay_RCP_RO.Value = rsSrc.Fields("K2_HEC_TfTailTimeDelay_RCP_RO").Value
  975.     AllK2Tags.DB.K2_HEC_TfTimeDelay_RCP_RO.Value = rsSrc.Fields("K2_HEC_TfTimeDelay_RCP_RO").Value
  976.     AllK2Tags.DB.K2_HEC_TfTimeDelayFact_RCP_RI.Value = rsSrc.Fields("K2_HEC_TfTimeDelayFact_RCP_RI").Value
  977.     AllK2Tags.DB.K2_TEN_SpareReal_RCP_RI.Value = rsSrc.Fields("K2_TEN_SpareReal_RCP_RI").Value
  978.     AllK2Tags.DB.K2_TEN_Tf_RCP_RI.Value = rsSrc.Fields("K2_TEN_Tf_RCP_RI").Value
  979.     AllK2Tags.DB.K2_TEN_TfActual_RCP_RO.Value = rsSrc.Fields("K2_TEN_TfActual_RCP_RO").Value
  980.     AllK2Tags.DB.LPR_Config_RCP_RI.Value = rsSrc.Fields("LPR_Config_RCP_RI").Value
  981.     AllK2Tags.DB.LPR_DnReacTime_RCP_RI.Value = rsSrc.Fields("LPR_DnReacTime_RCP_RI").Value
  982.     AllK2Tags.DB.LPR_HeightSetpoint_RCP_RI.Value = rsSrc.Fields("LPR_HeightSetpoint_RCP_RI").Value
  983.     AllK2Tags.DB.LPR_Spare_RCP_RI.Value = rsSrc.Fields("LPR_Spare_RCP_RI").Value
  984.     AllK2Tags.DB.LRP_UpReacTime_RCP_RI.Value = rsSrc.Fields("LRP_UpReacTime_RCP_RI").Value
  985.    ' AllK2Tags.DB.RCPDate.Value = rsSrc.Fields("RCPDate").Value
  986.    ' AllK2Tags.DB.RcpDsc.Value = rsSrc.Fields("RCPDsc").Value
  987.     AllK2Tags.DB.RcpGrade.Value = rsSrc.Fields("RcpGrade").Value
  988.     AllK2Tags.DB.RcpID.Value = rsSrc.Fields("RcpID").Value
  989.     AllK2Tags.DB.STD_Area_RCP_RI_1.Value = rsSrc.Fields("STD_Area_RCP_RI_1").Value
  990.     AllK2Tags.DB.STD_Area_RCP_RI_10.Value = rsSrc.Fields("STD_Area_RCP_RI_10").Value
  991.     AllK2Tags.DB.STD_Area_RCP_RI_2.Value = rsSrc.Fields("STD_Area_RCP_RI_2").Value
  992.     AllK2Tags.DB.STD_Area_RCP_RI_3.Value = rsSrc.Fields("STD_Area_RCP_RI_3").Value
  993.     AllK2Tags.DB.STD_Area_RCP_RI_4.Value = rsSrc.Fields("STD_Area_RCP_RI_4").Value
  994.     AllK2Tags.DB.STD_Area_RCP_RI_5.Value = rsSrc.Fields("STD_Area_RCP_RI_5").Value
  995.     AllK2Tags.DB.STD_Area_RCP_RI_6.Value = rsSrc.Fields("STD_Area_RCP_RI_6").Value
  996.     AllK2Tags.DB.STD_Area_RCP_RI_7.Value = rsSrc.Fields("STD_Area_RCP_RI_7").Value
  997.     AllK2Tags.DB.STD_Area_RCP_RI_8.Value = rsSrc.Fields("STD_Area_RCP_RI_8").Value
  998.     AllK2Tags.DB.STD_Area_RCP_RI_9.Value = rsSrc.Fields("STD_Area_RCP_RI_9").Value
  999.     AllK2Tags.DB.STD_Config_RCP_RI_1.Value = rsSrc.Fields("STD_Config_RCP_RI_1").Value
  1000.     AllK2Tags.DB.STD_Config_RCP_RI_1.Value = rsSrc.Fields("STD_Config_RCP_RI_1").Value
  1001.     AllK2Tags.DB.STD_Config_RCP_RI_10.Value = rsSrc.Fields("STD_Config_RCP_RI_10").Value
  1002.     AllK2Tags.DB.STD_Config_RCP_RI_2.Value = rsSrc.Fields("STD_Config_RCP_RI_2").Value
  1003.     AllK2Tags.DB.STD_Config_RCP_RI_3.Value = rsSrc.Fields("STD_Config_RCP_RI_3").Value
  1004.     AllK2Tags.DB.STD_Config_RCP_RI_4.Value = rsSrc.Fields("STD_Config_RCP_RI_4").Value
  1005.     AllK2Tags.DB.STD_Config_RCP_RI_5.Value = rsSrc.Fields("STD_Config_RCP_RI_5").Value
  1006.     AllK2Tags.DB.STD_Config_RCP_RI_6.Value = rsSrc.Fields("STD_Config_RCP_RI_6").Value
  1007.     AllK2Tags.DB.STD_Config_RCP_RI_7.Value = rsSrc.Fields("STD_Config_RCP_RI_7").Value
  1008.     AllK2Tags.DB.STD_Config_RCP_RI_8.Value = rsSrc.Fields("STD_Config_RCP_RI_8").Value
  1009.     AllK2Tags.DB.STD_Config_RCP_RI_9.Value = rsSrc.Fields("STD_Config_RCP_RI_9").Value
  1010.     AllK2Tags.DB.STD_ERD_RCP_RO_1.Value = rsSrc.Fields("STD_ERD_RCP_RO_1").Value
  1011.     AllK2Tags.DB.STD_ERD_RCP_RO_10.Value = rsSrc.Fields("STD_ERD_RCP_RO_10").Value
  1012.     AllK2Tags.DB.STD_ERD_RCP_RO_2.Value = rsSrc.Fields("STD_ERD_RCP_RO_2").Value
  1013.     AllK2Tags.DB.STD_ERD_RCP_RO_3.Value = rsSrc.Fields("STD_ERD_RCP_RO_3").Value
  1014.     AllK2Tags.DB.STD_ERD_RCP_RO_4.Value = rsSrc.Fields("STD_ERD_RCP_RO_4").Value
  1015.     AllK2Tags.DB.STD_ERD_RCP_RO_5.Value = rsSrc.Fields("STD_ERD_RCP_RO_5").Value
  1016.     AllK2Tags.DB.STD_ERD_RCP_RO_6.Value = rsSrc.Fields("STD_ERD_RCP_RO_6").Value
  1017.     AllK2Tags.DB.STD_ERD_RCP_RO_7.Value = rsSrc.Fields("STD_ERD_RCP_RO_7").Value
  1018.     AllK2Tags.DB.STD_ERD_RCP_RO_8.Value = rsSrc.Fields("STD_ERD_RCP_RO_8").Value
  1019.     AllK2Tags.DB.STD_ERD_RCP_RO_9.Value = rsSrc.Fields("STD_ERD_RCP_RO_9").Value
  1020.     AllK2Tags.DB.STD_ERDActual_RCP_RO_1.Value = rsSrc.Fields("STD_ERDActual_RCP_RO_1").Value
  1021.     AllK2Tags.DB.STD_ERDActual_RCP_RO_10.Value = rsSrc.Fields("STD_ERDActual_RCP_RO_10").Value
  1022.     AllK2Tags.DB.STD_ERDActual_RCP_RO_2.Value = rsSrc.Fields("STD_ERDActual_RCP_RO_2").Value
  1023.     AllK2Tags.DB.STD_ERDActual_RCP_RO_3.Value = rsSrc.Fields("STD_ERDActual_RCP_RO_3").Value
  1024.     AllK2Tags.DB.STD_ERDActual_RCP_RO_4.Value = rsSrc.Fields("STD_ERDActual_RCP_RO_4").Value
  1025.     AllK2Tags.DB.STD_ERDActual_RCP_RO_5.Value = rsSrc.Fields("STD_ERDActual_RCP_RO_5").Value
  1026.     AllK2Tags.DB.STD_ERDActual_RCP_RO_6.Value = rsSrc.Fields("STD_ERDActual_RCP_RO_6").Value
  1027.     AllK2Tags.DB.STD_ERDActual_RCP_RO_7.Value = rsSrc.Fields("STD_ERDActual_RCP_RO_7").Value
  1028.     AllK2Tags.DB.STD_ERDActual_RCP_RO_8.Value = rsSrc.Fields("STD_ERDActual_RCP_RO_8").Value
  1029.     AllK2Tags.DB.STD_ERDActual_RCP_RO_9.Value = rsSrc.Fields("STD_ERDActual_RCP_RO_9").Value
  1030.     AllK2Tags.DB.STD_Gap_RCP_RI_1.Value = rsSrc.Fields("STD_Gap_RCP_RI_1").Value
  1031.     AllK2Tags.DB.STD_Gap_RCP_RI_10.Value = rsSrc.Fields("STD_Gap_RCP_RI_10").Value
  1032.     AllK2Tags.DB.STD_Gap_RCP_RI_2.Value = rsSrc.Fields("STD_Gap_RCP_RI_2").Value
  1033.     AllK2Tags.DB.STD_Gap_RCP_RI_3.Value = rsSrc.Fields("STD_Gap_RCP_RI_3").Value
  1034.     AllK2Tags.DB.STD_Gap_RCP_RI_4.Value = rsSrc.Fields("STD_Gap_RCP_RI_4").Value
  1035.     AllK2Tags.DB.STD_Gap_RCP_RI_5.Value = rsSrc.Fields("STD_Gap_RCP_RI_5").Value
  1036.     AllK2Tags.DB.STD_Gap_RCP_RI_6.Value = rsSrc.Fields("STD_Gap_RCP_RI_6").Value
  1037.     AllK2Tags.DB.STD_Gap_RCP_RI_7.Value = rsSrc.Fields("STD_Gap_RCP_RI_7").Value
  1038.     AllK2Tags.DB.STD_Gap_RCP_RI_8.Value = rsSrc.Fields("STD_Gap_RCP_RI_8").Value
  1039.     AllK2Tags.DB.STD_Gap_RCP_RI_9.Value = rsSrc.Fields("STD_Gap_RCP_RI_9").Value
  1040.     AllK2Tags.DB.STD_Gear_SEL_RCP_RI.Value = rsSrc.Fields("STD_Gear_SEL_RCP_RI").Value
  1041.     AllK2Tags.DB.STD_HECFront_RCP_RO_1.Value = rsSrc.Fields("STD_HECFront_RCP_RO_1").Value
  1042.     AllK2Tags.DB.STD_HECFront_RCP_RO_10.Value = rsSrc.Fields("STD_HECFront_RCP_RO_10").Value
  1043.     AllK2Tags.DB.STD_HECFront_RCP_RO_2.Value = rsSrc.Fields("STD_HECFront_RCP_RO_2").Value
  1044.     AllK2Tags.DB.STD_HECFront_RCP_RO_3.Value = rsSrc.Fields("STD_HECFront_RCP_RO_3").Value
  1045.     AllK2Tags.DB.STD_HECFront_RCP_RO_4.Value = rsSrc.Fields("STD_HECFront_RCP_RO_4").Value
  1046.     AllK2Tags.DB.STD_HECFront_RCP_RO_5.Value = rsSrc.Fields("STD_HECFront_RCP_RO_5").Value
  1047.     AllK2Tags.DB.STD_HECFront_RCP_RO_6.Value = rsSrc.Fields("STD_HECFront_RCP_RO_6").Value
  1048.     AllK2Tags.DB.STD_HECFront_RCP_RO_7.Value = rsSrc.Fields("STD_HECFront_RCP_RO_7").Value
  1049.     AllK2Tags.DB.STD_HECFront_RCP_RO_8.Value = rsSrc.Fields("STD_HECFront_RCP_RO_8").Value
  1050.     AllK2Tags.DB.STD_HECFront_RCP_RO_9.Value = rsSrc.Fields("STD_HECFront_RCP_RO_9").Value
  1051.     AllK2Tags.DB.STD_HECTail_RCP_RO_1.Value = rsSrc.Fields("STD_HECTail_RCP_RO_1").Value
  1052.     AllK2Tags.DB.STD_HECTail_RCP_RO_10.Value = rsSrc.Fields("STD_HECTail_RCP_RO_10").Value
  1053.     AllK2Tags.DB.STD_HECTail_RCP_RO_2.Value = rsSrc.Fields("STD_HECTail_RCP_RO_2").Value
  1054.     AllK2Tags.DB.STD_HECTail_RCP_RO_3.Value = rsSrc.Fields("STD_HECTail_RCP_RO_3").Value
  1055.     AllK2Tags.DB.STD_HECTail_RCP_RO_4.Value = rsSrc.Fields("STD_HECTail_RCP_RO_4").Value
  1056.     AllK2Tags.DB.STD_HECTail_RCP_RO_5.Value = rsSrc.Fields("STD_HECTail_RCP_RO_5").Value
  1057.     AllK2Tags.DB.STD_HECTail_RCP_RO_6.Value = rsSrc.Fields("STD_HECTail_RCP_RO_6").Value
  1058.     AllK2Tags.DB.STD_HECTail_RCP_RO_7.Value = rsSrc.Fields("STD_HECTail_RCP_RO_7").Value
  1059.     AllK2Tags.DB.STD_HECTail_RCP_RO_8.Value = rsSrc.Fields("STD_HECTail_RCP_RO_8").Value
  1060.     AllK2Tags.DB.STD_HECTail_RCP_RO_9.Value = rsSrc.Fields("STD_HECTail_RCP_RO_9").Value
  1061.     AllK2Tags.DB.STD_ImpDrop_RCP_RI_1.Value = rsSrc.Fields("STD_ImpDrop_RCP_RI_1").Value
  1062.     AllK2Tags.DB.STD_ImpDrop_RCP_RI_10.Value = rsSrc.Fields("STD_ImpDrop_RCP_RI_10").Value
  1063.     AllK2Tags.DB.STD_ImpDrop_RCP_RI_2.Value = rsSrc.Fields("STD_ImpDrop_RCP_RI_2").Value
  1064.     AllK2Tags.DB.STD_ImpDrop_RCP_RI_3.Value = rsSrc.Fields("STD_ImpDrop_RCP_RI_3").Value
  1065.     AllK2Tags.DB.STD_ImpDrop_RCP_RI_4.Value = rsSrc.Fields("STD_ImpDrop_RCP_RI_4").Value
  1066.     AllK2Tags.DB.STD_ImpDrop_RCP_RI_5.Value = rsSrc.Fields("STD_ImpDrop_RCP_RI_5").Value
  1067.     AllK2Tags.DB.STD_ImpDrop_RCP_RI_6.Value = rsSrc.Fields("STD_ImpDrop_RCP_RI_6").Value
  1068.     AllK2Tags.DB.STD_ImpDrop_RCP_RI_7.Value = rsSrc.Fields("STD_ImpDrop_RCP_RI_7").Value
  1069.     AllK2Tags.DB.STD_ImpDrop_RCP_RI_8.Value = rsSrc.Fields("STD_ImpDrop_RCP_RI_8").Value
  1070.     AllK2Tags.DB.STD_ImpDrop_RCP_RI_9.Value = rsSrc.Fields("STD_ImpDrop_RCP_RI_9").Value
  1071.     AllK2Tags.DB.STD_LeadSpeed_RCP_RI_1.Value = rsSrc.Fields("STD_LeadSpeed_RCP_RI_1").Value
  1072.     AllK2Tags.DB.STD_LeadSpeed_RCP_RI_10.Value = rsSrc.Fields("STD_LeadSpeed_RCP_RI_10").Value
  1073.     AllK2Tags.DB.STD_LeadSpeed_RCP_RI_2.Value = rsSrc.Fields("STD_LeadSpeed_RCP_RI_2").Value
  1074.     AllK2Tags.DB.STD_LeadSpeed_RCP_RI_3.Value = rsSrc.Fields("STD_LeadSpeed_RCP_RI_3").Value
  1075.     AllK2Tags.DB.STD_LeadSpeed_RCP_RI_4.Value = rsSrc.Fields("STD_LeadSpeed_RCP_RI_4").Value
  1076.     AllK2Tags.DB.STD_LeadSpeed_RCP_RI_5.Value = rsSrc.Fields("STD_LeadSpeed_RCP_RI_5").Value
  1077.     AllK2Tags.DB.STD_LeadSpeed_RCP_RI_6.Value = rsSrc.Fields("STD_LeadSpeed_RCP_RI_6").Value
  1078.     AllK2Tags.DB.STD_LeadSpeed_RCP_RI_7.Value = rsSrc.Fields("STD_LeadSpeed_RCP_RI_7").Value
  1079.     AllK2Tags.DB.STD_LeadSpeed_RCP_RI_8.Value = rsSrc.Fields("STD_LeadSpeed_RCP_RI_8").Value
  1080.     AllK2Tags.DB.STD_LeadSpeed_RCP_RI_9.Value = rsSrc.Fields("STD_LeadSpeed_RCP_RI_9").Value
  1081.     AllK2Tags.DB.STD_LinSpeed_RCP_RI_1.Value = rsSrc.Fields("STD_LinSpeed_RCP_RI_1").Value
  1082.     AllK2Tags.DB.STD_LinSpeed_RCP_RI_10.Value = rsSrc.Fields("STD_LinSpeed_RCP_RI_10").Value
  1083.     AllK2Tags.DB.STD_LinSpeed_RCP_RI_2.Value = rsSrc.Fields("STD_LinSpeed_RCP_RI_2").Value
  1084.     AllK2Tags.DB.STD_LinSpeed_RCP_RI_3.Value = rsSrc.Fields("STD_LinSpeed_RCP_RI_3").Value
  1085.     AllK2Tags.DB.STD_LinSpeed_RCP_RI_4.Value = rsSrc.Fields("STD_LinSpeed_RCP_RI_4").Value
  1086.     AllK2Tags.DB.STD_LinSpeed_RCP_RI_5.Value = rsSrc.Fields("STD_LinSpeed_RCP_RI_5").Value
  1087.     AllK2Tags.DB.STD_LinSpeed_RCP_RI_6.Value = rsSrc.Fields("STD_LinSpeed_RCP_RI_6").Value
  1088.     AllK2Tags.DB.STD_LinSpeed_RCP_RI_7.Value = rsSrc.Fields("STD_LinSpeed_RCP_RI_7").Value
  1089.     AllK2Tags.DB.STD_LinSpeed_RCP_RI_8.Value = rsSrc.Fields("STD_LinSpeed_RCP_RI_8").Value
  1090.     AllK2Tags.DB.STD_LinSpeed_RCP_RI_9.Value = rsSrc.Fields("STD_LinSpeed_RCP_RI_9").Value
  1091.     AllK2Tags.DB.STD_Mode_RCP_RI_1.Value = rsSrc.Fields("STD_Mode_RCP_RI_1").Value
  1092.     AllK2Tags.DB.STD_Mode_RCP_RI_10.Value = rsSrc.Fields("STD_Mode_RCP_RI_10").Value
  1093.     AllK2Tags.DB.STD_Mode_RCP_RI_2.Value = rsSrc.Fields("STD_Mode_RCP_RI_2").Value
  1094.     AllK2Tags.DB.STD_Mode_RCP_RI_3.Value = rsSrc.Fields("STD_Mode_RCP_RI_3").Value
  1095.     AllK2Tags.DB.STD_Mode_RCP_RI_4.Value = rsSrc.Fields("STD_Mode_RCP_RI_4").Value
  1096.     AllK2Tags.DB.STD_Mode_RCP_RI_5.Value = rsSrc.Fields("STD_Mode_RCP_RI_5").Value
  1097.     AllK2Tags.DB.STD_Mode_RCP_RI_6.Value = rsSrc.Fields("STD_Mode_RCP_RI_6").Value
  1098.     AllK2Tags.DB.STD_Mode_RCP_RI_7.Value = rsSrc.Fields("STD_Mode_RCP_RI_7").Value
  1099.     AllK2Tags.DB.STD_Mode_RCP_RI_8.Value = rsSrc.Fields("STD_Mode_RCP_RI_8").Value
  1100.     AllK2Tags.DB.STD_Mode_RCP_RI_9.Value = rsSrc.Fields("STD_Mode_RCP_RI_9").Value
  1101.     AllK2Tags.DB.STD_ORD_RCP_RI_1.Value = rsSrc.Fields("STD_ORD_RCP_RI_1").Value
  1102.     AllK2Tags.DB.STD_ORD_RCP_RI_10.Value = rsSrc.Fields("STD_ORD_RCP_RI_10").Value
  1103.     AllK2Tags.DB.STD_ORD_RCP_RI_2.Value = rsSrc.Fields("STD_ORD_RCP_RI_2").Value
  1104.     AllK2Tags.DB.STD_ORD_RCP_RI_3.Value = rsSrc.Fields("STD_ORD_RCP_RI_3").Value
  1105.     AllK2Tags.DB.STD_ORD_RCP_RI_4.Value = rsSrc.Fields("STD_ORD_RCP_RI_4").Value
  1106.     AllK2Tags.DB.STD_ORD_RCP_RI_5.Value = rsSrc.Fields("STD_ORD_RCP_RI_5").Value
  1107.     AllK2Tags.DB.STD_ORD_RCP_RI_6.Value = rsSrc.Fields("STD_ORD_RCP_RI_6").Value
  1108.     AllK2Tags.DB.STD_ORD_RCP_RI_7.Value = rsSrc.Fields("STD_ORD_RCP_RI_7").Value
  1109.     AllK2Tags.DB.STD_ORD_RCP_RI_8.Value = rsSrc.Fields("STD_ORD_RCP_RI_8").Value
  1110.     AllK2Tags.DB.STD_ORD_RCP_RI_9.Value = rsSrc.Fields("STD_ORD_RCP_RI_9").Value
  1111.     AllK2Tags.DB.STD_PassNumber_RCP_RI_1.Value = rsSrc.Fields("STD_PassNumber_RCP_RI_1").Value
  1112.     AllK2Tags.DB.STD_PassNumber_RCP_RI_10.Value = rsSrc.Fields("STD_PassNumber_RCP_RI_10").Value
  1113.     AllK2Tags.DB.STD_PassNumber_RCP_RI_2.Value = rsSrc.Fields("STD_PassNumber_RCP_RI_2").Value
  1114.     AllK2Tags.DB.STD_PassNumber_RCP_RI_3.Value = rsSrc.Fields("STD_PassNumber_RCP_RI_3").Value
  1115.     AllK2Tags.DB.STD_PassNumber_RCP_RI_4.Value = rsSrc.Fields("STD_PassNumber_RCP_RI_4").Value
  1116.     AllK2Tags.DB.STD_PassNumber_RCP_RI_5.Value = rsSrc.Fields("STD_PassNumber_RCP_RI_5").Value
  1117.     AllK2Tags.DB.STD_PassNumber_RCP_RI_6.Value = rsSrc.Fields("STD_PassNumber_RCP_RI_6").Value
  1118.     AllK2Tags.DB.STD_PassNumber_RCP_RI_7.Value = rsSrc.Fields("STD_PassNumber_RCP_RI_7").Value
  1119.     AllK2Tags.DB.STD_PassNumber_RCP_RI_8.Value = rsSrc.Fields("STD_PassNumber_RCP_RI_8").Value
  1120.     AllK2Tags.DB.STD_PassNumber_RCP_RI_9.Value = rsSrc.Fields("STD_PassNumber_RCP_RI_9").Value
  1121.     AllK2Tags.DB.STD_Reduction_RCP_RI_1.Value = rsSrc.Fields("STD_Reduction_RCP_RI_1").Value
  1122.     AllK2Tags.DB.STD_Reduction_RCP_RI_10.Value = rsSrc.Fields("STD_Reduction_RCP_RI_10").Value
  1123.     AllK2Tags.DB.STD_Reduction_RCP_RI_2.Value = rsSrc.Fields("STD_Reduction_RCP_RI_2").Value
  1124.   ' AllK2Tags.DB.STD_Reduction_RCP_RI_3.Value = rsSrc.Fields("STD_Reduction_RCP_RI_3").Value
  1125.   ' AllK2Tags.DB.STD_Reduction_RCP_RI_4.Value = rsSrc.Fields("STD_Reduction_RCP_RI_4").Value
  1126.   ' AllK2Tags.DB.STD_Reduction_RCP_RI_5.Value = rsSrc.Fields("STD_Reduction_RCP_RI_5").Value
  1127.   ' AllK2Tags.DB.STD_Reduction_RCP_RI_6.Value = rsSrc.Fields("STD_Reduction_RCP_RI_6").Value
  1128.   ' AllK2Tags.DB.STD_Reduction_RCP_RI_7.Value = rsSrc.Fields("STD_Reduction_RCP_RI_7").Value
  1129.   ' AllK2Tags.DB.STD_Reduction_RCP_RI_8.Value = rsSrc.Fields("STD_Reduction_RCP_RI_8").Value
  1130.   ' AllK2Tags.DB.STD_Reduction_RCP_RI_9.Value = rsSrc.Fields("STD_Reduction_RCP_RI_9").Value
  1131.     AllK2Tags.DB.STD_Rfact_RCP_RI_1.Value = rsSrc.Fields("STD_Rfact_RCP_RI_1").Value
  1132.     AllK2Tags.DB.STD_Rfact_RCP_RI_10.Value = rsSrc.Fields("STD_Rfact_RCP_RI_10").Value
  1133.     AllK2Tags.DB.STD_Rfact_RCP_RI_2.Value = rsSrc.Fields("STD_Rfact_RCP_RI_2").Value
  1134.     AllK2Tags.DB.STD_Rfact_RCP_RI_3.Value = rsSrc.Fields("STD_Rfact_RCP_RI_3").Value
  1135.     AllK2Tags.DB.STD_Rfact_RCP_RI_4.Value = rsSrc.Fields("STD_Rfact_RCP_RI_4").Value
  1136.     AllK2Tags.DB.STD_Rfact_RCP_RI_5.Value = rsSrc.Fields("STD_Rfact_RCP_RI_5").Value
  1137.     AllK2Tags.DB.STD_Rfact_RCP_RI_6.Value = rsSrc.Fields("STD_Rfact_RCP_RI_6").Value
  1138.     AllK2Tags.DB.STD_Rfact_RCP_RI_7.Value = rsSrc.Fields("STD_Rfact_RCP_RI_7").Value
  1139.     AllK2Tags.DB.STD_Rfact_RCP_RI_8.Value = rsSrc.Fields("STD_Rfact_RCP_RI_8").Value
  1140.     AllK2Tags.DB.STD_Rfact_RCP_RI_9.Value = rsSrc.Fields("STD_Rfact_RCP_RI_9").Value
  1141.     AllK2Tags.DB.STD_RollSetID_RCP_RI_1.Value = rsSrc.Fields("STD_RollSetID_RCP_RI_1").Value
  1142.     AllK2Tags.DB.STD_RollSetID_RCP_RI_10.Value = rsSrc.Fields("STD_RollSetID_RCP_RI_10").Value
  1143.     AllK2Tags.DB.STD_RollSetID_RCP_RI_2.Value = rsSrc.Fields("STD_RollSetID_RCP_RI_2").Value
  1144.     AllK2Tags.DB.STD_RollSetID_RCP_RI_3.Value = rsSrc.Fields("STD_RollSetID_RCP_RI_3").Value
  1145.     AllK2Tags.DB.STD_RollSetID_RCP_RI_4.Value = rsSrc.Fields("STD_RollSetID_RCP_RI_4").Value
  1146.     AllK2Tags.DB.STD_RollSetID_RCP_RI_5.Value = rsSrc.Fields("STD_RollSetID_RCP_RI_5").Value
  1147.     AllK2Tags.DB.STD_RollSetID_RCP_RI_6.Value = rsSrc.Fields("STD_RollSetID_RCP_RI_6").Value
  1148.     AllK2Tags.DB.STD_RollSetID_RCP_RI_7.Value = rsSrc.Fields("STD_RollSetID_RCP_RI_7").Value
  1149.     AllK2Tags.DB.STD_RollSetID_RCP_RI_8.Value = rsSrc.Fields("STD_RollSetID_RCP_RI_8").Value
  1150.     AllK2Tags.DB.STD_RollSetID_RCP_RI_9.Value = rsSrc.Fields("STD_RollSetID_RCP_RI_9").Value
  1151.     AllK2Tags.DB.STD_RollSetID2_RCP_RI_1.Value = rsSrc.Fields("STD_RollSetID2_RCP_RI_1").Value
  1152.     AllK2Tags.DB.STD_RollSetID2_RCP_RI_10.Value = rsSrc.Fields("STD_RollSetID2_RCP_RI_10").Value
  1153.     AllK2Tags.DB.STD_RollSetID2_RCP_RI_2.Value = rsSrc.Fields("STD_RollSetID2_RCP_RI_2").Value
  1154.     AllK2Tags.DB.STD_RollSetID2_RCP_RI_3.Value = rsSrc.Fields("STD_RollSetID2_RCP_RI_3").Value
  1155.     AllK2Tags.DB.STD_RollSetID2_RCP_RI_4.Value = rsSrc.Fields("STD_RollSetID2_RCP_RI_4").Value
  1156.     AllK2Tags.DB.STD_RollSetID2_RCP_RI_5.Value = rsSrc.Fields("STD_RollSetID2_RCP_RI_5").Value
  1157.     AllK2Tags.DB.STD_RollSetID2_RCP_RI_6.Value = rsSrc.Fields("STD_RollSetID2_RCP_RI_6").Value
  1158.     AllK2Tags.DB.STD_RollSetID2_RCP_RI_7.Value = rsSrc.Fields("STD_RollSetID2_RCP_RI_7").Value
  1159.     AllK2Tags.DB.STD_RollSetID2_RCP_RI_8.Value = rsSrc.Fields("STD_RollSetID2_RCP_RI_8").Value
  1160.     AllK2Tags.DB.STD_RollSetID2_RCP_RI_9.Value = rsSrc.Fields("STD_RollSetID2_RCP_RI_9").Value
  1161.     AllK2Tags.DB.STD_RollShape_RCP_RI_1.Value = rsSrc.Fields("STD_RollShape_RCP_RI_1").Value
  1162.     AllK2Tags.DB.STD_RollShape_RCP_RI_10.Value = rsSrc.Fields("STD_RollShape_RCP_RI_10").Value
  1163.     AllK2Tags.DB.STD_RollShape_RCP_RI_2.Value = rsSrc.Fields("STD_RollShape_RCP_RI_2").Value
  1164.     AllK2Tags.DB.STD_RollShape_RCP_RI_3.Value = rsSrc.Fields("STD_RollShape_RCP_RI_3").Value
  1165.     AllK2Tags.DB.STD_RollShape_RCP_RI_4.Value = rsSrc.Fields("STD_RollShape_RCP_RI_4").Value
  1166.     AllK2Tags.DB.STD_RollShape_RCP_RI_5.Value = rsSrc.Fields("STD_RollShape_RCP_RI_5").Value
  1167.     AllK2Tags.DB.STD_RollShape_RCP_RI_6.Value = rsSrc.Fields("STD_RollShape_RCP_RI_6").Value
  1168.     AllK2Tags.DB.STD_RollShape_RCP_RI_7.Value = rsSrc.Fields("STD_RollShape_RCP_RI_7").Value
  1169.     AllK2Tags.DB.STD_RollShape_RCP_RI_8.Value = rsSrc.Fields("STD_RollShape_RCP_RI_8").Value
  1170.     AllK2Tags.DB.STD_RollShape_RCP_RI_9.Value = rsSrc.Fields("STD_RollShape_RCP_RI_9").Value
  1171.     AllK2Tags.DB.STD_RPM_RCP_RO_1.Value = rsSrc.Fields("STD_RPM_RCP_RO_1").Value
  1172.     AllK2Tags.DB.STD_RPM_RCP_RO_10.Value = rsSrc.Fields("STD_RPM_RCP_RO_10").Value
  1173.     AllK2Tags.DB.STD_RPM_RCP_RO_2.Value = rsSrc.Fields("STD_RPM_RCP_RO_2").Value
  1174.     AllK2Tags.DB.STD_RPM_RCP_RO_3.Value = rsSrc.Fields("STD_RPM_RCP_RO_3").Value
  1175.     AllK2Tags.DB.STD_RPM_RCP_RO_4.Value = rsSrc.Fields("STD_RPM_RCP_RO_4").Value
  1176.     AllK2Tags.DB.STD_RPM_RCP_RO_5.Value = rsSrc.Fields("STD_RPM_RCP_RO_5").Value
  1177.     AllK2Tags.DB.STD_RPM_RCP_RO_6.Value = rsSrc.Fields("STD_RPM_RCP_RO_6").Value
  1178.     AllK2Tags.DB.STD_RPM_RCP_RO_7.Value = rsSrc.Fields("STD_RPM_RCP_RO_7").Value
  1179.     AllK2Tags.DB.STD_RPM_RCP_RO_8.Value = rsSrc.Fields("STD_RPM_RCP_RO_8").Value
  1180.     AllK2Tags.DB.STD_RPM_RCP_RO_9.Value = rsSrc.Fields("STD_RPM_RCP_RO_9").Value
  1181.     AllK2Tags.DB.STD_RollShape_RCP_RI_1.Value = rsSrc.Fields("STD_RollShape_RCP_RI_1").Value
  1182.     AllK2Tags.DB.STD_RollShape_RCP_RI_10.Value = rsSrc.Fields("STD_RollShape_RCP_RI_10").Value
  1183.     AllK2Tags.DB.STD_RollShape_RCP_RI_2.Value = rsSrc.Fields("STD_RollShape_RCP_RI_2").Value
  1184.     AllK2Tags.DB.STD_RollShape_RCP_RI_3.Value = rsSrc.Fields("STD_RollShape_RCP_RI_3").Value
  1185.     AllK2Tags.DB.STD_RollShape_RCP_RI_4.Value = rsSrc.Fields("STD_RollShape_RCP_RI_4").Value
  1186.     AllK2Tags.DB.STD_RollShape_RCP_RI_5.Value = rsSrc.Fields("STD_RollShape_RCP_RI_5").Value
  1187.     AllK2Tags.DB.STD_RollShape_RCP_RI_6.Value = rsSrc.Fields("STD_RollShape_RCP_RI_6").Value
  1188.     AllK2Tags.DB.STD_RollShape_RCP_RI_7.Value = rsSrc.Fields("STD_RollShape_RCP_RI_7").Value
  1189.     AllK2Tags.DB.STD_RollShape_RCP_RI_8.Value = rsSrc.Fields("STD_RollShape_RCP_RI_8").Value
  1190.     AllK2Tags.DB.STD_RollShape_RCP_RI_9.Value = rsSrc.Fields("STD_RollShape_RCP_RI_9").Value
  1191.     AllK2Tags.DB.STD_SpareInt_RCP_RI_1.Value = rsSrc.Fields("STD_SpareInt_RCP_RI_1").Value
  1192.     AllK2Tags.DB.STD_SpareInt_RCP_RI_10.Value = rsSrc.Fields("STD_SpareInt_RCP_RI_10").Value
  1193.     AllK2Tags.DB.STD_SpareInt_RCP_RI_2.Value = rsSrc.Fields("STD_SpareInt_RCP_RI_2").Value
  1194.     AllK2Tags.DB.STD_SpareInt_RCP_RI_3.Value = rsSrc.Fields("STD_SpareInt_RCP_RI_3").Value
  1195.     AllK2Tags.DB.STD_SpareInt_RCP_RI_4.Value = rsSrc.Fields("STD_SpareInt_RCP_RI_4").Value
  1196.     AllK2Tags.DB.STD_SpareInt_RCP_RI_5.Value = rsSrc.Fields("STD_SpareInt_RCP_RI_5").Value
  1197.     AllK2Tags.DB.STD_SpareInt_RCP_RI_6.Value = rsSrc.Fields("STD_SpareInt_RCP_RI_6").Value
  1198.     AllK2Tags.DB.STD_SpareInt_RCP_RI_7.Value = rsSrc.Fields("STD_SpareInt_RCP_RI_7").Value
  1199.     AllK2Tags.DB.STD_SpareInt_RCP_RI_8.Value = rsSrc.Fields("STD_SpareInt_RCP_RI_8").Value
  1200.     AllK2Tags.DB.STD_SpareInt_RCP_RI_9.Value = rsSrc.Fields("STD_SpareInt_RCP_RI_9").Value
  1201.     AllK2Tags.DB.STD_SpareReal_RCP_RI_1.Value = rsSrc.Fields("STD_SpareReal_RCP_RI_1").Value
  1202.     AllK2Tags.DB.STD_SpareReal_RCP_RI_10.Value = rsSrc.Fields("STD_SpareReal_RCP_RI_10").Value
  1203.     AllK2Tags.DB.STD_SpareReal_RCP_RI_2.Value = rsSrc.Fields("STD_SpareReal_RCP_RI_2").Value
  1204.     AllK2Tags.DB.STD_SpareReal_RCP_RI_3.Value = rsSrc.Fields("STD_SpareReal_RCP_RI_3").Value
  1205.     AllK2Tags.DB.STD_SpareReal_RCP_RI_4.Value = rsSrc.Fields("STD_SpareReal_RCP_RI_4").Value
  1206.     AllK2Tags.DB.STD_SpareReal_RCP_RI_5.Value = rsSrc.Fields("STD_SpareReal_RCP_RI_5").Value
  1207.     AllK2Tags.DB.STD_SpareReal_RCP_RI_6.Value = rsSrc.Fields("STD_SpareReal_RCP_RI_6").Value
  1208.     AllK2Tags.DB.STD_SpareReal_RCP_RI_7.Value = rsSrc.Fields("STD_SpareReal_RCP_RI_7").Value
  1209.     AllK2Tags.DB.STD_SpareReal_RCP_RI_8.Value = rsSrc.Fields("STD_SpareReal_RCP_RI_8").Value
  1210.     AllK2Tags.DB.STD_SpareReal_RCP_RI_9.Value = rsSrc.Fields("STD_SpareReal_RCP_RI_9").Value
  1211.     AllK2Tags.DB.STD_TangentAngle_RCP_RI_1.Value = rsSrc.Fields("STD_TangentAngle_RCP_RI_1").Value
  1212.     AllK2Tags.DB.STD_TangentAngle_RCP_RI_10.Value = rsSrc.Fields("STD_TangentAngle_RCP_RI_10").Value
  1213.     AllK2Tags.DB.STD_TangentAngle_RCP_RI_2.Value = rsSrc.Fields("STD_TangentAngle_RCP_RI_2").Value
  1214.     AllK2Tags.DB.STD_TangentAngle_RCP_RI_3.Value = rsSrc.Fields("STD_TangentAngle_RCP_RI_3").Value
  1215.     AllK2Tags.DB.STD_TangentAngle_RCP_RI_4.Value = rsSrc.Fields("STD_TangentAngle_RCP_RI_4").Value
  1216.     AllK2Tags.DB.STD_TangentAngle_RCP_RI_5.Value = rsSrc.Fields("STD_TangentAngle_RCP_RI_5").Value
  1217.     AllK2Tags.DB.STD_TangentAngle_RCP_RI_6.Value = rsSrc.Fields("STD_TangentAngle_RCP_RI_6").Value
  1218.     AllK2Tags.DB.STD_TangentAngle_RCP_RI_7.Value = rsSrc.Fields("STD_TangentAngle_RCP_RI_7").Value
  1219.     AllK2Tags.DB.STD_TangentAngle_RCP_RI_8.Value = rsSrc.Fields("STD_TangentAngle_RCP_RI_8").Value
  1220.     AllK2Tags.DB.STD_TangentAngle_RCP_RI_9.Value = rsSrc.Fields("STD_TangentAngle_RCP_RI_9").Value
  1221.    
  1222.     Exit Sub
  1223.    
  1224. ErrHandler:
  1225.     MsgBox Err.Description
  1226.  
  1227. End Sub
  1228.  
  1229. Private Function MoveProductEntry(ByRef mp As MoveProduct, Optional bErase As Boolean = False)
  1230.     Dim bTxt As Boolean
  1231.     Dim i As Integer
  1232. '    Dim strFld, strVal As String
  1233.     Dim cmd As New ADODB.Command
  1234.     Dim rsSrc As New ADODB.Recordset
  1235.     On Error GoTo ErrHandler
  1236.  
  1237.        
  1238.     ' the whole contents of the destination table must be erased, e.g download operation,
  1239.     ' where a single product entry is copied and the destination is the download table
  1240.     If (bErase) Then
  1241.         cmd.ActiveConnection = mp.cnDst
  1242.         cmd.CommandText = "DELETE FROM " & mp.strTable
  1243.         cmd.Execute
  1244.          
  1245.         cmd.CommandText = "SELECT * FROM " & mp.strTable & " WHERE RcpID = '" & mp.strId & "'"
  1246.         rsSrc.Open cmd.CommandText, mp.cnSrc
  1247.          
  1248.         If (rsSrc.BOF And rsSrc.EOF) Then
  1249.             MoveProductEntry = -1
  1250.             Exit Function
  1251.         End If
  1252.   ' a single product entry with a particular ID from the destination table must be erased, e.g upload operation,
  1253.     ' where a single product entry is copied and the destination is the main recipe table
  1254.     Else
  1255.         cmd.CommandText = "SELECT * FROM " & mp.strTable
  1256.         rsSrc.Open cmd.CommandText, mp.cnSrc
  1257.        
  1258.         If (rsSrc.BOF And rsSrc.EOF) Then
  1259.             MoveProductEntry = -1
  1260.             Exit Function
  1261.         End If
  1262.        
  1263.         If (rsSrc.BOF = False) Then
  1264.             rsSrc.MoveFirst
  1265.         End If
  1266.          
  1267.         cmd.CommandText = "SELECT * FROM " & mp.strTable & " WHERE RcpID = '" & rsSrc("RcpID") & "'"
  1268.         rsDst.Open cmd.CommandText, mp.cnDst
  1269.        
  1270.         If ((rsDst.BOF And rsDst.EOF) = False) Then
  1271.             cmd.ActiveConnection = mp.cnDst
  1272.             cmd.CommandText = "DELETE FROM " & mp.strTable & " WHERE RcpID = '" & rsSrc("RcpID") & "'"
  1273.             cmd.Execute
  1274.         End If
  1275.     End If
  1276.        
  1277.     If (rsSrc.BOF = False) Then
  1278.         rsSrc.MoveFirst
  1279.     End If
  1280.  
  1281.         cmd.CommandText = "INSERT INTO [Perryman_Temp]." & mp.strTable & " SELECT * FROM [Perryman]." & mp.strTable & " WHERE RcpID = '" & rsSrc("RcpID") & "'"
  1282.         cmd.ActiveConnection = mp.cnDst
  1283.         cmd.Execute
  1284.            
  1285.         rsSrc.MoveNext
  1286.        
  1287.     Exit Function
  1288.    
  1289. ErrHandler:
  1290.     MsgBox Err.Description
  1291.        
  1292. End Function
  1293.        
  1294. Private Sub Display_KeyUp(ByVal KeyCode As Integer, ByVal Shift As Integer)
  1295.  
  1296. End Sub
  1297.  
  1298. ' * * * * * * * * THIS ROUTINE WORKS - DO NOT MODIFY IT  * * * * * * * *
  1299.  
  1300.  
  1301. Private Sub Display_Load()
  1302.  Set ThisDisplay.MyTagGroup = Application.CreateTagGroup(ThisDisplay.AreaName)
  1303.  
  1304.  InductoATagsModule.AddInductoAGroup
  1305.  InductoBTagsModule.AddInductoBGroup
  1306.  K2SetupTagModule.AddK2SetupGroup
  1307.  KocksSetupTagModule.AddKocksSetupGroup
  1308.  QSetupTagModule.AddQSetupGroup
  1309.  MasterTagModule.AddMasterTag
  1310.  QProdModule.AddQProdGroup
  1311.  PopUpTagModule.AddPopUpTag
  1312.  
  1313.  
  1314.  
  1315. ' Defining Height and Width for flxResult object Column
  1316.  flxResult.ColWidth(1) = 5000
  1317.  flxResult.ColWidth(2) = 1000
  1318.  flxResult.ColWidth(3) = 1000
  1319.  flxResult.ColWidth(4) = 1500
  1320.  flxResult.ColWidth(5) = 8500
  1321.  flxResult.ColWidth(6) = 2200
  1322.      
  1323.  RcpID.Width = 155
  1324.  RcpID.Height = 25
  1325.  RcpGrade.Width = 155
  1326.  RcpGrade.Height = 25
  1327.  RcpRough.Width = 155
  1328.  RcpRough.Height = 25
  1329.  RcpFinish.Width = 155
  1330.  RcpFinish.Height = 25
  1331.  RcpDsc.Width = 155
  1332.  RcpDsc.Height = 25
  1333.  
  1334.  'AddCbLt "RcpGrade"
  1335.  'AddLtEntry "RcpGrade", "0", "Undefined"
  1336.  'AddLtEntry "RcpGrade", "1", "TI 6/4"
  1337.  'AddLtEntry "RcpGrade", "2", "NI"
  1338.  'AddLtEntry "RcpGrade", "3", "CP"
  1339.  'AddLtEntry "RcpGrade", "4", "Steel"
  1340.  'AddLtEntry "RcpGrade", "", "Other"
  1341.  
  1342.    
  1343. ' Define how many colum and Row the Matrix will have
  1344. '   flxResult.Cols = 6
  1345. '   flxResult.Rows = 20
  1346.     flxResult.TextMatrix(0, 1) = "Setup ID"
  1347.     flxResult.TextMatrix(0, 2) = "Grade"
  1348.     flxResult.TextMatrix(0, 3) = "Rough"
  1349.     flxResult.TextMatrix(0, 4) = "Finish"
  1350.     flxResult.TextMatrix(0, 5) = "Description"
  1351.     flxResult.TextMatrix(0, 6) = "Date"
  1352.    
  1353.     strTable = "dbo.Master"
  1354.     strCdn = ""
  1355.     strSql = "SELECT * FROM " & strTable
  1356.     clType.RemoveAll
  1357.    
  1358. 'Initializa ComboBox
  1359.     InitCb
  1360.     flxResult.TextMatrix(0, 1) = "Setup ID"
  1361.     flxResult.TextMatrix(0, 2) = "Grade"
  1362.     flxResult.TextMatrix(0, 3) = "Rough"
  1363.     flxResult.TextMatrix(0, 4) = "Finish"
  1364.     flxResult.TextMatrix(0, 5) = "Description"
  1365.     flxResult.TextMatrix(0, 6) = "Date"
  1366.        
  1367. End Sub
  1368.  
  1369.  
  1370. ' * * * * * * * * THIS ROUTINE WORKS - DO NOT MODIFY IT  * * * * * * * *
  1371.  
  1372.  
  1373. Private Sub InitCb() 'THIS ROUTINE WORKS - DO NOT MODIFY IT
  1374.     Dim strCol, strSql, strVal, strDsc As String
  1375.     Dim cn As New ADODB.Connection
  1376.     Dim rs As New ADODB.Recordset
  1377.  
  1378.     RcpID.Clear
  1379.     RcpID.AddItem "N/A"
  1380.     RcpGrade.Clear
  1381.     RcpGrade.AddItem "N/A"
  1382.     RcpRough.Clear
  1383.     RcpRough.AddItem "N/A"
  1384.     RcpFinish.Clear
  1385.     RcpFinish.AddItem "N/A"
  1386.     RcpDsc.Clear
  1387.     RcpDsc.AddItem "N/A"
  1388.  
  1389.  
  1390.     cn.Open ("DSN=DSN_Perryman")
  1391.  
  1392.  ' * * * * * * * * * Recipe ID * * * * * * * * *
  1393.     strCol = RcpID.Name
  1394.     LTrim (strCol)
  1395.     RTrim (strCol)
  1396.    
  1397.     If (strCol = "") Then
  1398.         Exit Sub
  1399.     End If
  1400.  
  1401.     strSql = "SELECT DISTINCT " & strCol & " FROM dbo.Master"
  1402.  
  1403.     rs.Open strSql, cn, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly
  1404.  
  1405.     If ((rs.Fields(0).Type = ADODB.DataTypeEnum.adVarChar) Or (rs.Fields(0).Type = ADODB.DataTypeEnum.adWChar)) Then
  1406.         clType.Add RcpID.Name, ""
  1407.     End If
  1408.  
  1409.     If (rs.BOF And rs.EOF) Then
  1410.         Exit Sub
  1411.     End If
  1412.  
  1413.     rs.MoveFirst
  1414.     While (rs.EOF = False)
  1415.         strVal = ""
  1416.         If ((rs.Fields(0) Is Nothing) = False) Then
  1417.             strVal = rs.Fields(0).Value
  1418.         End If
  1419.  
  1420.         LTrim (strVal)
  1421.         RTrim (strVal)
  1422.  
  1423.         If (strVal <> "") Then
  1424.             strDsc = ""
  1425.             If (clLtDb.Exists(RcpID.Name)) Then
  1426.                 GetLtDsc RcpID.Name, CStr(strVal), strDsc
  1427.                 strDsc = LTrim(strDsc)
  1428.                 strDsc = RTrim(strDsc)
  1429.                 If (strDsc <> "") Then
  1430.                     RcpID.AddItem (strDsc)
  1431.                 End If
  1432.             Else
  1433.                 RcpID.AddItem (strVal)
  1434.             End If
  1435.         End If
  1436.         rs.MoveNext
  1437.     Wend
  1438.  
  1439.     If (RcpID.ListCount > 0) Then
  1440.         RcpID.ListIndex = 0
  1441.     End If
  1442.    
  1443.     rs.Close
  1444.    
  1445.    
  1446.    
  1447.  ' * * * * * * * * * Recipe Grade * * * * * * * * *
  1448.     strCol = RcpGrade.Name
  1449.     LTrim (strCol)
  1450.     RTrim (strCol)
  1451.    
  1452.     If (strCol = "") Then
  1453.         Exit Sub
  1454.     End If
  1455.  
  1456.     strSql = "SELECT DISTINCT " & strCol & " FROM dbo.Master"
  1457.  
  1458.     rs.Open strSql, cn, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly
  1459.  
  1460.     If ((rs.Fields(0).Type = ADODB.DataTypeEnum.adVarChar) Or (rs.Fields(0).Type = ADODB.DataTypeEnum.adWChar)) Then
  1461.         clType.Add RcpGrade.Name, ""
  1462.     End If
  1463.  
  1464.     If (rs.BOF And rs.EOF) Then
  1465.         Exit Sub
  1466.     End If
  1467.  
  1468.     rs.MoveFirst
  1469.     While (rs.EOF = False)
  1470.         strVal = ""
  1471.         If ((rs.Fields(0) Is Nothing) = False) Then
  1472.             strVal = rs.Fields(0).Value
  1473.         End If
  1474.  
  1475.         LTrim (strVal)
  1476.         RTrim (strVal)
  1477.  
  1478.         If (strVal <> "") Then
  1479.             strDsc = ""
  1480.             If (clLtDb.Exists(RcpGrade.Name)) Then
  1481.                 GetLtDsc RcpGrade.Name, CStr(strVal), strDsc
  1482.                 strDsc = LTrim(strDsc)
  1483.                 strDsc = RTrim(strDsc)
  1484.                 If (strDsc <> "") Then
  1485.                     RcpGrade.AddItem (strDsc)
  1486.                 End If
  1487.             Else
  1488.                 RcpGrade.AddItem (strVal)
  1489.             End If
  1490.         End If
  1491.         rs.MoveNext
  1492.     Wend
  1493.  
  1494.     If (RcpGrade.ListCount > 0) Then
  1495.         RcpGrade.ListIndex = 0
  1496.     End If
  1497.    
  1498.     rs.Close
  1499.    
  1500.    
  1501. ' * * * * * * * * * Recipe Rough * * * * * * * * *
  1502.     strCol = RcpRough.Name
  1503.     LTrim (strCol)
  1504.     RTrim (strCol)
  1505.     If (strCol = "") Then
  1506.         Exit Sub
  1507.     End If
  1508.     strSql = "SELECT DISTINCT " & strCol & " FROM dbo.Master"
  1509.     rs.Open strSql, cn, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly
  1510.     If ((rs.Fields(0).Type = ADODB.DataTypeEnum.adVarChar) Or (rs.Fields(0).Type = ADODB.DataTypeEnum.adWChar)) Then
  1511.         clType.Add RcpRough.Name, ""
  1512.     End If
  1513.     If (rs.BOF And rs.EOF) Then
  1514.         Exit Sub
  1515.     End If
  1516.     rs.MoveFirst
  1517.     While (rs.EOF = False)
  1518.         strVal = ""
  1519.         If ((rs.Fields(0) Is Nothing) = False) Then
  1520.             strVal = rs.Fields(0).Value
  1521.         End If
  1522.         LTrim (strVal)
  1523.         RTrim (strVal)
  1524.         If (strVal <> "") Then
  1525.             strDsc = ""
  1526.             If (clLtDb.Exists(RcpRough.Name)) Then
  1527.                 GetLtDsc RcpRough.Name, CStr(strVal), strDsc
  1528.                 strDsc = LTrim(strDsc)
  1529.                 strDsc = RTrim(strDsc)
  1530.                 If (strDsc <> "") Then
  1531.                     RcpRough.AddItem (strDsc)
  1532.                 End If
  1533.             Else
  1534.                 RcpRough.AddItem (strVal)
  1535.             End If
  1536.         End If
  1537.         rs.MoveNext
  1538.     Wend
  1539.     If (RcpRough.ListCount > 0) Then
  1540.         RcpRough.ListIndex = 0
  1541.     End If
  1542.     rs.Close
  1543.      
  1544.  ' * * * * * * * * * Recipe Finish * * * * * * * * *
  1545.     strCol = RcpFinish.Name
  1546.     LTrim (strCol)
  1547.     RTrim (strCol)
  1548.     If (strCol = "") Then
  1549.         Exit Sub
  1550.     End If
  1551.     strSql = "SELECT DISTINCT " & strCol & " FROM dbo.Master"
  1552.     rs.Open strSql, cn, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly
  1553.     If ((rs.Fields(0).Type = ADODB.DataTypeEnum.adVarChar) Or (rs.Fields(0).Type = ADODB.DataTypeEnum.adWChar)) Then
  1554.         clType.Add RcpFinish.Name, ""
  1555.     End If
  1556.     If (rs.BOF And rs.EOF) Then
  1557.         Exit Sub
  1558.     End If
  1559.     rs.MoveFirst
  1560.     While (rs.EOF = False)
  1561.         strVal = ""
  1562.         If ((rs.Fields(0) Is Nothing) = False) Then
  1563.             strVal = rs.Fields(0).Value
  1564.         End If
  1565.         LTrim (strVal)
  1566.         RTrim (strVal)
  1567.         If (strVal <> "") Then
  1568.             strDsc = ""
  1569.             If (clLtDb.Exists(RcpFinish.Name)) Then
  1570.                 GetLtDsc RcpFinish.Name, CStr(strVal), strDsc
  1571.                 strDsc = LTrim(strDsc)
  1572.                 strDsc = RTrim(strDsc)
  1573.                 If (strDsc <> "") Then
  1574.                     RcpFinish.AddItem (strDsc)
  1575.                 End If
  1576.             Else
  1577.                 RcpFinish.AddItem (strVal)
  1578.             End If
  1579.         End If
  1580.         rs.MoveNext
  1581.     Wend
  1582.     If (RcpFinish.ListCount > 0) Then
  1583.         RcpFinish.ListIndex = 0
  1584.     End If
  1585.     rs.Close
  1586.    
  1587.  ' * * * * * * * * * Recipe Description * * * * * * * * *
  1588.     strCol = RcpDsc.Name
  1589.     LTrim (strCol)
  1590.     RTrim (strCol)
  1591.     If (strCol = "") Then
  1592.         Exit Sub
  1593.     End If
  1594.     strSql = "SELECT DISTINCT " & strCol & " FROM dbo.Master"
  1595.     rs.Open strSql, cn, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly
  1596.     If ((rs.Fields(0).Type = ADODB.DataTypeEnum.adVarChar) Or (rs.Fields(0).Type = ADODB.DataTypeEnum.adWChar)) Then
  1597.         clType.Add RcpDsc.Name, ""
  1598.     End If
  1599.     If (rs.BOF And rs.EOF) Then
  1600.         Exit Sub
  1601.     End If
  1602.     rs.MoveFirst
  1603.     While (rs.EOF = False)
  1604.         strVal = ""
  1605.         If ((rs.Fields(0) Is Nothing) = False) Then
  1606.             strVal = rs.Fields(0).Value
  1607.         End If
  1608.         LTrim (strVal)
  1609.         RTrim (strVal)
  1610.         If (strVal <> "") Then
  1611.             strDsc = ""
  1612.             If (clLtDb.Exists(RcpDsc.Name)) Then
  1613.                 GetLtDsc RcpDsc.Name, CStr(strVal), strDsc
  1614.                 strDsc = LTrim(strDsc)
  1615.                 strDsc = RTrim(strDsc)
  1616.                 If (strDsc <> "") Then
  1617.                     RcpDsc.AddItem (strDsc)
  1618.                 End If
  1619.             Else
  1620.                 RcpDsc.AddItem (strVal)
  1621.             End If
  1622.         End If
  1623.         rs.MoveNext
  1624.     Wend
  1625.     If (RcpDsc.ListCount > 0) Then
  1626.         RcpDsc.ListIndex = 0
  1627.     End If
  1628.     rs.Close
  1629.            
  1630.     cn.Close
  1631.  
  1632. End Sub
  1633.  
  1634.  
  1635.  
  1636. ' * * * * * * * * THIS ROUTINE WORKS - DO NOT MODIFY IT  * * * * * * * *
  1637.  
  1638.  
  1639.  
  1640. Private Sub AddCbCondition() 'ByRef cb As ComboBox, ByRef strCdn As String)
  1641.     Dim rc As Integer
  1642.     Dim strVal, trDsc As String
  1643.    
  1644.     strVal = ""
  1645.     strCdn = ""
  1646.    
  1647.     If (RcpID.Text = "N/A" And RcpGrade.Text = "N/A" And RcpFinish.Text = "N/A" And RcpRough.Text = "N/A" And RcpDsc.Text = "N/A") Then
  1648.         Exit Sub
  1649.     End If
  1650.  
  1651. ' * * * * * * * * * Recipe Identfication * * * * * * * * *
  1652.  If (RcpID.Text <> "N/A") Then
  1653.     If (clLtDb.Exists(RcpID.Name)) Then
  1654.         strDsc = RcpID.Text
  1655.         strVal = GetLtVal(RcpID.Name, strDsc, (strVal))
  1656.     Else
  1657.         strVal = RcpID.Text
  1658.     End If
  1659.     LTrim (strVal)
  1660.     RTrim (strVal)
  1661.    
  1662.     If (strVal = "") Then
  1663.         Exit Sub
  1664.     End If
  1665.  
  1666.     If (Len(strCdn) = 0) Then
  1667.         strCdn = " WHERE "
  1668.     Else
  1669.         strCdn = strCdn & " AND "
  1670.     End If
  1671.     strCdn = strCdn & RcpID.Name & " = '"
  1672.  
  1673.     If (clType.Exists(RcpID.Name)) Then
  1674.         If (TypeName(clType(RcpID.Name)) = "String") Then
  1675.             strCdn = strCdn & strVal & "'"
  1676.         End If
  1677.     End If
  1678. End If
  1679.  
  1680. ' * * * * * * * * * Recipe Grade * * * * * * * * *
  1681.  If (RcpGrade.Text <> "N/A") Then
  1682.     If (clLtDb.Exists(RcpGrade.Name)) Then
  1683.         strDsc = RcpGrade.Text
  1684.         strVal = GetLtVal(RcpGrade.Name, strDsc, (strVal))
  1685.     Else
  1686.         strVal = RcpGrade.Text
  1687.     End If
  1688.     LTrim (strVal)
  1689.     RTrim (strVal)
  1690.    
  1691.     If (strVal = "") Then
  1692.         Exit Sub
  1693.     End If
  1694.  
  1695.     If (Len(strCdn) = 0) Then
  1696.         strCdn = " WHERE "
  1697.     Else
  1698.         strCdn = strCdn & " AND "
  1699.     End If
  1700.     strCdn = strCdn & RcpGrade.Name & " = '"
  1701.  
  1702.     If (clType.Exists(RcpGrade.Name)) Then
  1703.         If (TypeName(clType(RcpGrade.Name)) = "String") Then
  1704.             strCdn = strCdn & strVal & "'"
  1705.         End If
  1706.     End If
  1707. End If
  1708.  
  1709.  
  1710. ' * * * * * * * * * Recipe Rough * * * * * * * * *
  1711.  If (RcpRough.Text <> "N/A") Then
  1712.     If (clLtDb.Exists(RcpRough.Name)) Then
  1713.         strDsc = RcpRough.Text
  1714.         strVal = GetLtVal(RcpRough.Name, strDsc, (strVal))
  1715.     Else
  1716.         strVal = RcpRough.Text
  1717.     End If
  1718.     LTrim (strVal)
  1719.     RTrim (strVal)
  1720.    
  1721.     If (strVal = "") Then
  1722.         Exit Sub
  1723.     End If
  1724.  
  1725.     If (Len(strCdn) = 0) Then
  1726.         strCdn = " WHERE "
  1727.     Else
  1728.         strCdn = strCdn & " AND "
  1729.     End If
  1730.     strCdn = strCdn & RcpRough.Name & " = " & strVal
  1731.  
  1732.  '   If (clType.Exists(RcpRough.Name)) Then
  1733.  '       If (TypeName(clType(RcpRough.Name)) = "String") Then
  1734.  '           strCdn = strCdn & strVal & "'"
  1735.  '       End If
  1736.  '   End If
  1737.  
  1738. End If
  1739.  
  1740.  
  1741. ' * * * * * * * * * Recipe Finish * * * * * * * * *
  1742.  If (RcpFinish.Text <> "N/A") Then
  1743.     If (clLtDb.Exists(RcpFinish.Name)) Then
  1744.         strDsc = RcpFinish.Text
  1745.         strVal = GetLtVal(RcpFinish.Name, strDsc, (strVal))
  1746.     Else
  1747.         strVal = RcpFinish.Text
  1748.     End If
  1749.     LTrim (strVal)
  1750.     RTrim (strVal)
  1751.    
  1752.     If (strVal = "") Then
  1753.         Exit Sub
  1754.     End If
  1755.  
  1756.     If (Len(strCdn) = 0) Then
  1757.         strCdn = " WHERE "
  1758.     Else
  1759.         strCdn = strCdn & " AND "
  1760.     End If
  1761.     strCdn = strCdn & RcpFinish.Name & " = " & strVal
  1762.  
  1763. '    If (clType.Exists(RcpFinish.Name)) Then
  1764. '        If (TypeName(clType(RcpFinish.Name)) = "String") Then
  1765. '            strCdn = strCdn & strVal & "'"
  1766. '        End If
  1767. '    End If
  1768. End If
  1769.  
  1770.  
  1771. ' * * * * * * * * * Recipe Description * * * * * * * * *
  1772.  If (RcpDsc.Text <> "N/A") Then
  1773.     If (clLtDb.Exists(RcpDsc.Name)) Then
  1774.         strDsc = RcpDsc.Text
  1775.         strVal = GetLtVal(RcpDsc.Name, strDsc, (strVal))
  1776.     Else
  1777.         strVal = RcpDsc.Text
  1778.     End If
  1779.     LTrim (strVal)
  1780.     RTrim (strVal)
  1781.    
  1782.     If (strVal = "") Then
  1783.         Exit Sub
  1784.     End If
  1785.  
  1786.     If (Len(strCdn) = 0) Then
  1787.         strCdn = " WHERE "
  1788.     Else
  1789.         strCdn = strCdn & " AND "
  1790.     End If
  1791.     strCdn = strCdn & RcpDsc.Name & " = '"
  1792.  
  1793.     If (clType.Exists(RcpDsc.Name)) Then
  1794.         If (TypeName(clType(RcpDsc.Name)) = "String") Then
  1795.             strCdn = strCdn & strVal & "'"
  1796.         End If
  1797.     End If
  1798. End If
  1799.  
  1800. End Sub
  1801.  
  1802.  
  1803. Private Sub Display_Unload()
  1804. flxResult.Clear
  1805.  
  1806. End Sub
  1807.  
  1808. Private Sub flxResult_Click()
  1809. Dim Data As FlexgridData
  1810. Dim cnSrc As New ADODB.Connection
  1811. Dim cmd As New ADODB.Command
  1812. Dim rs As New ADODB.Recordset
  1813. Dim AllMTags As MasterTags
  1814.  
  1815.  
  1816.     'Creates all tags
  1817.     AllMTags = TGroup.LoadMasterTags
  1818.    
  1819.     ' Saves the row clicked on by user and stores it so we can query all tables in the database with the selected row
  1820.     iRow = flxResult.RowSel
  1821.     If (iRow < 1) Then
  1822.         Exit Sub
  1823.     End If
  1824.    
  1825.     ' Populates the UDT
  1826.     Data.RcpID = flxResult.TextMatrix(iRow, 1)
  1827.    
  1828.     cnSrc.Open ("DSN=DSN_Perryman")
  1829.     cmd.ActiveConnection = cnSrc
  1830.     cmd.CommandText = "SELECT * FROM dbo.Master WHERE [RcpID]= '" & Data.RcpID & "'"
  1831.     rs.Open cmd.CommandText, cnSrc
  1832.    
  1833.     ' Case where the table is empty
  1834.     If (rs.BOF And rs.EOF) Then
  1835.             Exit Sub
  1836.         End If
  1837.    
  1838.     ' Case where not at the beginning of the table
  1839.     If (rs.BOF = False) Then
  1840.         rs.MoveFirst
  1841.     End If
  1842.    
  1843.     'Set values to tags
  1844.     AllMTags.RcpID.Value = rs.Fields("RcpID").Value
  1845.     AllMTags.RcpGrade.Value = rs.Fields("RcpGrade").Value
  1846.     AllMTags.RcpRough.Value = rs.Fields("RcpRough").Value
  1847.     AllMTags.RcpFinish.Value = rs.Fields("RcpFinish").Value
  1848.     AllMTags.RcpDsc.Value = rs.Fields("RcpDsc").Value
  1849.    
  1850.     ' Sets the RcpID_Delete tag in the event that the row selected will be deleted
  1851.     RcpIDtobeDeleted = flxResult.TextMatrix(iRow, 1)
  1852.     MyTagGroup.Add "{RCP\RcpID_Delete}"
  1853.     Set Tag_RcpIDtobeDeleted = MyTagGroup.Item("{RCP\RcpID_Delete}")
  1854.     Tag_RcpIDtobeDeleted.Value = RcpIDtobeDeleted
  1855.    
  1856.    
  1857. ErrHandler:
  1858.     Exit Sub
  1859.    
  1860. End Sub
  1861.  
  1862. Private Sub flxResult_KeyUp(KeyCode As Integer, ByVal Shift As Integer)
  1863.    
  1864. End Sub
  1865.  
  1866. Private Sub flxResult_LeaveCell()
  1867.  
  1868. End Sub
  1869.  
  1870. Private Sub Group43_Click()
  1871.  
  1872. End Sub
  1873.  
  1874. Private Sub RcpGrade_Change()
  1875.     S = RcpGrade.ProgID
  1876. End Sub
  1877. Private Sub BtnDeleteRcp_Released()
  1878.     Dim cnSrc As New ADODB.Connection
  1879.     Dim cmd As New ADODB.Command
  1880.     Dim rs As ADODB.Recordset
  1881.     Dim RcpIDtobeDeleted As String
  1882.     Dim Value As Integer
  1883.     On Error GoTo ErrHandler
  1884.    
  1885.     iRow = flxResult.RowSel
  1886.     If (iRow < 1) Then
  1887.         Exit Sub
  1888.     End If
  1889.    
  1890.     RcpIDtobeDeleted = flxResult.TextMatrix(iRow, 1)
  1891.  
  1892.     cnSrc.Open ("DSN=DSN_Perryman")
  1893.     cmd.ActiveConnection = cnSrc
  1894.            
  1895.     cmd.CommandText = "DELETE FROM Inducto_A" & " WHERE RcpID = '" & RcpIDtobeDeleted & "'"
  1896.     cmd.Execute
  1897.    
  1898.     cmd.CommandText = "DELETE FROM Inducto_B" & " WHERE RcpID = '" & RcpIDtobeDeleted & "'"
  1899.     cmd.Execute
  1900.    
  1901.     cmd.CommandText = "DELETE FROM Kocks_Setup" & " WHERE RcpID = '" & RcpIDtobeDeleted & "'"
  1902.     cmd.Execute
  1903.            
  1904.     cmd.CommandText = "DELETE FROM K2_Setup" & " WHERE RcpID = '" & RcpIDtobeDeleted & "'"
  1905.     cmd.Execute
  1906.  
  1907.     cmd.CommandText = "DELETE FROM Master" & " WHERE RcpID = '" & RcpIDtobeDeleted & "'"
  1908.     cmd.Execute
  1909.  
  1910.     cmd.CommandText = "DELETE FROM Q_Prod" & " WHERE RcpID = '" & RcpIDtobeDeleted & "'"
  1911.     cmd.Execute
  1912.    
  1913.     cmd.CommandText = "DELETE FROM Q_Setup" & " WHERE RcpID = '" & RcpIDtobeDeleted & "'"
  1914.     cmd.Execute
  1915.    
  1916.  
  1917.     flxResult.RemoveItem (iRow)
  1918.     Set MyTagGroup = Nothing
  1919.    
  1920.     Exit Sub
  1921.    
  1922. ErrHandler:
  1923.     Exit Sub
  1924.    
  1925. End Sub
  1926. Private Sub LoginButton_Press()
  1927.  
  1928. Set MyTagGroup = Application.CreateTagGroup(Me.AreaName)
  1929. MyTagGroup.Add "{Username}"
  1930. MyTagGroup.Add "{Password}"
  1931. MyTagGroup.Add "{Login_Accepted}"
  1932.  
  1933. Dim Username As String
  1934. Dim Password As String
  1935. Dim Accepted As Integer
  1936.  
  1937. Username = "Admin"
  1938. Password = "Password1"
  1939.  
  1940. Dim Tag_Username As Tag
  1941. Dim Tag_Password As Tag
  1942. Dim Tag_Accepted As Tag
  1943.  
  1944. Set Tag_Username = MyTagGroup.Item("{Username}")
  1945. Set Tag_Password = MyTagGroup.Item("{Password}")
  1946. Set Tag_Accepted = MyTagGroup.Item("{Login_Accepted}")
  1947.  
  1948. If Tag_Username.Value = Username Then
  1949.  
  1950.         If Tag_Password.Value = Password Then
  1951.            Tag_Accepted.Value = 1
  1952.         Else
  1953.             Tag_Accepted.Value = 0
  1954.             Tag_Password.Value = "Invalid Password"
  1955.         End If
  1956. Else
  1957.     Tag_Username.Value = "Invalid User"
  1958. End If
  1959.  
  1960. End Sub
  1961. Private Sub BtnSearch_Released()
  1962.     Dim i As Integer
  1963.     'Dim strSql, strCdn, strGrade As String
  1964.     'Dim strGrade As String
  1965.     Dim strRough As String
  1966.     Dim StrFinish As String
  1967.     Dim TextArray() As String
  1968.     Dim cn As New ADODB.Connection
  1969.     Dim rs As New ADODB.Recordset
  1970.    
  1971.     ThisDisplay.flxResult.Redraw = False
  1972.  
  1973.     strTable = "dbo.Master"
  1974.  
  1975.     strCdn = ""
  1976.     strSql = "SELECT * FROM " & strTable
  1977.    
  1978.     AddCbCondition
  1979.    
  1980.     flxResult.Clear
  1981.  
  1982.     strSql = strSql & strCdn
  1983.     strSql = strSql & " ORDER BY RcpId, RcpGrade, RcpRough"
  1984.     cn.Open ("DSN=DSN_Perryman")
  1985. '    rs.Open strSql, cn, ADODB.adOpenStatic ', ADODB.adLockReadOnly
  1986.     rs.Open strSql, cn, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly
  1987.  
  1988.     If (rs.BOF = False) Then
  1989.         rs.MoveFirst
  1990.     End If
  1991.  
  1992.     i = 1
  1993.    
  1994.     'flxResult.Rows = 2
  1995.     'strGrade = ""
  1996.     While (rs.EOF = False)
  1997.         flxResult.TextMatrix(i, 0) = i
  1998.         flxResult.TextMatrix(i, 1) = rs.Fields("RcpId").Value
  1999.         flxResult.TextMatrix(i, 2) = rs.Fields("RcpGrade").Value
  2000.         'GetLtDsc RcpGrade.Name, CStr(rs.Fields("RcpGrade").Value), strGrade
  2001.         'flxResult.TextMatrix(i, 2) = strGrade
  2002.        
  2003.         'Makes Rough 3 decimal places in display only
  2004.         strRough = CStr(rs.Fields("RcpRough").Value) & ".0"
  2005.         TextArray = Split(strRough, ".")
  2006.         If Len(TextArray(1)) = 1 Then
  2007.             strRough = TextArray(0) & "." & TextArray(1) & "00"
  2008.        
  2009.         ElseIf Len(TextArray(1)) = 2 Then
  2010.        
  2011.             strRough = TextArray(0) & "." & TextArray(1) & "0"
  2012.        
  2013.         Else
  2014.        
  2015.             strRough = TextArray(0) & "." & TextArray(1)
  2016.        
  2017.         End If
  2018.         flxResult.TextMatrix(i, 3) = strRough
  2019.         'makes Finish 3 decimal places in display only
  2020.        
  2021.         StrFinish = CStr(rs.Fields("RcpFinish").Value) & ".0"
  2022.         TextArray = Split(StrFinish, ".")
  2023.         If Len(TextArray(1)) = 1 Then
  2024.             StrFinish = TextArray(0) & "." & TextArray(1) & "00"
  2025.        
  2026.         ElseIf Len(TextArray(1)) = 2 Then
  2027.             StrFinish = TextArray(0) & "." & TextArray(1) & "0"
  2028.            
  2029.         Else
  2030.        
  2031.             StrFinish = TextArray(0) & "." & TextArray(1)
  2032.        
  2033.         End If
  2034.                
  2035.         flxResult.TextMatrix(i, 4) = StrFinish
  2036.         flxResult.TextMatrix(i, 5) = rs.Fields("RcpDsc").Value
  2037.         flxResult.TextMatrix(i, 6) = rs.Fields("RcpDate").Value
  2038.  
  2039.         rs.MoveNext
  2040.        
  2041.         i = i + 1
  2042.         flxResult.Rows = flxResult.Rows + 1
  2043.     Wend
  2044.        
  2045.     flxResult.Rows = flxResult.Rows - 1
  2046.        
  2047.     rs.Close
  2048.     cn.Close
  2049.    
  2050.     For i = 1 To 5
  2051.    
  2052.     flxResult.ColAlignment(i) = flexAlignCenterTop
  2053.    
  2054.     Next
  2055.    
  2056.     ThisDisplay.flxResult.Redraw = True
  2057.  
  2058. End Sub
  2059. Private Sub BtnUpldIndA_Released()
  2060.     Dim Source As String
  2061.     Dim Destination As String
  2062.     Source = "PLC"
  2063.     Destination = "TAG"
  2064.    
  2065.     'Calls function that will upload plc tags into hmi tags
  2066.     InductoATagsModule.TransferInductoA Destination, Source
  2067.    
  2068. End Sub
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top