Encountered a weird issue today as I added editing features to my UserForm. The fourth ComboBox is giving me a property value error when I try to populate it, despite the previous three working and the VBA editor calculating the value correctly.
The right side is returning a value, but the left side is giving me the invalid property. Code is as follows:
The right side is returning a value, but the left side is giving me the invalid property. Code is as follows:
VBA Code:
Private Sub EditButton_Click()
If Selected_List = 0 Then
MsgBox "No selection.", vbOKOnly + vbInformation, "Edit"
Exit Sub
End If
Dim cSelect As Variant
Dim oSelect As Variant
Dim uSelect As Variant
Dim ctSelect As Variant
Dim iSelect As Variant
Dim sSelect As Variant
'code to update the value to the respective fields
Me.txtRowNumber.Value = Selected_List + 1
Me.ProductBox.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 0)
Me.PID.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 1)
Me.CaseQty.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 2)
Me.PackSizeBox.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 3)
Me.StageBox.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 4)
Me.AssBox.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 5)
Me.ColourBox.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 6)
cSelect = Me.ListBox1.List(Me.ListBox1.ListIndex, 7)
If cSelect = "" Then
Me.CoverSelect.Value = False
Else
Me.CoverSelect.Value = True And Me.CoverBox.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 7)
End If
oSelect = Me.ListBox1.List(Me.ListBox1.ListIndex, 8)
If oSelect = "" Then
Me.OrnamentSelect.Value = False
Else
Me.OrnamentSelect.Value = True And Me.OrnamentBox.Value = IIf(oSelect = "Yes", Me.OrnamentBox.Value = "", Me.OrnamentBox.Value = oSelect)
End If
uSelect = Me.ListBox1.List(Me.ListBox1.ListIndex, 9)
If uSelect = "" Then
Me.UPCSelect.Value = False
Else
Me.UPCSelect.Value = True And Me.UPCBox.Value = IIf(uSelect = "Yes", Me.UPCBox.Value = "", Me.UPCBox.Value = oSelect)
End If
ctSelect = Me.ListBox1.List(Me.ListBox1.ListIndex, 10)
If ctSelect = "" Then
Me.CareTagSelect.Value = False
Else
Me.CareTagSelect.Value = True
End If
iSelect = Me.ListBox1.List(Me.ListBox1.ListIndex, 11)
If iSelect = "" Then
Me.InsulationSelect.Value = False
Else
Me.InsulationSelect.Value = True
End If
sSelect = Me.ListBox1.List(Me.ListBox1.ListIndex, 12)
If sSelect = "" Then
Me.SleeveSelect.Value = False
Else
Me.SleeveSelect.Value = True
End If
Me.NotesBox.Value = Me.ListBox1.List(Me.ListBox1.ListIndex, 13)
MsgBox "Please make necessary changes and click on 'Add' to save changes.", vbOKOnly + vbInformation, "Edit"
End Sub