Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba 如何确定导致灾难性错误的原因_Vba - Fatal编程技术网

Vba 如何确定导致灾难性错误的原因

Vba 如何确定导致灾难性错误的原因,vba,Vba,我在列表框表单选择的特定序列上遇到灾难性错误。。。 我如何确定到底是什么导致了灾难性错误?从我的文件中可以重复该错误 在下面的代码中,我将msgbox设置为“a”,错误不再出现。。。如果我去掉它,它会再次出现。而且,它仅在我运行excel文件并打开表单并选择该列表框上的项之后出现。 对于这个特定的表单,代码大约是4000行和150000个字符。与其他类相比,它超过10000行,超过300000个字符 Private Sub ListBox3_Change() Dim partf As Varia

我在列表框表单选择的特定序列上遇到灾难性错误。。。 我如何确定到底是什么导致了灾难性错误?从我的文件中可以重复该错误

在下面的代码中,我将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
Private子列表框3_Change()
Dim partf作为变量,ctype作为字符串
重读谱号(4)
ReDim fncright(4)
Dim i为整数,h为整数
对于i=0到Me.ListBox3.ListCount-1
如果Me.ListBox3.Selected(i)=True,则
使用bomfix.ExcelTables(Me.ComboBox_Tables2.Value)。设置
如果Me.ListBox3.List(i,1)vbNullString,则
Me.CheckBox\u SQLltrim.Enabled=True
Me.CheckBox\u SQLrtrim.Enabled=True
Me.CheckBox\u SQLtrim.Enabled=True
Me.CheckBox\u SQLlower.Enabled=True
Me.CheckBox\u SQLupper.Enabled=True
Me.CommandButtonSQLreplace.Enabled=True
Me.Frame9.Visible=True
Me.TextBox\u ConstraintType.Visible=True
Me.CommandButton8.Visible=True
Me.Label99.Visible=True
Me.Label100.Visible=True
Me.TextBox\u ConstrTableName.Visible=True
Me.TextBox\u constructColumnName.Visible=True
如果.TableExists(Me.ListBox3.List(i,0))=True,则
如果.Table(Me.ListBox3.List(i,0)).ColumnExists(Me.ListBox3.List(i,1))=True,则
Me.ComboBox\u PartTable.List=.Tables
Me.ComboBox_PartTable.AddItem vbNullString,0
With.Table(Me.ListBox3.List(i,0))
Me.CheckBox\u FullJoinTable.Enabled=True
Me.CheckBox\u FullJoinTable.Value=.FullJoin
With.column(Me.ListBox3.List(i,1))
Me.TextBox\u ExportName.Value=.Value
Me.CheckBox\u ColumnHidden.Value=.Hidden
Me.CheckBox\u ColumnEnabled.Value=.Active
Me.TextBox_ConstraintType.Value=.ConstraintType
Me.TextBox\u ConstrTableName.Value=.ConstraintTable
Me.TextBox\u ConstrColumnName.Value=.ConstraintColumn
Me.CheckBox\u SQLltrim.Value=.SQLltrim
Me.CheckBox\u SQLrtrim.Value=.SQLrtrim
Me.CheckBox\u SQLtrim.Value=.SQLtrim
Me.CheckBox_SQLlower.Value=.SQLlower
Me.CheckBox_SQLupper.Value=.SQLupper
MsgBox“b”
partf=.PartitionFilter
如果未绑定(partf)<0,则
Me.TextBox\u PartResults.Value=partf(0)
如果bomfix.ExcelTables(Me.ComboBox_tables 2.Value).settings.table存在(partf(1))=True,则
Me.ComboBox\u PartTable.Value=partf(1)
Me.ComboBox\u PartColumn.List=bomfix.ExcelTables(Me.ComboBox\u Tables2.Value).settings.Table(Me.ComboBox\u PartTable.Value).Columns
Me.ComboBox\u PartColumn.AddItem vbNullString,0
如果bomfix.ExcelTables(Me.ComboBox_Tables2.Value).settings.Table(partf(1)).ColumnExists(partf(2))=True,则
Me.ComboBox\u PartColumn.Value=partf(2)
Me.ComboBox\u PartOrderBy.Value=partf(3)
如果结束
如果结束
其他的
Me.TextBox_PartResults.Value=vbNullString
Me.ComboBox_PartTable.Value=vbNullString
Me.ComboBox_PartColumn.Value=vbNullString
Me.ComboBox_PartOrderBy.Value=vbNullString
如果结束
Me.TextBox_FuncLeftCol.Value=Me.ListBox3.List(i,0)&“&Me.ListBox3.List(i,1)
Me.ComboBox_FuncRightVal.Value=Me.ComboBox_FuncRightVal.List(0)
'添加过滤器数组(和或、比较器、tableright、columnright、FunctionRight、FunctionLeft)
Me.ListBox4.Clear
对于h=1到.FilterSet.Count
Me.ListBox4.AddItem
Me.ListBox4.List(Me.ListBox4.ListCount-1,0)=.FilterSet(h)(0)”和_或
Me.ListBox4.List(Me.ListBox4.ListCount-1,1)=左连接(.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)=右键联接(.FilterSet(h)(4),“|”)函数
下一个
以
以
如果结束
如果结束
ElseIf Me.ListBox3.List(i,2)vbNullString然后
如果.Aggregates.Exists(Me