Dear All
i,m totlally new for vb 6.0 and i,m doing a invoice project and i,m facing a issue , can you plz tell me solution
i,m trying to retrive some datas from sql (Product table)
it contains following 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
But i need some fileds only like ItemNo,Descrp,P urprice,QtyIn
and my Pinvoice form contains this
............... ............... ............... ............... ............... ............... ......
InvoiceNo-TextBox Date-TextBox
SupId-DataCombo SupName-Textbox
............... ............... ............... ............... ............... ............... ....
ItemNo (Label) Descrption (Label) Qty(Lable) Price(Lable) Gross (Lable Qty*Price)
txtItem1.Txt txtDescrp1.Text txtQty1.Text txtRate1.Text txtGross1.Txt
txtItem2.Txt txtDescrp2.Text txtQty2.Text txtRate2.Text txtGross2.Txt
txtItem3.Txt txtDescrp3.Text txtQty3.Text txtRate3.Text txtGross3.Txt
My option is when i type the ItemNo which is in Product table the corresponding Descrp&Purprice &QtyIn should be appear in the other textboxes,once i finish the first row then it,ll happen in another two rows
so in Textbox Click_event i write this codings
dim n as string, dim a as integer
[Adodc control name=adpproduct and i specify the connection and set the recordsource as table name=Product]
a = 0
n = txtItem1.Text
adoproduct.Reco rdset.MoveFirst
Do While Not adoproduct.Reco rdset.EOF
If adoproduct.Reco rdset.Fields("I temNo") = 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
and i used the same coding with changed the txtbox name in also other 2 txtbox click event
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 C909 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
i,m totlally new for vb 6.0 and i,m doing a invoice project and i,m facing a issue , can you plz tell me solution
i,m trying to retrive some datas from sql (Product table)
it contains following 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
But i need some fileds only like ItemNo,Descrp,P urprice,QtyIn
and my Pinvoice form contains this
............... ............... ............... ............... ............... ............... ......
InvoiceNo-TextBox Date-TextBox
SupId-DataCombo SupName-Textbox
............... ............... ............... ............... ............... ............... ....
ItemNo (Label) Descrption (Label) Qty(Lable) Price(Lable) Gross (Lable Qty*Price)
txtItem1.Txt txtDescrp1.Text txtQty1.Text txtRate1.Text txtGross1.Txt
txtItem2.Txt txtDescrp2.Text txtQty2.Text txtRate2.Text txtGross2.Txt
txtItem3.Txt txtDescrp3.Text txtQty3.Text txtRate3.Text txtGross3.Txt
My option is when i type the ItemNo which is in Product table the corresponding Descrp&Purprice &QtyIn should be appear in the other textboxes,once i finish the first row then it,ll happen in another two rows
so in Textbox Click_event i write this codings
dim n as string, dim a as integer
[Adodc control name=adpproduct and i specify the connection and set the recordsource as table name=Product]
a = 0
n = txtItem1.Text
adoproduct.Reco rdset.MoveFirst
Do While Not adoproduct.Reco rdset.EOF
If adoproduct.Reco rdset.Fields("I temNo") = 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
and i used the same coding with changed the txtbox name in also other 2 txtbox click event
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 C909 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