疑难求解,请指教!!!
我窗体里有两个combo控件,我希望点击combo1时,combo2会显示不同的内容!
Private Sub Combo1_click()
Dim strperson As String
Dim conn As New ADODB.Connection
Dim rst As ADODB.Recordset
Select Case Combo1.ListIndex
Case 0
conn.Open ("dsn=people")
Set rst = conn.Execute("select * from three")
If rst.BOF And rst.EOF Then Exit Sub
rst.MoveFirst
While Not rst.EOF
For i = 0 To rst.RecordCount - 1
strperson = CStr(rst!联系人)
With Combo2
.AddItem "strperson"
End With
Next i
rst.MoveNext
Wend
Debug.Print i
End Select
End Sub
其中three是我acess数据库的一个表,“联系人”是表中的一个字段。
可是我运行时,却发现运行到 For i = 0 To rst.RecordCount - 1后,程序就跳过中间一段,直接到了Next i。致使combo2中无任何显示内容。怎么回事?