-1

我的主管让我在 vb6 中调试一个最近的程序。我只有vb的基础知识。当我尝试运行程序时,会显示 byref 参数不匹配。谁能帮我这个。我会很感激任何评论。

Public Sub S2_Sort()

'loop day
For dCnt = 1 To UBound(S2.Day())
    ReDim S2.Day(dCnt).tList(0)

    'loop shift
    For tCnt = 1 To UBound(TaskID())
        ReDim Preserve S2.Day(dCnt).tList(tCnt)
        ReDim Preserve S2.Day(dCnt).tList(tCnt).sList(0)
        'dicShift.RemoveAll

        'loop task
        For sCnt = 1 To UBound(Shift())
            ReDim Preserve S2.Day(dCnt).tList(tCnt).sList(sCnt)
            ReDim Preserve S2.Day(dCnt).tList(tCnt).sList(sCnt).TaskRecList(0)

            'query with paramaters for project, datetime, and taskid
             strQuery = "SELECT * FROM PROD_DB WHERE PROJECT_ID = '" & inpProject & "'" & _
                    " AND " & GetTimestamp(S2.Day(dCnt).DayVal, Shift(sCnt).NextDay, True, Shift(sCnt).StartHour, _
                    Shift(sCnt).HourLen) & _
                    " AND TASK_ID = '" & TaskID(tCnt).TaskID & "'" & _
                    " ORDER BY START_TIME, TASK_ID"
            Set rstInfo = AdoConn.Execute(strQuery)

            If Not (rstInfo.EOF And rstInfo.BOF) Then
                rstInfo.MoveFirst
                wCnt = 0
                Do Until rstInfo.EOF
                    wCnt = wCnt + 1
                    ReDim Preserve S2.Day(dCnt).tList(tCnt).sList(sCnt).TaskRecList(wCnt)
                    'save the records to a arraylist datarecord
                    Call SetDataRecord(rstInfo, wCnt)

                    'then compute, get the work time number and list it on stLIst
                    S2.Day(dCnt).tList(tCnt).sList(sCnt).Val = S2_Compute(S2.Day(dCnt).tList(tCnt).sList(sCnt).TaskRecList(wCnt), S2.Day(dCnt).tList(tCnt).sList(sCnt).Val)
                    S2.Day(dCnt).tList(tCnt).Val = S2_Compute(S2.Day(dCnt).tList(tCnt).sList(sCnt).TaskRecList(wCnt), S2.Day(dCnt).tList(tCnt).Val)
                    'S2.Day(dCnt).tList(tCnt).MstUnit = DataRecord(X).MeasurementUnit
                    'S2.Day(dCnt).tList(tCnt).Cost = DataRecord(X).Cost
                    S2.Day(dCnt).tList(tCnt).ResourceName = S2.Day(dCnt).tList(tCnt).ResourceName + S2.Day(dCnt).tList(tCnt).sList(sCnt).TaskRecList(wCnt).ResourceName
                    S2.Day(dCnt).Val = S2_Compute(S2.Day(dCnt).tList(tCnt).sList(sCnt).TaskRecList(wCnt), S2.Day(dCnt).Val)

                    rstInfo.MoveNext
                Loop
            End If
            Set rstInfo = Nothing
        Next sCnt 'Next Shift
    Next tCnt 'Next Task
Next dCnt 'Next Day
End Sub
4

1 回答 1

1

ByRef 参数不匹配错误通常是传递给期望不同类型的 Sub 的参数类型之间的简单不匹配。您的变量声明不存在于代码中,因此无法分辨。

我看到的对另一个 Sub 的唯一调用是该Call SetDataRecord(rstInfo, wCnt)行。

因此,对照 SetDataRecord 期望的参数类型检查 rstInfo 和 wCnt 的类型。

于 2013-05-10T09:11:47.460 回答