[RESOLVED] Record doesnt show what it should be
Hi all
My table (Access2k) contain records as this:
TABLE Product:
234
A11
ASW
ASWW
AWS
TABLE Stock:
234
A11
ASW
ASWW
In a form code I make like this:
VB Code:
Private Sub txtProductID_LostFocus()
Dim msql As String
If txtProductID.Text <> "" Then
con_Data.BeginTrans
'Find product id from stock table
msql = "select * from stock " & _
" where productid='" & txtProductID.Text & "'"
Set Rs = con_Data.Execute(msql)
'if product id found
If Not Rs.EOF Then
'Display all fields
txtProductName.Text = Rs.Fields("productname")
txtUnit.Text = Rs.Fields("unit")
mseOpeningStock.Text = Rs.Fields("openingstock")
mseQuantity.Text = Rs.Fields("quantity")
txtProductID.Enabled = False
txtProductName.Enabled = False
txtUnit.Enabled = False
mseQuantity.Enabled = False
mseOpeningStock.Enabled = False
cmdAdd.Enabled = True
cmdDelete.Enabled = True
cmdEdit.Enabled = True
Else
'find product id from product table
msql = "select * from product " & _
" where productid='" & txtProductID.Text & "'"
Set Rs1 = con_Data.Execute(msql)
'if product id found
If Not Rs1.EOF Then
'Display fileds
txtProductName.Text = Rs1.Fields("productname")
txtUnit.Text = Rs1.Fields("unit")
txtProductID.Enabled = False
txtProductName.Enabled = False
txtUnit.Enabled = False
mseOpeningStock.Enabled = True
cmdCancel.Enabled = True
mseOpeningStock.SetFocus
End If
Rs1.Close
End If
Rs.Close
con_Data.CommitTrans
End If
End Sub
my problem is:
When I type "AWS" in txtProductID it show "ASWW" and populate this record in textbox, and when I type "ASWW" or "ASW" or "234" or "A11" in txtProductID it work fine
I really appreciate if anyone can advice on my coding above.
thanks and "HAPPY NEW YEAR TO ALL"
Re: RECORDS DOESNT SHOW WHAT IT SHOULD help
Check your table, you may have incorrect info for product name hence the confusion.
Re: Record doesnt show what it should be
Hi leinad31
there is nothing wrong with product name, because when I delete "ASW" and "ASWW" on both table then retrieve "AWS" it work fine.
thanks for quick replay
Re: Record doesnt show what it should be
yeah maybe, beter to check it first thanks lienad
happy new year 2007
Re: Record doesnt show what it should be
Yeah leinad
It is the product name problem
appreciate and thanks