现在再改为:
Private Sub Command1_Click()
Dim jj, ss, ii As Integer
Dim d() As Integer
Dim f() As Integer
Dim h() As Integer
For ii = 0 To Rst.RecordCount
For jj = 0 To Rst.Fields.Count
If Rst.RecordCount > 0 Then
If Rst.Fields(jj).Value = "银行存款" Then
d(ii) = Rst.Fields(1).Value
h(ii) = Rst.Fields(2).Value
f(ii) = Val(Rst.Fields(jj + 2).Value) + Val(Rst.Fields(jj + 3).Value)
Else
Rst.MoveNext
Print d(ii)
Print f(ii)
Print h(ii)
End If
End If
Next jj
Next ii
End Sub
运行后,出现:
下标越界!