Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help with seek on a cursor 1

Status
Not open for further replies.

johncook

Programmer
Nov 24, 2002
154
0
0
US
I have a cursor that I have created and added a bunch of records to (lcincoming).

After adding the data to the cursor I do the following:

SELECT lcincoming
INDEX ON cbinum TAG cbinum
SET ORDER TO tag cbinum

Then I attempt a seek on the cursor:

SELECT lcincoming
SET ORDER TO tag cbinum
lfound=SEEK(lc_cbinum_to_find)

I know the record is there. I am looking at it. Yet the seek returns False everytime. What am I doing wrong?

Thanks,
John
 
John,

Two thing worth checking:

- Is the item that you are searching the same case as the data in the cursor? When indexing on character fields, I generally use UPPER() to force the case. On the other hand, I see your index field is called cbinum, so maybe it's not a character field.

- Are there any trailing blanks at the end of the string that you are searching? If you pick up your search term from a textbox, it will probably have trailing blanks. Try setting EXACT off, and searching on ALLTRIM(lc_cbinum_to_find) (again, assuming it is a character field).

Mike


Mike Lewis
Edinburgh, Scotland
 
try this:

lfound=SEEK(lc_cbinum_to_find,'lcincoming','cbinum')

and your are sure about the correct table & index

Andreas
 
Thanks, I was really unsure if SEEK worked on a cursor as the VFP help somewhat says it does not. Just by telling me that I may be doing the seek incorrectly told me that you guys knew it IS possible to SEEK on a cursor.

Anyway, you were also correct on what I was doing wrong. I trimmed the seek value and it works perfectly. Ya learn something new everyday and this will be useful many times.

Thanks again,
John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top