Я получаю катастрофическую ошибку в определенной последовательности при выборе формы списка ... как я могу определить, что именно вызывает катастрофическую ошибку?Ошибка повторяется из моего файла.
В приведенном ниже коде я поставил msgbox "a", и ошибка больше не появляется ... Если я удалю ее, она снова появится.Кроме того, он появляется только сразу после того, как я запустил файл Excel, открыл формы и выбрал элемент в этом списке.Также код составляет около 4000 строк и 150000 символов для этой конкретной формы.В других классах это более 10000 строк и более 300000 символов.
Private Sub ListBox3_Change()
Dim partf As Variant, ctype As String
ReDim fncleft(4)
ReDim fncright(4)
Dim i As Integer, h As Integer
For i = 0 To Me.ListBox3.ListCount - 1
If Me.ListBox3.Selected(i) = True Then
With bomfix.ExcelTables(Me.ComboBox_Tables2.Value).settings
If Me.ListBox3.List(i, 1) <> vbNullString Then
Me.CheckBox_SQLltrim.Enabled = True
Me.CheckBox_SQLrtrim.Enabled = True
Me.CheckBox_SQLtrim.Enabled = True
Me.CheckBox_SQLlower.Enabled = True
Me.CheckBox_SQLupper.Enabled = True
Me.CommandButtonSQLreplace.Enabled = True
Me.Frame9.Visible = True
Me.TextBox_ConstraintType.Visible = True
Me.CommandButton8.Visible = True
Me.Label99.Visible = True
Me.Label100.Visible = True
Me.TextBox_ConstrTableName.Visible = True
Me.TextBox_ConstrColumnName.Visible = True
If .TableExists(Me.ListBox3.List(i, 0)) = True Then
If .Table(Me.ListBox3.List(i, 0)).ColumnExists(Me.ListBox3.List(i, 1)) = True Then
Me.ComboBox_PartTable.List = .Tables
Me.ComboBox_PartTable.AddItem vbNullString, 0
With .Table(Me.ListBox3.List(i, 0))
Me.CheckBox_FullJoinTable.Enabled = True
Me.CheckBox_FullJoinTable.Value = .FullJoin
With .column(Me.ListBox3.List(i, 1))
Me.TextBox_ExportName.Value = .Value
Me.CheckBox_ColumnHidden.Value = .Hidden
Me.CheckBox_ColumnEnabled.Value = .Active
Me.TextBox_ConstraintType.Value = .ConstraintType
Me.TextBox_ConstrTableName.Value = .ConstraintTable
Me.TextBox_ConstrColumnName.Value = .ConstraintColumn
Me.CheckBox_SQLltrim.Value = .SQLltrim
Me.CheckBox_SQLrtrim.Value = .SQLrtrim
Me.CheckBox_SQLtrim.Value = .SQLtrim
Me.CheckBox_SQLlower.Value = .SQLlower
Me.CheckBox_SQLupper.Value = .SQLupper
MsgBox "b"
partf = .PartitionFilter
If Not UBound(partf) < 0 Then
Me.TextBox_PartResults.Value = partf(0)
If bomfix.ExcelTables(Me.ComboBox_Tables2.Value).settings.TableExists(partf(1)) = True Then
Me.ComboBox_PartTable.Value = partf(1)
Me.ComboBox_PartColumn.List = bomfix.ExcelTables(Me.ComboBox_Tables2.Value).settings.Table(Me.ComboBox_PartTable.Value).Columns
Me.ComboBox_PartColumn.AddItem vbNullString, 0
If bomfix.ExcelTables(Me.ComboBox_Tables2.Value).settings.Table(partf(1)).ColumnExists(partf(2)) = True Then
Me.ComboBox_PartColumn.Value = partf(2)
Me.ComboBox_PartOrderBy.Value = partf(3)
End If
End If
Else
Me.TextBox_PartResults.Value = vbNullString
Me.ComboBox_PartTable.Value = vbNullString
Me.ComboBox_PartColumn.Value = vbNullString
Me.ComboBox_PartOrderBy.Value = vbNullString
End If
Me.TextBox_FuncLeftCol.Value = Me.ListBox3.List(i, 0) & "." & Me.ListBox3.List(i, 1)
Me.ComboBox_FuncRightVal.Value = Me.ComboBox_FuncRightVal.List(0)
' add filters Array(and_or, Comparator, tableright, columnright, FunctionRight, FunctionLeft)
Me.ListBox4.Clear
For h = 1 To .FilterSet.Count
Me.ListBox4.AddItem
Me.ListBox4.List(Me.ListBox4.ListCount - 1, 0) = .FilterSet(h)(0) ' and_or
Me.ListBox4.List(Me.ListBox4.ListCount - 1, 1) = Join(.FilterSet(h)(5), "|") ' function left
Me.ListBox4.List(Me.ListBox4.ListCount - 1, 2) = .FilterSet(h)(1) ' comparator
Me.ListBox4.List(Me.ListBox4.ListCount - 1, 3) = .FilterSet(h)(2) ' table right
Me.ListBox4.List(Me.ListBox4.ListCount - 1, 4) = .FilterSet(h)(3) ' column right
Me.ListBox4.List(Me.ListBox4.ListCount - 1, 5) = Join(.FilterSet(h)(4), "|") ' function right
Next
End With
End With
End If
End If
ElseIf Me.ListBox3.List(i, 2) <> vbNullString Then
If .Aggregates.Exists(Me.ListBox3.List(i, 0)) = True Then
With .Aggregates(Me.ListBox3.List(i, 0))(1)
Me.CheckBox_SQLltrim.Enabled = False
Me.CheckBox_SQLrtrim.Enabled = False
Me.CheckBox_SQLtrim.Enabled = False
Me.CheckBox_SQLlower.Enabled = False
Me.CheckBox_SQLupper.Enabled = False
Me.CommandButtonSQLreplace.Enabled = False
Me.CheckBox_FullJoinTable.Enabled = False
Me.Frame9.Visible = False
Me.TextBox_ConstraintType.Visible = False
Me.CommandButton8.Visible = False
Me.Label99.Visible = False
Me.Label100.Visible = False
Me.TextBox_ConstrTableName.Visible = False
Me.TextBox_ConstrColumnName.Visible = False
Me.TextBox_ExportName.Value = .Value
Me.CheckBox_ColumnHidden.Value = .Hidden
Me.CheckBox_ColumnEnabled.Value = .Active
Me.TextBox_ConstraintType.Value = .ConstraintType
Me.TextBox_ConstrTableName.Value = .ConstraintTable
Me.TextBox_ConstrColumnName.Value = .ConstraintColumn
Me.TextBox_FuncLeftCol.Value = "aggregate"
Me.ComboBox_FuncRightVal.Value = Me.ComboBox_FuncRightVal.List(0)
' add filters Array(and_or, Comparator, tableright, columnright, FunctionRight, FunctionLeft)
Me.ListBox4.Clear
For h = 1 To .FilterSet.Count
Me.ListBox4.AddItem
Me.ListBox4.List(Me.ListBox4.ListCount - 1, 0) = .FilterSet(h)(0)
Me.ListBox4.List(Me.ListBox4.ListCount - 1, 1) = Join(.FilterSet(h)(5), "|")
Me.ListBox4.List(Me.ListBox4.ListCount - 1, 2) = .FilterSet(h)(1)
Me.ListBox4.List(Me.ListBox4.ListCount - 1, 3) = .FilterSet(h)(2)
Me.ListBox4.List(Me.ListBox4.ListCount - 1, 4) = .FilterSet(h)(3)
Me.ListBox4.List(Me.ListBox4.ListCount - 1, 5) = Join(.FilterSet(h)(4), "|")
Next
End With
End If
End If
End With
Exit For
End If
Next
Me.ComboBox_FuncTypeRight.Value = Me.ComboBox_FuncTypeRight.List(0)
Me.ComboBox_FuncTypeLeft.Value = Me.ComboBox_FuncTypeLeft.List(0)
Call ComboBox_FuncComp_Change
End Sub