Code,please go through

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Vbbeginner07
    New Member
    • Dec 2007
    • 103

    Code,please go through

    [code=vb]
    Private Sub ListView2_ItemC lick(ByVal Item As MSComctlLib.Lis tItem)
    If ListView2.Selec tedItem.Checked = True Then
    rs.Open "select * from saldetail where date = '" & ListView2.Selec tedItem & "'", conn, adOpenStatic, adLockOptimisti c
    If Not rs.EOF Then
    rs.MoveFirst
    Do While Not rs.EOF
    res1 = 0
    If Trim(txttr.Text ) = "" Then
    Form3.txttamt.T ext = ""
    MsgBox "enter the tax rate", vbOKOnly, "ERROR"
    cbostate.SetFoc us
    Else
    res1 = txttr.Text / 100
    ' rs.MoveNext
    End If
    txtoh.Text = Val(txthrs.Text - txthrs.Text)
    txtotamt.Text = Val(txtoh.Text * txtotrt.Text)
    res = Val(txthrs.Text * txtrate.Text)
    Form3.txttamt.T ext = Val(res * res1)
    Form3.txtgros.T ext = Val(txthrs.Text * txtrate.Text)
    'str1 = txttr.Text
    Form3.txtnsal.T ext = Val(Form3.txtgr os.Text - Form3.txttamt)
    rs.Close
    Set rs = Nothing
    [/code]

    If we click one record in the listview it should show the corresponding record from datbase.....

    oneid--------------------several working days
    so for each working day one record from the datbase........ ..
    please go through....Than ks in advance
    NICK
    Last edited by Killer42; Jan 21 '08, 08:11 AM. Reason: debasisdas added code tags, I did the indenting.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    so, what is the problem ?

    Comment

    • Vbbeginner07
      New Member
      • Dec 2007
      • 103

      #3
      Originally posted by debasisdas
      so, what is the problem ?
      the control doesnot move out to each record in database,ie not displaying the record.

      Comment

      • QVeen72
        Recognized Expert Top Contributor
        • Oct 2006
        • 1445

        #4
        Originally posted by Vbbeginner07
        the control doesnot move out to each record in database,ie not displaying the record.
        Your Do While does not have a "Loop"
        I guess, your code does not even compile..
        Properly Indent the Code, it will help you a lot to write Strurtured syntax..
        [code=vb]
        Do While Not RS.EOF
        'Your code to populate text box here
        RS.MoveNext
        Loop
        [/code]

        Regards
        Veena

        Comment

        • debasisdas
          Recognized Expert Expert
          • Dec 2006
          • 8119

          #5
          Originally posted by Vbbeginner07
          the control doesnot move out to each record in database,ie not displaying the record.
          but,you are not retriving anything from recordset .

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            Originally posted by QVeen72
            Your Do While does not have a "Loop"
            I guess, your code does not even compile..
            Given that the code has obviously been compiled, it's evident that not all of it is posted here.

            Perhaps it would help if the entire Sub were posted, at least.

            Comment

            Working...