nil RecordSet test for record not found

sSQL = "SELECT * FROM Contacts WHERE ContactID = '" + sContactID + "'" rsTemp = dbSQL.SQLSelect(sSQL) if rsTemp <> Nil then MsgBox("The ContactID supplied is in use, select a different ContactID") tfContactID.SetFocus Return end if

I have the above code in the LostFocus event of the a TextField for ContactID which must be unique and between 4 and 12 characters. I am testing the code and putting a value of “TEST” in the ContactID field. There is NO record in the table with a value of “TEST” in ContactID. Yet rsTemp is NOT nil but has a row with nil in all fields. So it didn’t find a row but it still isn’t nil. what am I doing wrong?

thanks,
b

Test for rsTemp.EOF. It will be true in the case you describe.

Recordset not nil simply means there were no errors in your sql. It tells you nothing about whether there was any data returned. Use EOF, as Peter suggests.