当多数据时,为何出现3265错误呢?
程序代码:
Public Function Daily_Alarm_Arr(ByVal str_Date As Variant) Dim i As Integer Dim j, l, k As Byte Dim str_Field As Field Dim Arr_Field(), str_Data, str_Alarm, str_Modules, str_T As String Dim Arr_Data() As Variant 'status,Shift,Tool_Name.Module_Name,Alarm_Name,Action,Operator,Case_ID,Comment_Current,Comment_History distinct 'B.CaseResult,B.DutyShift,D.ToolID,A.Alarm_Module,A.Alarm_IDs,A.Alarm_Action,B.Sponsor,B.CaseID,B.CaseComment1,B.CaseComment2 Report_Search_TxT = "select B.CaseResult,B.DutyShift,D.ToolID,A.Alarm_Module,A.Alarm_IDs as A_IDs,A.Alarm_Action,B.Sponsor,B.CaseID,B.CaseComment1,B.CaseComment2 from ((Case_Alarm A " Report_Search_TxT = Report_Search_TxT & "left join Case_Rec B on A.CaseID=B.CaseID) " Report_Search_TxT = Report_Search_TxT & "left join Case_History C on A.CaseID=C.CaseID) " Report_Search_TxT = Report_Search_TxT & "left join [;database=" & DataBase_Name_Connect_Info & "].Info_ID_Tool D on D.TypeID=B.Tool_ID " Report_Search_TxT = Report_Search_TxT & "where C.Update_Time= '" & str_Date & "' " Report_Search_TxT = Report_Search_TxT & "order by B.CaseResult,B.DutyShift,B.Tool_ID" 'str_Judge, "Record_History", DataBase_Type, "Y" Set DB_Rs = WIS_Connect(Report_Search_TxT, "Record_History", DataBase_Type) k = 0 ReDim Arr_Field(9) For Each str_Field In DB_Rs.Fields ' If Not IsNull(str_Field.Value) Then Arr_Field(k) = str_Field.Name ' End If k = k + 1 DoEvents Next Report_Daily_Alarm_Count = DB_Rs.RecordCount If Report_Daily_Alarm_Count = 0 Then ReDim Report_Daily_Arr_Alarm_History(0) Report_Daily_Arr_Alarm_History(0) = "None Alarm Occur By:" & str_Date Else ReDim Report_Daily_Arr_Alarm_History(Report_Daily_Alarm_Count - 1, 9) DB_Rs.MoveFirst ReDim Arr_Data(9) For i = 0 To Report_Daily_Alarm_Count - 1 For j = 0 To 9 Arr_Data(j) = DB_Rs.Fields(Arr_Field(j)).Value Next If i <> Report_Daily_Alarm_Count - 1 Then DB_Rs.MoveNext DoEvents End If For j = 0 To 9 'Shift,result,Tool_Name.Module_Name,Alarm_Name,Action,Operator,Case_ID,Comment_Current,Comment_History If IsNull(Arr_Data(j)) = True Then Report_Daily_Arr_Alarm_History(i, j) = "" Else Report_Daily_Arr_Alarm_History(i, j) = Arr_Data(j) End If If j = 3 Then 'Modules str_Data = Arr_Data(3) ReDim Report_Daily_Arr_Alarm_Modules((Len(str_Data) / 6) - 1) 'MsgBox (Len(DB_Rs.Fields(Arr_Field(3)).Value) / 6) For l = 0 To (Len(str_Data) / 6) - 1 Report_Daily_Arr_Alarm_Modules(l) = Mid(str_Data, 1 + 6 * l, 5) str_T = "Select ItemName from Info_ID_Tool_Module where Module_ID='" & Report_Daily_Arr_Alarm_Modules(l) & "'" 'Alarm_Modules 搜索语句 str_Modules = str_Modules & Pub_Load_Data_1(str_T, "Record_Info", DataBase_Type) & "," Report_Daily_Arr_Alarm_History(i, 3) = str_Modules Next End If If j = 4 Then 'Alarm str_Data = Arr_Data(4) ReDim Report_Daily_Arr_Alarm_IDs((Len(str_Data) / 7) - 1) For l = 0 To (Len(str_Data) / 7) - 1 Report_Daily_Arr_Alarm_IDs(l) = Mid(str_Data, 1 + 7 * l, 6) str_T = "Select ItemName from Info_ID_Tool_Alarm where ItemID='" & Report_Daily_Arr_Alarm_IDs(l) & "'" 'Alarm_ID 搜索语句 str_Alarm = str_Alarm & "[" & l + 1 & ":" & Pub_Load_Data_1(str_T, "Record_Info", DataBase_Type) & "]," Report_Daily_Arr_Alarm_History(i, 4) = str_Alarm Next End If Next Next End If End Function
共2个数据的话,当i=1时候
出现 "3265"错误代码:
-> Arr_Data(j) = DB_Rs.Fields(Arr_Field(j)).Value
For j = 0 To 9 Arr_Data(j) = DB_Rs.Fields(Arr_Field(j)).Value Next