L
Legacy 425164
Guest
Hi All,
When I submit the form and am clearing the data to allow a new entry how I keep getting an error upon clearing the dependent combo box. I've Tried clearing the SubType combobox first, then RequestType, but it results in the same error. Using published code that works, it's just the reset I'm hung up on.
I am getting hung up on
I am using on the cmdbutton_Submit procedure
Either order doesn't work, and also used
Any suggestions?
When I submit the form and am clearing the data to allow a new entry how I keep getting an error upon clearing the dependent combo box. I've Tried clearing the SubType combobox first, then RequestType, but it results in the same error. Using published code that works, it's just the reset I'm hung up on.
Code:
Private Sub RequestType_Change()
' when selecion changes, filter
' workbook range Details
' i.e. read the range to an array, then
' set RequestType.List to the array
Dim arrFilter() As Variant
Dim arrInp() As Variant
Dim i As Long, j As Long
' put Details into an array
With [Details]
ReDim arrInp(.Rows.Count, 2)
arrInp = .Value
End With
' dimension arrFilter to the number of filtered values
j = 1
For i = 1 To UBound(arrInp, 1)
If arrInp(i, 1) = RequestType.Value Then
j = j + 1
End If
Next i
ReDim arrFilter(j - 1, 2)
' filter the array based on RequestType value
j = 1
For i = 1 To UBound(arrInp, 1)
If arrInp(i, 1) = RequestType.Value Then
arrFilter(j, 1) = arrInp(i, 1)
arrFilter(j, 2) = arrInp(i, 2)
j = j + 1
End If
Next i
' reset SubType properties
SubType.List = arrFilter()
SubType.BoundColumn = 2
SubType.ColumnCount = 2
SubType.ColumnWidths = "0 cm; 2 cm"
End Sub
I am getting hung up on
Code:
ReDim arrFilter(j - 1, 2)
I am using on the cmdbutton_Submit procedure
Code:
Me.RequestType.Clear
Me.SubType.Clear
Either order doesn't work, and also used
Code:
Me.RequestType.Value = ""
Any suggestions?