>Using VFP 5.0 I've got a form populated with various fields from a table. In a text box at the bottom of the form users can enter a part number (or partial part number) that needs to be located int he table. The table is indexed on the field being searched. Here is my code:
>
>If Thisform.opgSearchType.optPartNumb.Value = 1 Then
> LOCATE for Thisform.txtFind.Value $ fullpric.catno
> Thisform.Refresh()
>Endif
>
>1) Why does my LOCATE command not find the the catno being searched for?
LOCATE works in the context of the currently selected work area, although you can test a field of another table where a SET RELATION is in effect. If you're in a different table. If the field is in another table, and the record in the other table doesn't automatically move when the current table record changes, the LOCATE will see the same value each time, and fail.
SELECT fullpric before issuing the LOCATE might help...
>2) Will Thisform.Refresh() refresh my form to move the record pointer to recno()?
Unless you've added code to move the record pointer, it should just update the display values for controls from the current source; if you moved to a different record and a control refers to a field of the table that moved, the new value will be displayed.
>
>Sorry for the simplicity of this question, but I only use VFP a couple of times a year.
>
>TIA