Run time error 3001 in VB6

Tags:
Visual Basic
Hi friends, I am using VB6 as front end and access as back end.bill no cancellation run time error 31 occurs. Please help me.
Private Sub stockadjust()
    Dim rstran As New ADODB.Recordset
    If rstran.State = 1 Then rstran.Close
    
    RSPRODUCT.Open ("product"), con, adOpenKeyset, adLockOptimistic, adCmdTableDirect
    RSPRODUCT.Index = "primarykey"
    
    If RSM.State = 1 Then RSM.Close
    RSM.Open ("billmaster"), con, adOpenKeyset, adLockOptimistic, adCmdTableDirect
    RSM.Index = "primarykey"
    
    RSM.Seek txt_billno
    If RSM.EOF = False Then
        If RSM.Fields("RECEIVED") <> 0 Or RSM!Date <> Date Then
            MsgBox "Not possible !!!"
            Exit Sub
        End If
    
        RSM!cancelled = True
        RSM.Update
        'If LastBill = True Then
        '    rsm.Delete
        'End If
    
        rstran.Open "DELETE  FROM TRANSACTIONDETAILS WHERE CODE =" & RSM!ACSLNO, accounts, adOpenKeyset, adLockOptimistic
    End If
    
    
    If RSD.State = 1 Then RSD.Close
    RSD.Open ("select * from billdetails where billno ='" + Trim(txt_billno)) + "'", con, adOpenKeyset, adLockOptimistic, adCmdTableDirect
    RSD.MoveFirst
    
    
    While RSD.EOF = False
        RSPRODUCT.Seek RSD!ITEMCODE
'        If rsPRODUCT!batchexist = True Then
            rsbatch.Open ("select * from batchdetails where PRODUCTCODE ='" + RSD!ITEMCODE) + "'" + "and batchno ='" + RSD!BATCHNO + "'", con, adOpenKeyset, adLockOptimistic
            rsbatch!stock = rsbatch!stock + RSD!QTY + RSD!Free
                        
            If RSPRODUCT.EOF = False Then
                RSPRODUCT!GODOWN = RSPRODUCT!GODOWN + (RSD!QTY + RSD!Free)
            Else
                MsgBox ("STOCK ERROR")
            End If
            rsbatch.Update
            RSPRODUCT.Update
            rsbatch.Close
'        Else
'            If rsPRODUCT.EOF = False Then
'                rsPRODUCT!GODOWN = rsPRODUCT!GODOWN + (RSD!QTY + RSD!Free)
'                rsPRODUCT.Update
'            Else
'                MsgBox ("STOCK ERROR")
'            End If
'        End If
        
        RSD!cancelled = True
        RSD.Update
        RSD.MoveNext
    Wend
    
'    While RSD.EOF = False
'        rsPRODUCT.Seek RSD!ITEMCode
'        If rsPRODUCT.EOF = False Then
'            rsPRODUCT!GODOWN = rsPRODUCT!GODOWN + (RSD!QTY)
'            rsPRODUCT.Update
'        Else
'            MsgBox ("STOCK ERROR")
'        End If
'
'        RSD!cancelled = True
'        RSD.Update
'
'        'If LastBill = True Then
'        '    rsd.Delete
'        'End If
'
'        RSD.MoveNext
'    Wend
    
    RSM.Close
    RSD.Close
    RSPRODUCT.Close
End Sub
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: