例如 not rs.bof or not rs.eof
if not(rs.eof or rs.bof) then
do white not rs.fields(0)=XPCombo1.text
rs.movenext
loop
end if
ClassReport.sections(4).controls("label15").caption=rs.fields(2)
这里加个If判断,判断数组下标有没有越界,如果越界就退出循环即可。Option Base 1
Private Sub Form_Click()
Dim a%(100), b%(), i%, n%, j%
n = 0
For i = 1 To 100
a(i) = Int(Rnd * 100 + 1)
If a(i) Mod 2 = 0 Then n = n + 1
Next i
ReDim b%(n)
j = 0
For i = 1 To 100
If a(i) Mod 2 = 0 Then b(j) = a(i)
j = j + 1
If j = UBound(b()) Then Exit Sub
Next i
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)