how can i determine that may text1.text is equal to my product code?? heres my code
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Administrator\Desktop\Inventory System\PharmacyInventory.mdb;Jet OLEDB:System Database=system.mdw;", "admin", ""
Set rs = New ADODB.Recordset
rs.Open "Select * from Product", cn, adOpenKeyset, adLockPessimistic
If rs.Fields!pcode = Text1.Text Then
MsgBox "The Product Code is Already Exist!", vbCritical
Exit Sub
Else
Dim s
s = "INSERT INTO Product (pcode, brandname, genericname, price, pstock) VALUES ('" + Text1.Text + "','" + Text2.Text + "','" + Text3.Text + "','" + Text4.Text + "','" + Text5.Text + "')"
cn.Execute s, adExecuteNoRecords
MsgBox "Product Successfully Added", vbInformation
Call Form_Load
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End If