Doubt in vb 6.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hussainiyad
    New Member
    • Feb 2007
    • 31

    Doubt in vb 6.0

    Dear All,

    I,m doing a invoice project and in it i want to create both salesInvoice & purchase order

    my Purchaseinvoice table contains following fields

    1.InvoiceNo int primary key
    2.Pdate datetime
    3.Supplier Id varchar(10)(Thi s sup id should come from supplier table)
    4.SupName(20)
    5.ItemNo varchar(10)(Thi s following fields should from Product table)
    6.Descrption varchar(20)
    7.Purprice float
    8.Qty int

    my Product table contains followings fields

    ItemNo varchar(10)
    1.N1001
    2.C909
    3.F600
    Descrption varchar(20)
    Fan
    Chair
    Table
    Supid int
    1001
    1009
    1010
    Purprice float
    65.0
    47.0
    20.0
    SalPrice float
    75.0
    55.0
    30.0
    QtyIn int
    100
    300
    200
    QtySold int
    0
    0
    0


    so the invoice form i created like this

    Invoice No (TextBox) Pdate(TextBox)

    SupId (DataCombo) SupName(TextBox )
    ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' '''''''''''''''
    ItemNo Descrp Price Qty Gross

    txtItemNo1.text txtdes1.text txtprice1.text txtqty1.text txtgross1.text

    txtItemNo2.text txtdes2.text txtprice2.text txtqty2.text txtgross2.text

    txtItemNo3.text txtdes3.text txtprice3.text txtqty3.text txtgross3.text


    This is my form and i need to retrive the SupName from supplier table when i choose the datacombo SupId(i already binded) and i when i type and click the ItemNo in txtItemNo1.Text then i want to come all the description,Qty ,PurPrice to that corresponding itemno(i have 10 itemno with descrp,qty,pric e in the table)
    from the Product table, so when i type the ItemNo in txtItemNo2.text the another
    ItemNo will come it same for all txtbox

    so i write the following coding in txtItemNo1.Clic k event
    dim a as integer, dim n as string
    a = 0
    n = Val(txtItem1.Te xt)
    adoproduct.Reco rdset.MoveFirst
    Do While Not adoproduct.Reco rdset.EOF
    'Do While Not EOF
    'If adosupplier.Rec ordset.Fields(" SupId") = Val(n) Then
    If adoproduct.Reco rdset.Fields("I temNo") = Val(n) Then
    txtDescrp1.Text = adoproduct.Reco rdset.Fields("D escrp")
    txtPrice1.Text = adoproduct.Reco rdset.Fields("P urprice")
    txtQty1.Text = adoproduct.Reco rdset.Fields("Q tyIn")
    a = 1
    End If
    adoproduct.Reco rdset.MoveNext
    Loop
    If a = 0 Then
    MsgBox "Item No Mismatch"
    End If
    adoproduct.Refr esh

    it,s not working and showed me the error msg

    when i run my form it showed me the error msg

    "Run time error 2147217842(8004 0e4e)
    Opreation was canceled

    and when i clicked the debug it showed me the only the 2 fields of the Product table
    ItemNo's N1001-Purprice 65,QtyIn 100 but Description column in sql automattically deleted from the table, and if i type the ItemNoC909 in this txtbox with the same error msg it showed me the same value (65,100) if type the ItemNo in 2nd txtItem2.Text it showed me the error
    but if i specify the itemNo as C909 in txtItem1.Text it didn't show me other column and directly goes to the EndIf statement and showed me the "Invalid ItemNo"Msgbox

    so i take some datas from Product and insert in the new Pinvoice table


    so whats the real problem and there is anything wrong in my coding plz tell me how can i solve this problem and instead of textbox how can i use datacombo to retrive the fields and what i should i do to solve this issue

    plz i need ur help
Working...