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

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




Introduction Mail : Hussain

 
Reply to this topicStart new topic

Introduction Mail : Hussain

iyad
13 Apr, 2008 - 05:14 AM
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) and after that i insert it into Purinvoice table

The Product table contains the following fields

ItemNo varchar(10)
Descrption varchar(20) Supid int
1.N1001 Fan 101
2.C909 Chair 309
3.F600 Table 408

Purprice float, SalPrice float, QtyIn int, QtySold int
65.0 75.0 100 0
47.0 55.0 300 0
20.0 30.0 120 0

But i need some fileds only like ItemNo,Descrp,Purprice,QtyIn
and my 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


so i write this coding in my txtItem1_Click event
dim n as string
[Adodc control name=adpproduct and i specify the connection and set the recordsource as table name=Product]
a = o
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 first row of the
ItemNo's N1001-Purprice,QtyIn but Description column in sql automattically deleted, if i click the 2nd button it running fine
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 once i solve this issue then i insert this fields to another table Purinvoice]

so whats the real problem and how can i solve this instead of textbox how can i use datacombo and what i should i do to solve this issue

plz i need ur help also tell me how to prepare datareport



User is offlineProfile CardPM
+Quote Post

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

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