Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : CANS_101.ZIP
Filename : UPDATE.PRG

 
Output of file : UPDATE.PRG contained in archive : CANS_101.ZIP

*-----------------------------------------------------------
*
* System Name: Beer Cans Inventory System
*
* Program Name: UPDATE.PRG
*
* Programmer: Eric L. Poole
* Date: 19 February 1988
*
* Purpose: Allows user to change (edit) or delete
* existing records in the data base. When
* finished editing, the user is asked if
* the data base should be PACKed to remove
* all deleted records.
*
*-----------------------------------------------------------

* --------- Initialize.

set index to browse.ndx
set status on
set color to w+/ ,gr+/ ,b
clear

* ---------- Display title screen.

set color to bg+/gr
@ 8,20 to 12,56 double
set color to w+/b

@ 9,21 say " "
@ 10,21 say " EDIT/DELETE RECORDS IN DATABASE "
@ 11,21 say " "

set color to w+/
@ 18,1 say " "
wait " Press any key to begin ....."

* ---------- Choose record to edit.

do while .t.
set color to w+/b
clear
set color to gr/
@13,17 to 17,64 double
set color to bg+
@14,18 say " Enter Unique Character String "
@15,18 say " Beginning with Left Side of Brand Name "
@16,18 say " and Press "
set color to rb+/
@16,45 say chr(17)+chr(217)+" "

set color to w+/b
@3,1 say " "
accept " Which Brand Name would you like to edit? " to choice

* ---------- Check to see if record exists.

seek upper("&choice")

do case

* ---------- If choice found, edit.

case found()
set menu on
edit
clear

* ---------- Otherwise, error message, allow to try again.

case .not. found()
set color to r+/
?
? "ERROR - Brand Name string not found."
?
set color to w+/b
wait
clear

endcase

* ---------- Check to see if there is another record to be edited.

accept "Would you like to edit another record (Y/n)? " to again

if upper(again) = "N"

* ---------- Pack the file?

?
accept "Do you want to pack the file (y/N)? " to pack
?
if upper(pack) = "Y"

* ---------- Pack it.

? "Packing file, please wait ..."
?
set talk on
pack
set talk off
endif

* ---------- Set Index off and return to Main Menu.

set index to
set status off
return

endif ("N" = upper(again))

enddo (while .t.)