VBA 阵列索引超出范围

fieldset{padding:10px;}

VBA 阵列索引超出范围 求助请问各位VBA大侠,运行此段代码,当intcount=21时,提示“阵列索引超出范围”,无法再运行下去,如何解决呢?Public Function LoadFromDB(Connection As sqlDB, SQL As String, _FieldName As String, Optional NameField As String = "", Optional Append As Boolean = True) As Integer Dim objRS As Recordset, intCount As Integer Dim strtemp As String Set objRS = Connection.OpenRecordset(SQL) If Not objRS Is Nothing Then If Not Append Then Clear intCount = 0 While Not objRS.EOF AddItem objRS(FieldName), IIf(NameField = "", IsNull(objRS(FieldName)), IsNull(objRS(NameField))) intCount = intCount + 1 objRS.MoveNext Wend Connection.CloseRecordset objRS LoadFromDB = intCount Else LoadFromDB = -1 End IfEnd Function——解决方案——————————————————–请问,这个问题你到最后解决了吗?我也遇到了同样的问题。。。顺境的美德是节制,逆境的美德是坚韧,这后一种是较为伟大的德性。

VBA  阵列索引超出范围

相关文章:

你感兴趣的文章:

标签云: