panyero2003 0 Newbie Poster

I am a newbie in Visual Basic. I have a database inventory and table products. The field for products table are productcode, productname and quantity. I want to search the product through product code using text box and the result will be display in the textbox for the productname and quantity. I have already connected to the database but the output seems that it did not search for a particular records . Take a look at my codes;

This code take effect when the txtprodcode_change event

if txtprodcode.Text <> 0 then

Set rsProducts = db.Recordset("Select * from products where productcode = '" & txtprodcode.Text & "'")

if rsProducts.Recordcount <> 0 then

txtprodcode.Text = rsProducts.Fields!productcode
txtprodname.Text = rsProducts.Fields!productname
txtqty.Text = rsProducts.Fields!quantity

else

txtprodcode.Text = ""
txtprodname.Text = ""
txtqty.Text= ""

end if

end if

There is no problem with the connection only the data does not retrieve the real records.

Please help......

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.