home *** CD-ROM | disk | FTP | other *** search
- * Viewedit.prg allows viewing and editing of records in
- * Customer.dbf
-
- * Select database Customer with index Lastname
- SELECT Customer
- SET INDEX TO Lastname, Custno, Ziplist
-
- * Begin main control loop
- STORE .T. TO more
- DO WHILE more
- CLEAR
- @ 3,0 SAY CENTER("VIEW/EDIT CUSTOMER RECORDS")
-
- * Do until a record that exists is specified
- STORE .T. TO badinput
- DO WHILE badinput
-
- * Get last name or company of customer
- STORE SPACE(25) TO findcust
- @ 11,5 SAY "Enter customer's last name or company: ";
- GET findcust
- READ
-
- * Search for a last name that is the same as findcust
- SEEK UPPER(findcust)
-
- * If indexed search not successful, do sequential search for
- * Company = findcust
- IF .NOT. FOUND()
- LOCATE FOR Company = findcust
-
- * If both searches are unsuccessful, inform user
- IF .NOT. FOUND()
- STORE " " TO again
- @ 13,5 SAY "No such record found. Try again? "+;
- "(Y/N): " GET again PICTURE "!"
- READ
-
- * If user does not want to try again, reset loop
- * conditions to exit program
- IF again = "N"
- STORE .F. TO badinput, more
- ENDIF
-
- * If sequential search successful, reset badinput to
- * exit this loop
- ELSE
- STORE .F. TO badinput
- ENDIF
-
- * If indexed search successful, reset badinput to exit this
- * loop
- ELSE
- STORE .F. to badinput
- ENDIF
-
- * End of while badinput loop
- ENDDO
-
- * If more is still true, then continue; more is only set to
- * false if both searches are unsuccessful
- IF more
-
- * Store contents of current record to automem memory
- * variables
- STORE AUTOMEM
-
- * Display record using format Custform
- SET FORMAT TO Custform
- READ
- CLOSE FORMAT
-
- * Save any changes made to record
- REPLACE AUTOMEM
-
- * Display/edit additional records?
- STORE " " TO morerecs
- @ 22,0
- @ 22,5 SAY "Edit/View additional records? (Y/N): ";
- GET morerecs PICTURE "!"
- READ
- IF morerecs = "N"
- STORE .F. TO more
- ENDIF
- ENDIF
- ENDDO
- CLEAR AUTOMEM
- RETURN