vb编程 实时错误'91'对象变量或With块变量未设置

来源:百度知道 编辑:UC知道 时间:2024/06/14 00:11:06
Private Sub Command2_Click()
Dim listindexX() As Integer
Dim i1 As Integer
Dim i2 As Integer
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Text2.Text & " ;Persist Security Info=False"
ReDim listindexX(1 To List1(0).SelCount)
i1 = 1
For i2 = 0 To List1(0).ListCount - 1
If List1(0).Selected(i2) = True Then
listindexX(i1) = i2
i1 = i1 + 1
End If
Next i2

i3 = ""
For i1 = 1 To List1(0).SelCount
If i1 < List1(0).SelCount Then i3 = i3 & List1(0).List(listindexX(i1)) & ","
If i1 = List1(0).SelCount Then i3 = i3 & List1(0).List(listindexX(i1))
Next i1

i4 = ""
If List1(0).SelCount > 1 Then
For i1 = 2 To List1(0).SelCount
If i1 < List1(0).SelCount Then

错误出在哪一行?
这个地方应该有错误
Adodc1.RecordSource = "select * from " & Combo1(0).Text & "," & i3 & " where " & i4

对字符串变量的查询要加'
如 & "where " & "'" & i4 & "'"
具体的你再仔细检查一下你的select 语句吧.