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

Doubt in vb 6.0

P: 31
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)(This sup id should come from supplier table)
5.ItemNo varchar(10)(This 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)
Descrption varchar(20)
Supid int
Purprice float
SalPrice float
QtyIn int
QtySold int

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,price 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.Click event
dim a as integer, dim n as string
a = 0
n = Val(txtItem1.Text)
Do While Not adoproduct.Recordset.EOF
'Do While Not EOF
'If adosupplier.Recordset.Fields("SupId") = Val(n) Then
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
If a = 0 Then
MsgBox "Item No Mismatch"
End If

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(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 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
Apr 15 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

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