Code for validation.???Not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #16
    Hi,


    Do I Miss something here ....?

    You Open a Recordset in "empDetail"
    and Insert Record in "SalDetail"

    Originally posted by Vbbeginner07
    rs1.Open "select * from empdetail Where name='" & strName & "'", conn, adOpenStatic, adLockOptimisti c

    conn.Execute "insert into saldetail(id,da te,othours,otam t,taxrate,netsa l,province)valu es ('" & store & "','" & dtpay & "','" & txtoh & "','" & txtotamt & "','" & txttr & "','" & txtnsal & "','" & cbostate & "')"
    ...?

    Regards
    Veena

    Comment

    • Vbbeginner07
      New Member
      • Dec 2007
      • 103

      #17
      Originally posted by QVeen72
      Hi,


      Do I Miss something here ....?

      You Open a Recordset in "empDetail"
      and Insert Record in "SalDetail"



      ...?

      Regards
      Veena
      yes yes............ .
      select from empdetail
      and insert in saldeatil

      Comment

      • QVeen72
        Recognized Expert Top Contributor
        • Oct 2006
        • 1445

        #18
        Hi,

        In that Case, You populate ListView from EmpDetails, And Always RS1 is Populated with Records from EmpDetails, So you cannot Check For RS1.EOF
        Open one more recordset for salDetail and check EOF of that..
        some thing like this....

        [CODE=vb]
        strName = ListView1.Selec tedItem
        rs1.Open "select * from empdetail Where name='" & strName & "'", conn, adOpenStatic, adLockOptimisti c
        store = rs1!id
        Dim RS2 As New ADODB.RecordSet
        Set RS2 = Nothing
        RS2.Open "select * from Saldetail Where ID='" & Store & "'", conn, adOpenStatic, adLockOptimisti c
        If RS2.EOF Then
        conn.Execute "insert into saldetail(id,da te,othours,otam t,taxrate,netsa l,province)valu es ('" & store & "','" & dtpay & "','" & txtoh & "','" & txtotamt & "','" & txttr & "','" & txtnsal & "','" & cbostate & "')"
        MsgBox "INSERTED NEW RECORDS", vbOKOnly, "ADDING NEW RECORDS"
        Else
        ' ID Found In DB (Duplicate)
        MsgBox "Duplicate Entry"
        End If
        rs1.Close
        Set rs1 = Nothing
        RS2.Close
        Set RS2 = Nothing
        [/CODE]


        Regards
        Veena

        Comment

        • Vbbeginner07
          New Member
          • Dec 2007
          • 103

          #19
          Thank you all, I got it.
          I was wrong!
          Last edited by Killer42; Dec 18 '07, 09:21 PM.

          Comment

          Working...