By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,204 Members | 1,178 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,204 IT Pros & Developers. It's quick & easy.

Run time error 2147217842(80040e4e)

P: 31
Dear ADezii

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 int,Descrption varchar(20),Supid int,SupName varchar(20),Purprice float,SalPrice float,QtyIn int,QtySold int

i,m trying to retrive some datas from sql Product table

in a Textbox

so

txtItem1.Text txtDes1.Text txtQty1.Text txtRate1.Text

txtItem2.Text txtDes2.Text txtQty2.Text txtRate2.Text

txtItem3.Text txtDes3.Text txtQty3.Text txtRate3.Text

so i write this coding in my txtItem_Clisk event

a = o
n = Val(txtItem1.Text)
adoproduct.Recordset.MoveFirst
Do While Not adoproduct.Recordset.EOF
If adoproduct.Recordset.Fields("ItemNo") = Val(n) Then
txtDescrp1.Text = adoproduct.Recordset.Fields("Descrp")
txtPrice1.Text = adoproduct.Recordset.Fields("Purprice")
txtQty1.Text = adoproduct.Recordset.Fields("QtyIn")
a = 1
End If
adoproduct.Recordset.MoveNext
Loop
If a = 0 Then
MsgBox "Item No Mismatch"
End If
adoproduct.Refresh

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(80040e4e)
Opreation was canceled

and when i clicked the debug it showed me the
ItemNo,Purprice,QtyIn and the Description column in sql automattically deleted, if i click the 2nd button it running fine

so whats the problem and how can i solve this

plz i need ur help
Apr 13 '08 #1
Share this Question
Share on Google+
2 Replies


debasisdas
Expert 5K+
P: 8,127

txtItem1.Text txtDes1.Text txtQty1.Text txtRate1.Text

txtItem2.Text txtDes2.Text txtQty2.Text txtRate2.Text

txtItem3.Text txtDes3.Text txtQty3.Text txtRate3.Text
What is this part of the code ?
Apr 14 '08 #2

P: 31
Thank U debi for ur kind reply i used the same coding for other two txtbox click event and this is my real problem

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,Purprice,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.Recordset.MoveFirst
Do While Not adoproduct.Recordset.EOF
If adoproduct.Recordset.Fields("ItemNo") = n Then
txtDescrp1.Text = adoproduct.Recordset.Fields("Descrp")
txtPrice1.Text = adoproduct.Recordset.Fields("Purprice")
txtQty1.Text = adoproduct.Recordset.Fields("QtyIn")
a = 1
End If
adoproduct.Recordset.MoveNext
Loop
If a = 0 Then
MsgBox "Item No Mismatch"
End If
adoproduct.Refresh

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(80040e4e)
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
Apr 14 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.