Click here to Skip to main content
15,889,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi friends ,
i want to use 2 loop in 1 do while statement
i loop for id data in not found then go to next record
ii when he complit the opration of do while purpes and access.recordcount > currant record then secound loop but i get error in this function please help me,

What I have tried:

Dim num1 As Decimal = 0.0
    Dim num2 As Decimal = 0.0
    Dim num3 As Decimal = 0.0
    Dim i_tot As Decimal = 0.0
    Dim rec_tot As Decimal = 0.0
    Dim bal_tot As Decimal = 0.0
    Dim inv_no As String = ""
    Dim inv_dt As String = ""
    Dim p_cd As Integer = 0
    Dim tran_cd As Integer = 0
    Dim m_id As Integer = 0

    If NoErrors(True) = False Then MsgBox(access.Exception)
    access.Execquery("select cust_code from CUSTOMER_MASTER ")
    If currentrecord > access.dbdt.Rows.Count - 1 Then currentrecord = 0 ' Loop to first record
    Do While currentrecord < access.recordcount
        access.Execquery("select cust_code from CUSTOMER_MASTER ")
        Dim dr As DataRow = access.dbdt.Rows(currentrecord)
        X_PARTY_data = dr("cust_code").ToString
        access.addparam1("@x1", X_PARTY_data)
        access.Execquery("select PARTY_CODE,INVOICE_NO,INVOICE_DATE,INVOICE_AMOUNT_tax,balance_amount,recived_amount,sl_trancode,ID " & _
                         "from inv_report " & _
                         "where PARTY_CODE=@x1")
        If currentrecord > access.dbdt.Rows.Count - 1 Then
            currentrecord = 0
            access.Execquery("select cust_code from CUSTOMER_MASTER ")
            NextRecord(1)
             Loop
        End If


    While currentrecord < access.recordcount
        'value_sls_inv
        Dim drr As DataRow = access.dbdt.Rows(currentrecord)
        inv_no = drr("INVOICE_NO").ToString
        inv_dt = drr("INVOICE_DATE").ToString
        i_tot = drr("INVOICE_AMOUNT_tax").ToString
        bal_tot = drr("balance_amount").ToString
        rec_tot = drr("recived_amount").ToString
        p_cd = drr("PARTY_CODE").ToString
        tran_cd = drr("sl_trancode").ToString
        m_id = drr("ID").ToString

        num1 = num1 + i_tot
        num2 = num2 + bal_tot
        num3 = num3 + rec_tot
        If currentrecord = access.recordcount Then
            Exit While
        End If
        NextRecord(1)
        rcont1 = rcont1 + 1
        MsgBox("R1" & rcont1)
    End While
    access.addparam("@RP1", inv_no)
    access.addparam1("@rp2", inv_dt)
    access.addparam1("@rp3", i_tot)
    access.addparam1("@rp4", bal_tot)
    access.addparam1("@rp5", rec_tot)
    access.addparam1("@rp6", p_cd)
    access.addparam1("@rp7", tran_cd)
    access.addparam1("@rp8", m_id)
    access.Execquery("insert into value_sls_inv(INVOICE_NO,[INVOICE_DATE],[INVOICE_AMOUNT_tax],[balance_amount],[recived_amount],[PARTY_CODE],[id]) " & _
                     "values(@RP1,@RP2,@RP3,@RP4,@RP5,@RP6,@RP7,@RP8) ")
    If NoErrors(True) = False Then MsgBox(access.Exception)


    Loop
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900