Microsoft KB Archive/100564

{|
 * width="100%"|

-

The information in this article applies to:


 * Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, 2.5a
 * Microsoft FoxPro for Windows, versions 2.5, 2.5a

-

SYMPTOMS
You can create a customized search screen by creating a quick screen with an End Search Screen push button, as illustrated in the example below.

MORE INFORMATION
This example uses the CUSTOMER database located in the FoxPro TUTORIAL subdirectory and assumes that the database is indexed on and the order is set to the CNO field in the CUSTOMER database. In this screen, once a CNO number (customer number) is entered, the database will be searched for the corresponding record(s). The information in the record will be displayed, and you can press a key to move to the next record that has the same CNO number, if it exists. To quit, choose the End Search Screen button.

To create this customized search screen, do the following:

 Create a quick screen. Select the Use Memory Variables check box on the first screen. Choose OK. Create a push button that says "End Search Screen". Be sure that the variable you assign it doesn't match a field name.  In the VALID clause of the End Search Screen push button, input the following procedure:       CLEAR READ     && Terminate Screen  Double-click each field except the CNO field and select the Say and Refresh options. This enables all the fields to be displayed, but only the CNO field that is used to enter the customer number that will be searched for in the database may be edited.  In the VALID clause of the M.CNO field, input the following procedure:       SEEK ALLTRIM(m.cno)  && Find first CNO in the database equal to                           && M.CNO.

*****IS THERE A RECORD WITH THIS CNO IN THE DATABASE? IF FOUND          && If a record with the CNO exists, SCATTER MEMVAR    && read record into memory variables and SHOW GETS         && refresh the SAY fields that use the && memory variables. WAIT WINDOW 'PRESS TO SEE NEXT RECORD.'

*****CODE TO DEAL WITH MULTIPLE RECORDS WITH SAME CNO *****NUMBER SKIP 1                  && Skip to the next record. oldcno=m.cno SCATTER MEMVAR          && Get the new M.CNO. DO WHILE oldcno = m.cno && Is the next record's CNO equal to                                 && the previous? SHOW GETS             && Refresh the SAY fields with new && information. WAIT WINDOW 'PRESS RETURN FOR NEXT RECORD.' SKIP 1                && Go to the next record and repeat && same process until there are no                                && more records with the CNO number. oldcno=m.cno SCATTER MEMVAR ENDDO m.cno=oldcno            && Only show the old CNO number. WAIT WINDOW 'NO MORE RECORDS FOUND WITH CNO:'+oldcno *****END OF CODE THAT IS NEEDED FOR MULTIPLE RECORDS*****

RETURN               && Return control to screen and don't                              && execute the code below. ENDIF

*****IF THE RECORD WAS NOT FOUND, *****BLANK THE MEMORY VARIABLES OUT AND DISPLAY NOTHING. SCATTER MEMVAR BLANK SHOW GETS WAIT WINDOW 'THE SPECIFIED CNO WAS NOT FOUND.' </li> From the Screen menu, choose Layout (in FoxPro for MS-DOS, choose Screen Layout).</li>  In FoxPro for Windows, choose the Screen Setup Code button. In FoxPro for MS-DOS, select the Setup check box. In the setup code for the screen, type the following:  <pre class="CODESAMP">     SCATTER MEMVAR BLANK </li></ol>

Additional query words: FoxWin FoxDos 2.x screen search locate function

Keywords         : kbcode FxenvMemory Version          : 2.00 2.50 2.50a | 2.50 2.50a Platform         : MS-DOS WINDOWS Issue type       :
 * }