All,
I am using VB6.0.
I am geting 'function sequence error' in Do loop, when i do a recordset.movenext
Can you please tell me where i am wrong?
Thanks,
Subha
strSqlProdSeq = "SELECT DISTINCT SEQ_NUMBER" & _
" FROM QT_PRODUCTION Where " & _
"((QT_PRODUCTION.TURN_DATE) = {d '" & Format(dtmBDate, "yyyy-mm-dd") & "' }) AND ((QT_PRODUCTION.TURN) = '" & strTurn & "')"
Set rstProdSeq = New ADODB.Recordset
rstProdSeq.Open strSqlProdSeq, gcntPipeMill, adOpenStatic, adLockReadOnly, adCmdText
Do While Not rstProdSeq.EOF
lngProdSeq = rstProdSeq!SEQ_NUMBER
strQtRerunChgPcsSql = " select SUM(PROD_PIECES) CHARGED_PROD_PCS" & _
" From RERUNS " & _
" Where MILL_AREA = '" & Trim(gstrMillArea) & "'" & _
" AND Turn = '" & Trim(strTurn) & "'" & _
" AND Turn_Date = " & SqlDate(dtmBDate) & _
" AND PROD_SEQ_NUMBER = " & lngProdSeq & _
" AND CHG_OR_DISCHG = 'CHARGED'"
Set rstQtRerunPcs = New ADODB.Recordset
rstQtRerunPcs.Open strQtRerunChgPcsSql, gcntPipeMill, adOpenStatic, adLockReadOnly, adCmdText
frmPMRFrame.StatusMsg = "Generate Production Report: Getting Rerun Pcs Data"
If Not rstQtRerunPcs.EOF And Not rstQtRerunPcs.BOF Then
lngRRChgProdPcs = rstQtRerunPcs!CHARGED_PROD_PCS
strSql = "SELECT QT_PRODUCTION.UPDATE_USER, QT_PRODUCTION.UPDATE_DATE" & _
" FROM QT_PRODUCTION Where " & _
"((QT_PRODUCTION.TURN_DATE) = {d '" & Format(dtmBDate, "yyyy-mm-dd") & "' }) AND ((QT_PRODUCTION.TURN) = '" & strTurn & "')"
Set rstPrd = New ADODB.Recordset
rstPrd.Open strSql, gcntPipeMill, adOpenStatic, adLockReadOnly, adCmdText
If Not rstPrd.BOF Then
If Not rstPrd.EOF Then
strUpdate_User = rstPrd!Update_User
dUpdate_Date = rstPrd!Update_Date
End If
End If
strSql = "Select Qt_Production.Turn_Date, Qt_Production.Turn, " _
& "Qt_Production.Prod_Seq_Number, Qt_Production.Roc , Qt_Production.Od, " _
& "Qt_Production.Wall, Qt_Production.Pipe_Grade, Qt_Production.Heat," _
& "Qt_Production.Cont_Number, Qt_Production.Length,'" & dUpdate_Date & "' Updated_Date, " _
& "'" & strUpdate_User & "' Updated_User,Qt_Production.Cont_Pieces, Qt_Production.Pieces_Chg_Original, " _
& lngRRChgProdPcs & ", Qt_Production.Pieces_Chg_Scrap, " _
& "Qt_Production.Pieces_Dischg_Prime, Qt_Production.Pieces_Dischg_Rerun," _
& "Qt_Production.Pieces_Dischg_Scrap, Qt_Production.Pieces_Dischg_Alp_Chg, " _
& "Qt_Production.Pieces_Left_On_Line, Qt_Production.Process, " _
& "Qt_Production.Wbct, Qt_Production.Spacing, Qt_Production.Aust_Temperature, " _
& "Qt_Production.Temper_Temperature, Qt_Production.Sm_Roller_Change, Qt_Production.Comments, " _
& "Qt_Production.Piece_Wt "
strSql = strSql & " From (Qt_Production Inner Join Pmr_Turn_Data " _
& "On (Qt_Production.Turn = Pmr_Turn_Data.Turn) And " _
& "(Qt_Production.Turn_Date = Pmr_Turn_Data.Turn_Date)) "
strSql = strSql & "Left Join Qt_Shutdown_Data On " _
& "(Qt_Production.Turn = Qt_Shutdown_Data.Turn) And " _
& "(Qt_Production.Turn_Date = Qt_Shutdown_Data.Turn_Date) "
strSql = strSql & " Where (((Qt_Production.Turn_Date) = " _
& SqlDate(dtmBDate) & " " _
& "And ((Qt_Production.Turn) = '" & strTurn & "')) " _
& "And ( Pmr_Turn_Data.Mill_Area = '" & Trim(gstrMillArea) & "')) " _
& " AND PROD_SEQ_NUMBER = " & lngProdSeq & " Order By Qt_Production.Prod_Seq_Number"
Set rstPrd = New ADODB.Recordset
rstPrd.Open strSql, gcntPipeMill, adOpenStatic, adLockReadOnly, adCmdText
End If
rstProdSeq.MoveNext
Loop
I am using VB6.0.
I am geting 'function sequence error' in Do loop, when i do a recordset.movenext
Can you please tell me where i am wrong?
Thanks,
Subha
strSqlProdSeq = "SELECT DISTINCT SEQ_NUMBER" & _
" FROM QT_PRODUCTION Where " & _
"((QT_PRODUCTION.TURN_DATE) = {d '" & Format(dtmBDate, "yyyy-mm-dd") & "' }) AND ((QT_PRODUCTION.TURN) = '" & strTurn & "')"
Set rstProdSeq = New ADODB.Recordset
rstProdSeq.Open strSqlProdSeq, gcntPipeMill, adOpenStatic, adLockReadOnly, adCmdText
Do While Not rstProdSeq.EOF
lngProdSeq = rstProdSeq!SEQ_NUMBER
strQtRerunChgPcsSql = " select SUM(PROD_PIECES) CHARGED_PROD_PCS" & _
" From RERUNS " & _
" Where MILL_AREA = '" & Trim(gstrMillArea) & "'" & _
" AND Turn = '" & Trim(strTurn) & "'" & _
" AND Turn_Date = " & SqlDate(dtmBDate) & _
" AND PROD_SEQ_NUMBER = " & lngProdSeq & _
" AND CHG_OR_DISCHG = 'CHARGED'"
Set rstQtRerunPcs = New ADODB.Recordset
rstQtRerunPcs.Open strQtRerunChgPcsSql, gcntPipeMill, adOpenStatic, adLockReadOnly, adCmdText
frmPMRFrame.StatusMsg = "Generate Production Report: Getting Rerun Pcs Data"
If Not rstQtRerunPcs.EOF And Not rstQtRerunPcs.BOF Then
lngRRChgProdPcs = rstQtRerunPcs!CHARGED_PROD_PCS
strSql = "SELECT QT_PRODUCTION.UPDATE_USER, QT_PRODUCTION.UPDATE_DATE" & _
" FROM QT_PRODUCTION Where " & _
"((QT_PRODUCTION.TURN_DATE) = {d '" & Format(dtmBDate, "yyyy-mm-dd") & "' }) AND ((QT_PRODUCTION.TURN) = '" & strTurn & "')"
Set rstPrd = New ADODB.Recordset
rstPrd.Open strSql, gcntPipeMill, adOpenStatic, adLockReadOnly, adCmdText
If Not rstPrd.BOF Then
If Not rstPrd.EOF Then
strUpdate_User = rstPrd!Update_User
dUpdate_Date = rstPrd!Update_Date
End If
End If
strSql = "Select Qt_Production.Turn_Date, Qt_Production.Turn, " _
& "Qt_Production.Prod_Seq_Number, Qt_Production.Roc , Qt_Production.Od, " _
& "Qt_Production.Wall, Qt_Production.Pipe_Grade, Qt_Production.Heat," _
& "Qt_Production.Cont_Number, Qt_Production.Length,'" & dUpdate_Date & "' Updated_Date, " _
& "'" & strUpdate_User & "' Updated_User,Qt_Production.Cont_Pieces, Qt_Production.Pieces_Chg_Original, " _
& lngRRChgProdPcs & ", Qt_Production.Pieces_Chg_Scrap, " _
& "Qt_Production.Pieces_Dischg_Prime, Qt_Production.Pieces_Dischg_Rerun," _
& "Qt_Production.Pieces_Dischg_Scrap, Qt_Production.Pieces_Dischg_Alp_Chg, " _
& "Qt_Production.Pieces_Left_On_Line, Qt_Production.Process, " _
& "Qt_Production.Wbct, Qt_Production.Spacing, Qt_Production.Aust_Temperature, " _
& "Qt_Production.Temper_Temperature, Qt_Production.Sm_Roller_Change, Qt_Production.Comments, " _
& "Qt_Production.Piece_Wt "
strSql = strSql & " From (Qt_Production Inner Join Pmr_Turn_Data " _
& "On (Qt_Production.Turn = Pmr_Turn_Data.Turn) And " _
& "(Qt_Production.Turn_Date = Pmr_Turn_Data.Turn_Date)) "
strSql = strSql & "Left Join Qt_Shutdown_Data On " _
& "(Qt_Production.Turn = Qt_Shutdown_Data.Turn) And " _
& "(Qt_Production.Turn_Date = Qt_Shutdown_Data.Turn_Date) "
strSql = strSql & " Where (((Qt_Production.Turn_Date) = " _
& SqlDate(dtmBDate) & " " _
& "And ((Qt_Production.Turn) = '" & strTurn & "')) " _
& "And ( Pmr_Turn_Data.Mill_Area = '" & Trim(gstrMillArea) & "')) " _
& " AND PROD_SEQ_NUMBER = " & lngProdSeq & " Order By Qt_Production.Prod_Seq_Number"
Set rstPrd = New ADODB.Recordset
rstPrd.Open strSql, gcntPipeMill, adOpenStatic, adLockReadOnly, adCmdText
End If
rstProdSeq.MoveNext
Loop