Option Explicit
Dim ctrlCollection As Collection
Private wb As Workbook
Private ld As Worksheet
Private cd As Worksheet
Private sObj As String
Private ctrl As MSForms.Control
Private iProductCnt As Integer
Private sCustomerName As String
Private arAssetID() As String
Private arAlias() As String
Private blInitialized As Boolean
Private iServerCnt As Integer
Private arNetwork As Variant
Private sProduct As String
Private arServerCnt() As Integer
Private arConType As Variant
Private arVersions As Variant
Private blMsg As Boolean
Private blIsRunning As Boolean
Public Property Let Product(Value As String)
sProduct = Value
End Property
' Using Activate to Initialize the Form to pass Product variable
Private Sub UserForm_Activate()
If Not blInitialized = True Then
Call SetVariables
Call CreateControls
Call AssignClassControls
Call ReadData
blInitialized = True
Me.mpFeatures.Value = 1
End If
End Sub
' #Region --Assign Classes--
Private Sub AssignClassControls()
Dim obj As clsControlEvents
Set ctrlCollection = New Collection
For Each ctrl In Me.Controls
' Textbox Controls
If IsLike(ctrl.Name, Array("txt_SystemAlias*", "txt_ServLoc*")) Then
Set obj = New clsControlEvents
Set obj.TextboxControl = ctrl
obj.MinLength = 3
ctrlCollection.Add obj
ElseIf ctrl.Name Like "txt_CertExpiration*" Then
Set obj = New clsControlEvents
Set obj.TextboxControl = ctrl
If sProduct Like "Via*" Then obj.MinLength = 7 Else obj.MinLength = 10
ctrlCollection.Add obj
ElseIf ctrl.Name Like "txt_AssetID*" Then
Set obj = New clsControlEvents
Set obj.TextboxControl = ctrl
Set obj.Form = Me
obj.MinLength = 6
obj.NumberCheck = True
obj.ZeroPrefixCheck = True
obj.TriggerObj = Me.trgTB.Name
obj.TriggerVal = ctrl.Name
ctrlCollection.Add obj
' Checkbox Controls
ElseIf ctrl.Name Like "chk_SDT*" Then
Set obj = New clsControlEvents
Set obj.CheckboxControl = ctrl
Set obj.Form = Me
obj.TriggerObj = Me.trgTB.Name
obj.TriggerVal = ctrl.Name
ctrlCollection.Add obj
' Combobox Controls
ElseIf ctrl.Name Like "cbo_Version*" Then
Set obj = New clsControlEvents
Set obj.ComboboxControl = ctrl
obj.MinLength = 2
ctrlCollection.Add obj
ElseIf IsLike(ctrl.Name, Array("cbo_SystemType*", "cbo_Profile*", "cbo_CertProvider*")) Then
Set obj = New clsControlEvents
Set obj.ComboboxControl = ctrl
Set obj.Form = Me
obj.MinLength = 1
ctrlCollection.Add obj
ElseIf IsLike(ctrl.Name, Array("cbo_ServerCnt*", "cbo_InstallType*", "cbo_Premise*")) Then
Set obj = New clsControlEvents
Set obj.ComboboxControl = ctrl
Set obj.Form = Me
obj.TriggerObj = Me.trgTB.Name
obj.TriggerVal = ctrl.Name
obj.MinLength = 1
ctrlCollection.Add obj
' Button Controls
ElseIf ctrl.Name Like "btn_*" Then
Set obj = New clsControlEvents
Set obj.ButtonControl = ctrl
Set obj.Form = Me
obj.TriggerObj = Me.trgTB.Name
obj.TriggerVal = ctrl.Name
ctrlCollection.Add obj
End If
Next ctrl
Set obj = Nothing
End Sub
' #Region --Event Changes--
Private Sub trgTB_Change()
Dim arName As Variant
Dim arValues As Variant
Dim iServerCnt As Integer
Dim sConnection As String
Dim iSystem As Integer
Dim blFound As Boolean
Dim iLoop1 As Integer
If blIsRunning = False Then
blIsRunning = True
If Me.trgTB.Value Like "txt*AssetID*" Then
If Len(Me.Controls(Me.trgTB.Value).Value) >= 6 Then
Call AssetIDCheck(sProduct, Me.Controls(Me.trgTB.Value), Me, Me.trgTB.Value)
End If
ElseIf Me.trgTB.Value Like "cbo_ServerCnt*" Then
If IsNumeric(Me.Controls(Me.trgTB.Value).Tag) Then
arName = Split(Me.trgTB.Value, "_")
iSystem = arName(2)
If sProduct = "ViaWFM" Then
If IsNumeric(Me.Controls("cbo_PremServerCnt_" & iSystem).Value) Then
iServerCnt = CInt(Me.Controls(Me.trgTB.Value).Value) + CInt(Me.Controls("cbo_PremServerCnt_" & iSystem).Value)
If iServerCnt < CInt(Me.Controls(Me.trgTB.Value).Tag) Then
frmDelete.Form = Me.Name
frmDelete.DeleteOption = "Server_" & sProduct
frmDelete.DeleteFeature = arName(1)
frmDelete.DeleteCount = Me.Controls(Me.trgTB.Value).Tag - iServerCnt
frmDelete.DeleteAssetID = Me.Controls("txt_AssetID_" & arName(UBound(arName))).Value
frmDelete.DeleteAlias = Me.Controls("txt_SystemAlias_" & arName(UBound(arName))).Value
Unload Me
frmDelete.Show
Exit Sub
End If
End If
Else
iServerCnt = CInt(Me.Controls(Me.trgTB.Value).Value)
If iServerCnt < CInt(Me.Controls(Me.trgTB.Value).Tag) Then
frmDelete.Form = Me.Name
frmDelete.DeleteOption = "Server_" & sProduct
frmDelete.DeleteFeature = arName(1)
frmDelete.DeleteCount = Me.Controls(Me.trgTB.Value).Tag - iServerCnt
frmDelete.DeleteAssetID = Me.Controls("txt_AssetID_" & arName(UBound(arName))).Value
frmDelete.DeleteAlias = Me.Controls("txt_SystemAlias_" & arName(UBound(arName))).Value
Unload Me
frmDelete.Show
Exit Sub
End If
End If
End If
ElseIf Me.trgTB.Value Like "cbo_Premise*" Then
arName = Split(Me.trgTB.Value, "_")
Me.Controls("btn_URLs_" & arName(2)).visible = (IsIn(Me.Controls(Me.trgTB.Value).Value, Array("Hosted", "Cloud")))
If sProduct = "WFM" And Me.Controls("cbo_Premise_" & arName(2)).Value = "Hosted" Then Me.Controls("chk_IS_" & arName(2)).Value = True
ElseIf Me.trgTB.Value Like "btn_Add*" Then
arName = Split(Me.trgTB.Value, "_")
iSystem = arName(2)
blFound = False
If Len(Me.Controls("cbo_Systems_" & iSystem).Value) > 0 And (Len(Me.Controls("cbo_ConnectionType_" & iSystem).Value) > 0 Or Not IsIn(sProduct, Array("ViaWFM", "WFM", "AQM"))) Then
For iLoop1 = 0 To Me.Controls("lst_Connections_" & iSystem).ListCount - 1
If Me.Controls("cbo_Systems_" & iSystem).Value = Me.Controls("lst_Connections_" & iSystem).List(iLoop1, 0) Then
blFound = True
End If
Next iLoop1
If blFound = False Then
Me.Controls("lst_Connections_" & iSystem).AddItem ("")
Me.Controls("lst_Connections_" & iSystem).List(Me.Controls("lst_Connections_" & iSystem).ListCount - 1, 0) = Me.Controls("cbo_Systems_" & iSystem).Value
Me.Controls("lst_Connections_" & iSystem).List(Me.Controls("lst_Connections_" & iSystem).ListCount - 1, 1) = Me.Controls("cbo_ConnectionType_" & iSystem).Value
End If
End If
ElseIf Me.trgTB.Value Like "btn_Remove*" Then
arName = Split(Me.trgTB.Value, "_")
iSystem = arName(2)
If Me.Controls("lst_Connections_" & iSystem).ListIndex >= 0 Then
Me.Controls("lst_Connections_" & iSystem).RemoveItem (Me.Controls("lst_Connections_" & iSystem).ListIndex)
End If
ElseIf Me.trgTB.Value Like "chk_SDT*" Then
arName = Split(Me.trgTB.Value, "_")
iSystem = arName(2)
Me.Controls("lbl_CertProvider_" & iSystem).visible = Me.Controls(Me.trgTB.Value).Value
Me.Controls("cbo_CertProvider_" & iSystem).visible = Me.Controls(Me.trgTB.Value).Value
Me.Controls("lbl_CertExpiration_" & iSystem).visible = Me.Controls(Me.trgTB.Value).Value
Me.Controls("txt_CertExpiration_" & iSystem).visible = Me.Controls(Me.trgTB.Value).Value
ElseIf Me.trgTB.Value Like "btn_URLs*" Then
frmURLs.Form = Me.Name
frmURLs.Product = sProduct
Unload Me
frmURLs.Show
Exit Sub
End If
Me.trgTB.Tag = ""
Me.trgTB.Value = ""
Me.Repaint
blIsRunning = False
End If
End Sub
' #Region --Procedures--
Private Sub SetVariables()
If sProduct = "" Then sProduct = "PM"
Set wb = ThisWorkbook
Set cd = wb.Sheets("ConfigurationData")
Set ld = wb.Sheets("LookupData")
iProductCnt = cd.Range("cnf" & sProduct & "Cnt").Value
ReDim arAssetID(1 To iProductCnt)
ReDim arAlias(1 To iProductCnt)
ReDim arServerCnt(1 To iProductCnt)
Dim arSystems As Variant
Dim iConfiguredCnt As Integer
Dim arNetwork As Variant
Dim iLoop1 As Integer
Dim iLoop2 As Integer
sCustomerName = cd.Range("cnfCustomerName").Value
Me.Caption = sProduct & " Features"
arVersions = Split(ld.Range("ld" & sProduct & "Versions").Value, "|")
arSystems = cd.Range("cnfTableSystems").Value
arNetwork = cd.Range("cnfTable" & sProduct & "Network").Value
Select Case sProduct
Case "ViaWFM"
iServerCnt = 80
arConType = Array("Enter Connection Name")
Case "WFM"
iServerCnt = 80
arConType = Array("Enter Connection Name")
Case "QM"
iServerCnt = 50
arConType = Array("CTIPS", "Enhanced CTIPS", "TDM Trunk Tapping", "SIP Trunk Tapping", "Call Logger")
Case "PM"
iServerCnt = 50
arConType = Array("")
Case "CXP"
iServerCnt = 50
arConType = Array("")
Case "Prophecy"
iServerCnt = 10
arConType = Array("")
Case "IT"
iServerCnt = 50
arConType = Array("")
Case "SA"
iServerCnt = 50
arConType = Array("")
End Select
For iLoop1 = 1 To iProductCnt
For iLoop2 = LBound(arSystems) To UBound(arSystems)
If arSystems(iLoop2, 3) = sProduct And arSystems(iLoop2, 2) = iLoop1 Then
arAssetID(iLoop1) = arSystems(iLoop2, 1)
arAlias(iLoop1) = arSystems(iLoop2, 4)
End If
Next iLoop2
For iLoop2 = LBound(arNetwork) To UBound(arNetwork)
If arNetwork(iLoop2, 1) = arAssetID(iLoop1) Then
If CInt(arNetwork(iLoop2, 12)) > 0 Then arServerCnt(iLoop1) = arServerCnt(iLoop1) + 1
End If
Next iLoop2
Next iLoop1
End Sub
Private Sub CreateControls()
Dim iLoop1 As Integer
Dim arResults() As String
Dim tblSystems As ListObject
Dim arSystems As Variant
Dim tblSystemDetails As ListObject
Dim arSystemDetails As Variant
Dim arSearch As Variant
Dim arTemp As Variant
Set tblSystems = cd.ListObjects("cnfTableSystems")
Set tblSystemDetails = cd.ListObjects("cnfTableSystemDetails")
ReDim arResults(-1 To -1)
If sProduct = "WFM" Then arSearch = Array("UIP", "AIC", "QM", "Via")
If sProduct = "QM" Then arSearch = Array("UIP", "AIC", "Via")
If sProduct = "Prophecy" Then arSearch = Array("CXP")
If sProduct = "CXP" Then arSearch = Array("UIP")
[B] If IsIn(sProduct, Array("WFM", "QM", "Prophecy", "CXP")) Then '### If this If is what fixes the issue
arSystems = QueryTable(sTable:="cnfTableSystems", sCol:="Product", sQuery:=arSearch)
If UBound(arSystems) > 0 Then
ReDim arResults(1 To 1)
For iLoop1 = LBound(arSystems) To UBound(arSystems)
arSystemDetails = QueryTable(sTable:="cnfTableSystemDetails", sCol:="AssetID", sQuery:=arSystems(iLoop1, 1), sCol2:="Field", sQuery2:="Version")
ReDim Preserve arResults(1 To iLoop1)
arResults(iLoop1) = arSystems(iLoop1, 3) & "_" & arSystems(iLoop1, 4) & ":" & arSystemDetails(1, 3)
Next iLoop1
End If
End If '###[/B]
For iLoop1 = 1 To iProductCnt
With Me.mpFeatures.Pages.Add
.Name = sProduct & " System " & iLoop1
.Caption = sProduct & " System " & iLoop1
.visible = True
End With
Call NewLabel(Me.mpFeatures(iLoop1).Add("Forms.Label.1"), "lbl_Heading_" & iLoop1, 6, 18, 358, 16, sCaption:=cd.Range("cnfCustomerName").Value & " " & Me.mpFeatures.Pages(iLoop1).Caption, sBackColor:=&H8000000F, sForeColor:=&H8000&, iFontSize:=12, iTextAlign:=2)
Call NewLabel(Me.mpFeatures(iLoop1).Add("Forms.Label.1"), "lbl_SystemAlias_" & iLoop1, 34, 12, 54, 12, , sCaption:="System Alias", sTag:="System Alias", iTextAlign:=3)
Call NewTextbox(Me.mpFeatures(iLoop1).Add("Forms.Textbox.1"), "txt_SystemAlias_" & iLoop1, 30, 78, 120, 16, sTag:="System Alias", sBackColor:=&HFF&)
Call NewLabel(Me.mpFeatures(iLoop1).Add("Forms.Label.1"), "lbl_SystemType_" & iLoop1, 56, 12, 54, 12, sCaption:="System Type", iTextAlign:=3)
Call NewCombobox(Me.mpFeatures(iLoop1).Add("Forms.Combobox.1"), "cbo_SystemType_" & iLoop1, 54, 78, 120, 16, sTag:="SystemType", sBackColor:=&HFF&, arList:=Split(ld.Range("ld" & sProduct & "SystemTypes").Value, "|"))
Call NewLabel(Me.mpFeatures(iLoop1).Add("Forms.Label.1"), "lbl_InstallType_" & iLoop1, 81, 12, 54, 12, sCaption:="Install Type", iTextAlign:=3)
Call NewCombobox(Me.mpFeatures(iLoop1).Add("Forms.Combobox.1"), "cbo_InstallType_" & iLoop1, 78, 78, 120, 16, sTag:="Install Type", sBackColor:=&HFF&, arList:=Array("New Install", "Upgrade"))
Call NewLabel(Me.mpFeatures(iLoop1).Add("Forms.Label.1"), "lbl_AssetID_" & iLoop1, 34, 230, 42, 12, sCaption:="Asset ID", iTextAlign:=3)
Call NewTextbox(Me.mpFeatures(iLoop1).Add("Forms.Textbox.1"), "txt_AssetID_" & iLoop1, 30, 294, 60, 16, sBackColor:=&HFF&, iMaxLen:=7)
Call NewLabel(Me.mpFeatures(iLoop1).Add("Forms.Label.1"), "lbl_Profile_" & iLoop1, 56, 230, 42, 12, sCaption:="Profile", iTextAlign:=3)
Call NewCombobox(Me.mpFeatures(iLoop1).Add("Forms.Combobox.1"), "cbo_Profile_" & iLoop1, 54, 294, 60, 16, sTag:="Profile", arList:=Split(ld.Range("ld" & sProduct & "Profiles").Value, "|"), sValue:="Custom", iStyle:=0)
Call NewLabel(Me.mpFeatures(iLoop1).Add("Forms.Label.1"), "lbl_Version_" & iLoop1, 81, 230, 42, 12, sCaption:="Version", iTextAlign:=3)
Call NewCombobox(Me.mpFeatures(iLoop1).Add("Forms.Combobox.1"), "cbo_Version_" & iLoop1, 78, 294, 60, 16, arList:=arVersions, sValue:=arVersions(UBound(arVersions)))
Call NewLabel(Me.mpFeatures(iLoop1).Add("Forms.Label.1"), "lbl_ServLoc_" & iLoop1, 104, 6, 60, 12, sCaption:="Server Location", iTextAlign:=3)
Call NewTextbox(Me.mpFeatures(iLoop1).Add("Forms.Textbox.1"), "txt_ServLoc_" & iLoop1, 102, 78, 140, 16, sBackColor:=&HFF&, iMaxLen:=30)
Call NewLabel(Me.mpFeatures(iLoop1).Add("Forms.Label.1"), "lbl_Premise_" & iLoop1, 104, 224, 60, 12, sCaption:="Premise/Hosted", iTextAlign:=3)
Call NewCombobox(Me.mpFeatures(iLoop1).Add("Forms.Combobox.1"), "cbo_Premise_" & iLoop1, 102, 294, 60, 16, arList:=Array("Premise", "Hosted", "Cloud"), sValue:="Premise", iTextAlign:=1)
If sProduct = "ViaWFM" Then Me.Controls("cbo_Premise_" & iLoop1).Value = "Cloud"
Call NewButton(Me.mpFeatures(iLoop1).Add("Forms.CommandButton.1"), "btn_URLs_" & iLoop1, 124, 258, 96, 18, sCaption:="URL's", sBackColor:=&H80000005, blVisible:=False)
Call NewLabel(Me.mpFeatures(iLoop1).Add("Forms.Label.1"), "lbl_ServerCnt_" & iLoop1, 128, 12, 54, 12, sCaption:="Server Cnt", iTextAlign:=3)
Call NewCombobox(Me.mpFeatures(iLoop1).Add("Forms.Combobox.1"), "cbo_ServerCnt_" & iLoop1, 126, 78, 35, 16, arList:=NumArray(0, iServerCnt), iTextAlign:=1, sTag:=arServerCnt(iLoop1))
If sProduct = "WFM" Then
Call NewCheckbox(Me.mpFeatures(iLoop1).Add("Forms.CheckBox.1"), "chk_IS_" & iLoop1, 126, 132, 96, 16, sCaption:="Integrated Security", sValue:=False, blEnabled:=True)
End If
If sProduct = "ViaWFM" Then
Call NewLabel(Me.mpFeatures(iLoop1).Add("Forms.Label.1"), "lbl_PremServerCnt_" & iLoop1, 128, 118, 84, 12, sCaption:="Premise Server Cnt", iTextAlign:=3)
Call NewCombobox(Me.mpFeatures(iLoop1).Add("Forms.Combobox.1"), "cbo_PremServerCnt_" & iLoop1, 126, 208, 35, 16, arList:=NumArray(0, 10), iTextAlign:=1, sTag:=arServerCnt(iLoop1))
End If
Call NewCheckbox(Me.mpFeatures(iLoop1).Add("Forms.CheckBox.1"), "chk_SDT_" & iLoop1, 150, 32, 56, 16, sCaption:="SSL", sValue:=False, blEnabled:=True)
Call NewLabel(Me.mpFeatures(iLoop1).Add("Forms.Label.1"), "lbl_CertProvider_" & iLoop1, 152, 65, 60, 12, sCaption:="Cert Provider", iTextAlign:=3, blVisible:=False)
Call NewCombobox(Me.mpFeatures(iLoop1).Add("Forms.Combobox.1"), "cbo_CertProvider_" & iLoop1, 150, 132, 70, 16, arList:=Array("Customer", "3rdParty"), iTextAlign:=1, sBackColor:=&HFF&, blVisible:=False)
If sProduct = "ViaWFM" Then
Call NewLabel(Me.mpFeatures(iLoop1).Add("Forms.Label.1"), "lbl_CertExpiration_" & iLoop1, 152, 230, 60, 12, sCaption:="Cert Domain", iTextAlign:=3, blVisible:=False)
Call NewTextbox(Me.mpFeatures(iLoop1).Add("Forms.Textbox.1"), "txt_CertExpiration_" & iLoop1, 150, 294, 60, 16, sBackColor:=&HFF&, iMaxLen:=10, blVisible:=False)
Else
Call NewLabel(Me.mpFeatures(iLoop1).Add("Forms.Label.1"), "lbl_CertExpiration_" & iLoop1, 152, 230, 60, 12, sCaption:="Cert Expiration", iTextAlign:=3, blVisible:=False)
Call NewTextbox(Me.mpFeatures(iLoop1).Add("Forms.Textbox.1"), "txt_CertExpiration_" & iLoop1, 150, 294, 60, 16, sBackColor:=&HFF&, iMaxLen:=10, blVisible:=False)
End If
If sProduct = "PM" Then
Call NewLabel(Me.mpFeatures(iLoop1).Add("Forms.Label.1"), "lbl_LicenseType_" & iLoop1, 128, 118, 58, 12, sCaption:="License Type", iTextAlign:=3)
Call NewCombobox(Me.mpFeatures(iLoop1).Add("Forms.Combobox.1"), "cbo_LicenseType_" & iLoop1, 126, 180, 60, 16, arList:=Array("Standard", "Enterprise"), iTextAlign:=1, sValue:="Standard")
End If
If IsIn(sProduct, Array("ViaWFM", "WFM", "QM", "Prophecy", "CXP")) Then
Me.Height = 414
Me.mpFeatures.Height = 334
Me.btnSave.Top = Me.Height - 60
Me.btnCancel.Top = Me.Height - 60
Call NewGroupbox(Me.mpFeatures(iLoop1).Add("Forms.Frame.1"), "gb_Connections_" & iLoop1, 174, 5, 360, 100, sCaption:="Connection Info", blVisible:=True, sBackColor:=&H8000000F)
Call NewCombobox(Me.Controls("gb_Connections_" & iLoop1).Add("Forms.Combobox.1"), "cbo_Systems_" & iLoop1, 12, 6, 140, 16, arList:=arResults, iTextAlign:=1, iStyle:=0)
Me.Controls("cbo_Systems_" & iLoop1).AddItem ("Type to Enter Custom")
Call NewCombobox(Me.Controls("gb_Connections_" & iLoop1).Add("Forms.Combobox.1"), "cbo_ConnectionType_" & iLoop1, 30, 6, 140, 16, arList:=arConType, iTextAlign:=1, blVisible:=IsIn(sProduct, Array("ViaWFM", "WFM", "AQM")))
If IsIn(sProduct, Array("ViaWFM", "WFM")) Then Me.Controls("cbo_ConnectionType_" & iLoop1).Style = 0
Call NewButton(Me.Controls("gb_Connections_" & iLoop1).Add("Forms.CommandButton.1"), "btn_Add_" & iLoop1, 56, 14, 42, 24, sCaption:="Add")
Call NewButton(Me.Controls("gb_Connections_" & iLoop1).Add("Forms.CommandButton.1"), "btn_Remove_" & iLoop1, 56, 84, 42, 24, sCaption:="Remove")
Call NewListbox(Me.Controls("gb_Connections_" & iLoop1).Add("Forms.ListBox.1"), "lst_Connections_" & iLoop1, 12, 180, 166, 75, iColumnCount:=2, sColumnWidth:="90;60")
End If
Next iLoop1
End Sub
Private Sub WriteData()
Dim arName As Variant
Dim sValue As String
Dim sAssetID As String
Dim iLoop1 As Integer
Dim iLoop2 As Integer
For iLoop1 = 1 To iProductCnt
If Len(Me.Controls("txt_AssetID_" & iLoop1).Value) >= 6 Then
' Delete Existing Entries from Systems Table
Call DeleteTable("cnfTableSystems", Me.Controls("txt_AssetID_" & iLoop1).Value)
' Write Data to Systems Table
Call TableAddRecord("cnfTableSystems", Array(Me.Controls("txt_AssetID_" & iLoop1).Value, iLoop1, sProduct, Me.Controls("txt_SystemAlias_" & iLoop1).Value, Me.Controls("cbo_Profile_" & iLoop1).Value))
' Delete Existing Entries from System Detail Table
Call DeleteTable("cnfTableSystemDetails", Me.Controls("txt_AssetID_" & iLoop1).Value)
' Write Data to System Detail Table
For Each ctrl In Me.Controls
If (ctrl.Name Like "txt*" Or ctrl.Name Like "cbo*" Or ctrl.Name Like "chk*") And Not IsLike(ctrl.Name, Array("cbo_Profile*", "cbo_ConnectionType*", "cbo_Systems*")) Then
arName = Split(ctrl.Name, "_")
If ctrl.visible = True And arName(UBound(arName)) = iLoop1 Then
Call TableAddRecord("cnfTableSystemDetails", Array(CStr(Me.Controls("txt_AssetID_" & iLoop1).Value), CStr(arName(1)), ctrl.Value))
End If
ElseIf ctrl.Name Like "lst*" & iLoop1 Then
For iLoop2 = 0 To Me.Controls(ctrl.Name).ListCount - 1
sValue = Me.Controls(ctrl.Name).List(iLoop2, 0) & "|" & Me.Controls(ctrl.Name).List(iLoop2, 1)
arName = Split(ctrl.Name, "_")
Call TableAddRecord("cnfTableSystemDetails", Array(CStr(Me.Controls("txt_AssetID_" & iLoop1).Value), CStr(arName(1)), sValue))
Next iLoop2
End If
Next
End If
Next iLoop1
Call ChangeLog(sProduct & " Features Updated", False)
End Sub
Private Sub ReadData()
Dim arSystems As Variant
Dim arSystemDetails As Variant
Dim arName As Variant
Dim arValue As Variant
Dim sAssetID As String
Dim iLoop1 As Integer
Dim iLoop2 As Integer
Dim iLoop3 As Integer
Dim arResults() As String
'On Error Resume Next
arSystems = cd.Range("cnfTableSystems").Value
arSystemDetails = cd.Range("cnfTableSystemDetails").Value
ReDim arResults(-1 To -1)
For iLoop1 = 1 To iProductCnt
For iLoop2 = LBound(arSystems) To UBound(arSystems)
If arSystems(iLoop2, 3) = sProduct And arSystems(iLoop2, 2) = iLoop1 Then
Me.Controls("txt_AssetID_" & iLoop1).Value = arSystems(iLoop2, 1)
sAssetID = arSystems(iLoop2, 1)
If Len(Me.Controls("txt_AssetID_" & iLoop1).Value) >= 6 Then Me.Controls("txt_AssetID_" & iLoop1).Enabled = False
Me.Controls("txt_SystemAlias_" & iLoop1).Value = arSystems(iLoop2, 4)
Me.Controls("cbo_Profile_" & iLoop1).Value = arSystems(iLoop2, 5)
For Each ctrl In Me.Controls
If ctrl.Name Like "txt*" & iLoop1 Or ctrl.Name Like "cbo*" & iLoop1 Or ctrl.Name Like "chk*" & iLoop1 Or ctrl.Name Like "lst*" & iLoop1 Then
arName = Split(ctrl.Name, "_")
For iLoop3 = LBound(arSystemDetails) To UBound(arSystemDetails)
If ctrl.Name Like "lst*" Then
If arSystemDetails(iLoop3, 1) = arSystems(iLoop2, 1) And arSystemDetails(iLoop3, 2) = arName(1) Then
arValue = Split(arSystemDetails(iLoop3, 3), "|")
Me.Controls(ctrl.Name).AddItem ("")
Me.Controls(ctrl.Name).List(Me.Controls(ctrl.Name).ListCount - 1, 0) = arValue(0)
Me.Controls(ctrl.Name).List(Me.Controls(ctrl.Name).ListCount - 1, 1) = arValue(1)
End If
Else
If arSystemDetails(iLoop3, 1) = arSystems(iLoop2, 1) And arSystemDetails(iLoop3, 2) = arName(1) Then
ctrl.Value = arSystemDetails(iLoop3, 3)
End If
End If
Next iLoop3
End If
Next
End If
Next iLoop2
Next iLoop1
End Sub
Private Sub DataCheck()
Dim sMsg As String
Dim iLoop1 As Integer
sMsg = "The following items are incomplete! " & vbCrLf
For iLoop1 = 1 To iProductCnt
If Len(Me.Controls("txt_SystemAlias_" & iLoop1).Value) < 3 Then sMsg = sMsg & Me.Controls("txt_SystemAlias_" & iLoop1).Tag & vbCrLf
If Len(Me.Controls("cbo_SystemType_" & iLoop1).Value) < 1 Then sMsg = sMsg & Me.Controls("cbo_SystemType_" & iLoop1).Tag & vbCrLf
If Len(Me.Controls("cbo_InstallType_" & iLoop1).Value) < 1 Then sMsg = sMsg & Me.Controls("cbo_InstallType_" & iLoop1).Tag & vbCrLf
If Len(Me.Controls("txt_AssetID_" & iLoop1).Value) < 6 Then sMsg = sMsg & Me.Controls("txt_AssetID_" & iLoop1).Tag & vbCrLf
Next iLoop1
If Len(sMsg) > 38 Then
sMsg = sMsg & vbCrLf & "Please correct these and try again."
MsgBox (sMsg)
blMsg = True
Else
blMsg = False
End If
End Sub
' #Region --Buttons--
Private Sub btnCancel_Click()
Unload Me
frmConfigurationMenu.Show
End Sub
Private Sub btnSave_Click()
Call DataCheck
If blMsg = False Then
Call WriteData
Unload Me
frmConfigurationMenu.Show
End If
End Sub