Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,566 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,901 people online right now. Registration is fast and FREE... Join Now!




Run time error 2147217842(80040e4e) in vb 6.0 form

 
Reply to this topicStart new topic

Run time error 2147217842(80040e4e) in vb 6.0 form

iyad
13 Apr, 2008 - 09:41 PM
Post #1

New D.I.C Head
*

Joined: 13 Apr, 2008
Posts: 3

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,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 want to 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





User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 11:53PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month