Hi All,
This is the code snippet
Code:
Sub txtCustomer_LostFocus
'Using tblProducts to hold temporary Data
txt=txtCustomer.Text
command.CommandText="SELECT [Customer Code], [Customer], [Address] FROM [Custs] WHERE [Customer Code] LIKE '%" & txt &"%'"
Command.ExecuteTable("tblProducts",0)
'Now load the table values into the label control
txtCustName.Text=tblProducts.Cell("Customer", 0)
txtCustAddress.Text=tblProducts.Cell("Address", 0)
CustCode=tblProducts.Cell("Customer Code", 0)
'Set the combo Control To correct Code
For i = 0 To cboCust.Count-1
If cboCust.Item (i) = CustCode Then
cboCust.SelectedIndex=i
Exit
End If
Next
btnAccept.Enabled=True
End Sub
When i type in any letter up to trea the code works but if i type in the next letter which is s as in treas then the code does not work
So if i type in t i get 'treasure'
also any other letter in the word up to and including a gives me the same correct result. But when i type in the s the code gives me this error
an error occured on sub main txtCustomer_LostFocus
line no 229
txtCustName.Text=tblProducts.Cell("Customer", 0)
error description:
Index 0 is either negative or above rows count.
What is causing this error?
thanks