You are on page 1of 7

c  


                 
   

Summary:

!  "  #        $


 $   
c   
%         
 &           

  $ 

 ! !          
$      $ 
   &'    
      

  
  $
  (    #     !   
     
  &  
!   $      

  $ 

!          
     &

)          $ —  


  #   
  
$ 
   
!     *     
$     

 #  #         
$ 
#$ 
  

 
#$ 


   
$   &     
 
     $       !    &

r  Maintain Studnts Window

                    &
      
        $ 
   &  
  $ 
      $     # &       

 $ 
 $  +

,&?     


  $      * #-  V  
   V     $ 
 $ 
  &  $ 

  

 &,$       $ 
#    !   
  +


     



c   
                 
   



&       !  !  $        
 &  —         !    
 &

,,&?  ¯     $ $ 
         $ 
/   
&, 
 #  *    
               $
    / $
 
 
$  
 
  $   &
          +

SET DELETED ON && Hide/Ignore deleted records

,,,&?  Ý          $ 


 &,   
 $   +

THISFORM.Release && Close this window

,&?                   


     &,      !  
   $ +


à Save the record


LOCAL lFileInUse As Logical

IF USED("Students")

     .



c   
                 
   

lFileInUse = .t.
ELSE
USE Students IN 0
lFileInUse = .f.
ENDIF

SELECT Students
GO TOP
LOCATE FOR ALLTRIM(Students.StudentID) =
ALLTRIM(THISFORM.cmbStudentID.Text)
IF NOT FOUND()
APPEND BLANK
REPLACE Students.StudentID WITH THISFORM.cmbStudentID.Text
ENDIF
REPLACE Students.FirstName WITH THISFORM.txtFirstName.Value
REPLACE Students.MiddleName WITH THISFORM.txtMiddleName.Value
REPLACE Students.LastName WITH THISFORM.txtLastName.Value
REPLACE Students.CurrentBal WITH THISFORM.txtCurrentBal.Value

IF NOT lFileInUse
USE IN Students
ENDIF

THISFORM.cmdNew.Click && Present user with a blank new record


template

&?  h             $
       &,
       
   $ +


à Delete the RecorD


LOCAL cMsg As Logical,nAnswer As Integer,lFileInUse As Logical

IF ISBLANK(THISFORM.cmbStudentID.Text)
RETURN
ENDIF

cMsg = "Do you really want to DELETED(Y/N)?"


nAnswer = MESSAGEBOX(cMsg,4+32,"Maintain Students")
IF nAnswer = 7 && User chose no
RETURN
ENDIF

IF USED("Students")
lFileInUse = .T.
ELSE
USE Students IN 0
lFileInUse = .F.
ENDIF
SELECT Students
GO TOP
LOCATE FOR ALLTRIM(Students.StudentID) =
ALLTRIM(THISFORM.cmbStudentID.Text)
IF FOUND()
DELETE

     0



c   
                 
   

ENDIF
THISFORM.cmdNew.Click
cMsg = "Student successfully deleted!"
MESSAGEBOX(cMsg,64,"Maintain Students")


,&?       $ 
 ¯ 
              
  !    $       &     
     $ +


à If the currently entered student ID exists, display the record for


editing,
à else if it does not, it means the user wants to create a new record
with this ID
LOCAL lFileInUse

IF ISBLANK(THIS.Text) && The User entered nothing in the Combo Box


RETURN
ENDIF

à Open the able


IF USED("Students")
lFileInUse = .T.
ELSE
USE Students IN 0
lFileInUse = .F.
ENDIF
SELECT Students
GO TOP
LOCATE FOR ALLTRIM(Students.StudentID) = ALLTRIM(THIS.Text)
IF NOT FOUND()
à This is an ID for a new student record that does not exist
RETURN
ENDIF

à Display the record for editing


THISFORM.txtFirstName.Value = Students.FirstName
THISFORM.txtMiddleName.Value = Students.MiddleName
THISFORM.txtLastName.Value = Students.LastName
THISFORM.txtCurrentBal.Value = Students.CurrentBal
THISFORM.txtLastPmtDat.Value = Students.LastPmtDat

,,&?        !  
  &   
   
   
$ 
$          &      !
  $      ! !  $ +


THISFORM.cmbStudentID.Value = ""
THISFORM.txtFirstName.Value = ""
THISFORM.txtMiddleName.Value = ""
THISFORM.txtLastName.Value = ""
THISFORM.txtCurrentBal.Value = 0

     1



c   
                 
   

THISFORM.txtLastPmtDat.Value = ({ / / })
THISFORM.cmbStudentID.SetFocus

      
   !   $     
 !  
  $       #     
         &
,,,&?  —      
 $  
$   
 &      
   —  $ 
     $ 
     
      &,$ —   
     !    ! 
 #   
   
      $ 
   $     
   —   
    
   $
   
  &,$        #   
 
    
  $ 
  $       &       !  ! 
 +


LOCAL cMsg as Character,nAnswer AS Integer


nAnswer = 0

IF ISBLANK(THISFORM.cmbStudentID.Text) THEN
cMsg = "You have not displayed a student record to print letter
for." + CHR(13)
cMsg = cMsg + "do you wish to send a letter notice to all
students(Y/N)?"
nAnswer = MESSAGEBOX(cMsg,4,"Generate Letter")
IF nAnswer = MBNO THEN
RETURN
ENDIF
cMsg = "ALL"
ELSE
cMsg = "StudentID = '" + THISFORM.cmbStudentID.Text + "'"
ENDIF

à Proceed

DO FORM frmMgLettTypes WITH "Students",cMsg


     $         &    
  !     
  ,$    !&,$ #   

    $
 
          $        
&$   !# 
       ,    $ 
—   
 # 
   
! $                  &

3 —    #          $
   
             
       —      &

     2



c   
                 
   

¬ow to Us:



       #   *      
c   V    
V   #     *  
       * &5    —   
  
 * &  
 
  * 
    $
 h hhÝhhh 
 $ 
 
  *  &         6    
 
$ 
      
6 $ &


       !#       
      
              
  
  
 $ 
      
 &

        $       #    $ 
 $    +

&? ˜    , $    


 ¯ 
  &   
      &



&.            &    
 7%   #   
   
        $  
         &

.&? ˜ -  —  
       !    

       $     


      #    
  $ 
 $  +

&?    —   
        !   
        !  
  &        ! ! 
 0&

     4



c   
                 
   


0&,$       ! $    !  7%   #   



 
       $ 
   $         &

.&? ˜   —   &'       !#   
  

   $
         7  $     &      
  ! !    1



 1&   
  
 $  $
         
 $ 
  $       &- 5 $     &

0&? -     &

Ýonclusion

           c   


%        #  
    $    $  
 &'          
    $ 
  $     
      

      

   $$      $ 


  
         &

     8