Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Brad Schulz
  Where is Brad Schulz?
 San Carlos
 California - United States
 Brad Schulz
  Where is FRED QUAYE?
Subject: RE: Seek Function behaving strangely
Thread ID: 104663 Message ID: 104665 # Views: 1 # Ratings: 1
Version: Visual FoxPro 6 Category: Errors & Debugging
Date: Friday, August 18, 2006 8:26:18 PM         

> This is really strange. I have a text box , with recordsoure = None.
> If a user inputs data there is a routine which checks as to whether that
> code exists. Surely to check for duplicates, however the search results for duplicates is just not working.
> The search routine I've placed in the lostfocus of the text box
> Use result order res_code
> seek alltrim(thisform.text1.value)
if found()

> Message ............duplicate record found


> If I put in a duplicate, it just ignores the test routine in the text b
> ox.
> Wkat I'm I doing wrong? This is a very simple search, so I'm even amazed
> at the outcome

The first thing that comes to mind is that you may have SET EXACT set to ON. If your RES_CODE is 10 characters long and you're SEEKing with an ALLTRIM(), then you are most likely SEEKing with a string that is LESS than 10 characters, and with SET EXACT ON, the SEEK will not be successful.

Either SET EXACT OFF or else do a SEEK PADR(ALLTRIM(THISFORM.Text1.Value),LEN(Res_Code)) or something similar to make sure your SEEK string is the same size as the Res_Code.

I would also suggest putting your code into the Valid() as opposed to the LostFocus().



Seek Function behaving strangely Posted by FRED QUAYE @ 8/18/2006 8:16:34 PM
RE: Seek Function behaving strangely Posted by Borislav Borissov @ 8/18/2006 8:19:51 PM
RE: Seek Function behaving strangely Posted by Brad Schulz @ 8/18/2006 8:26:18 PM
RE: Seek Function behaving strangely Posted by Ken Murphy @ 8/18/2006 8:57:07 PM