1) I don't think use of >= in SET FILTER will work. Try something like
lnSearchLength = LEN(ALLT(m.stext))
SET FILTER TO LEFT(Agency_Name, lnSearchLength) = ALLT(m.sText)
2) Remove the RecordSource from the list and set it back after search is complete.
3) Is there any code in GotFocus()?
>I have a search form in VFP 6.0. The form has a textbox to enter search criteria, a listbox to show search results, and a search button.
>
>My search form looks up the correct record, but I have a couple of weird things I can't seem to clear up.
>
>1)I enter the beginning first few letters of my search into a textbox with ControlSource of m.stext, but sometimes search returns a list in my listbox of anything matching the first letter, not matching the first and second letter?
>
>2)I enter the beginning first few letters of my search into a textbox with ControlSource of m.stext, but after I press Search button and go back to the textbox and re-enter another couple of letters and press Search button to further refine the searched list, the listbox turns gray and blank, until I click on the listbox and then the searched list items appear in the listbox?
>
>3)How come in my search textbox where I enter my letters to search on... the text is not selected even though in Property Format there is a !K meaning it should select the text that is in the textbox, but it does not. Or am I misunderstanding the !K?
>
>I have been playing with various settings and commands for awhile and making no headway. Thanks for the help.
>
>Here is my code in my Search Button on my search form:
>
>SELECT agency
>SET FILTER TO
>IF THISFORM.Stype.Value = 1
> SET ORDER TO agcy_name
> SET FILTER TO agency.agcy_name => ALLT(m.stext)
>ENDIF
>IF THISFORM.Stype.Value = 2
> SET ORDER TO agency
> SET FILTER TO agency.agency => ALLT(m.stext)
>ENDIF
>
>IF EOF()
> GO TOP
>ENDIF
>
>CREATE CURSOR agenc;
> (agcy_name C(50), agency C(2), code C(2), street C(40), city C(25), ;
> zip C(12), phone C(20), fax C(20))
>
>REC_CNT=0
>select agenc
>set safety off
>zap
>set safety on
>
>SELECT agency
>SCAN
> SELECT agenc
> APPEND BLANK
> REPLACE agenc.agcy_name WITH ALLT(agency.agcy_name)
> REPLACE agenc.agency WITH agency.agency
> REPLACE agenc.code WITH agency.code
> REPLACE agenc.street WITH ALLTR(agency.street)
> REPLACE agenc.city WITH ALLT(agency.city)
> REPLACE agenc.zip WITH ALLT(agency.zip)
> REPLACE agenc.phone WITH ALLT(agency.phone)
> REPLACE agenc.fax WITH ALLT(agency.fax)
> REC_CNT = REC_CNT+1
> SELECT agency
>ENDSCAN
>IF REC_CNT=0
> SELECT agenc
> APPEND BLANK
> WAIT "NO RECORDS FOUND!!!" WINDOW
>ENDIF
>SELECT agency
>GO TOP
>*THISFORM.Load_list
>*THISFORM.Refresh
>THISFORM.Stext.SetFocus
>
- Jayesh