All pastes #11356 Raw Edit

Anonymous

public text v1 · immutable
#11356 ·published 2005-05-09 21:26 UTC
rendered paste body
'JEARVON DHARRIE
'Database Project
'   1.Design a student record
'   2.Design a data entry from
'   3.Write "save" code
'   4.Write "load" code
'   5.Design report card form and write "print" code
'   6.Sub Function to compute year to date grades
'   7.Sub Function to compute GPA

'REQUIREMENTS'''''''''''''''''''''''''''''''
'Year to date grade automatically updates.
'If you try to retreive a record without a record number entered
'   trap the error.
'GPA is the average of the 6 courses, updates automaticallly.
'5%, 10% weight on honors, AP, respectively.
'Compute class rank, compared to other people on file.
'Ease of use, enter through boxes, menu with hot keys.
'Use common dialog box.
'Save/ Save As option.
'Saving new file brings up Save As box.
'Minimum of 4 records.
'Grade report- honors/AP classes marked with stars.
''''''''''''''''''''''''''''''''''''''''''''
Dim filename As String

'Common dialog box

'''Private Type AddressRecord '62 Bytes
''    Street As String * 40
''    City As String * 15
''    State As String * 2
''    Zip As String * 5
'''End Type
''
''
''
''
'''Private Type Course '61 Bytes
''    Title As String * 20
''    credits As Single
''    courseNumber As String * 3
''    teacher As String * 20
''    kind As String * 1  'A, H, R (AP, Honors, Regular)
''    q1 As Integer
''    q2 As Integer
''    q3 As Integer
''    q4 As Integer
''    exam As Integer
''    ytd As Single
''    comment(2) As Integer
'''End Type


Private Type Student
    lastName As String * 20
    firstName As String * 20
    middleName As String * 20
    age As Integer
    gender As String * 1
    grade As Integer
    rank As Integer
    gpa As Single
    homeroom As String * 4
    hrTeacher As String * 20
    counselor As String * 20
    absent As Single
    tardy As Integer
    
  '  class(9) As Course
    idNumber As String * 5
    Title As String * 20
    credits As Single
    courseNumber As String * 3
    teacher As String * 20
    kind As String * 1  'A, H, R (AP, Honors, Regular)
    q1 As Integer
    q2 As Integer
    q3 As Integer
    q4 As Integer
    exam As Integer
    ytd As Single
    comment(2) As Integer
    Street As String * 40
    City As String * 15
    State As String * 2
    Zip As String * 5
End Type
Dim s As Student





Private Sub calsstype_Change(Index As Integer)

End Sub

Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtstreet.SetFocus
End If
End Sub

Private Sub Combo2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtzip.SetFocus
End If
End Sub



Private Sub mnuExit_Click()
Unload Me
End Sub

Private Sub mnuOpen_Click()
DIALOGS.ShowOpen
Open DIALOGS.filename For Random As #1 Len = Len(s)
s.idNumber = Val(txtid)
Get #1, s.idNumber, s
txtlast.Text = s.lastName
Txtfirst.Text = s.firstName
txtmiddle.Text = s.middleName
txtage = s.age
Combo1 = s.gender
'Combo2 = s.State
txtcity.Text = s.City
txtid.Text = s.idNumber
txtstreet.Text = s.Street
txtcounselor.Text = s.counselor
txthomeroomeacher.Text = s.hrTeacher
txthomeroom = s.homeroom
txtzip.Text = s.Zip
txtgrade(9).Text = s.grade
txtrank.Text = s.rank
 For Index = 0 To 5
 txtTeacher(Index).Text = s.teacher
 Next Index
 For Index = 0 To 5
 txtClass(Index) = s.teacher
 Next Index
 For Index = 0 To 5
 combotype(Index) = s.kind
 Next Index
Close #1

End Sub

Private Sub mnusa_Click()
DIALOGS.ShowSave
Open DIALOGS.filename For Random As #1 Len = Len(s)
s.lastName = txtlast
s.idNumber = txtid
s.middleName = txtmiddle.Text
s.age = txtage

Put #1, s.idNumber, s
Close #1

End Sub

Private Sub mnusave_Click()


If filename = "" Then
  DIALOGS.ShowSave
  filename = DIALOGS.filename
 End If
Open DIALOGS.filename For Random As #1 Len = Len(s)
s.lastName = txtlast
s.idNumber = txtid
s.middleName = txtmiddle.Text
s.firstName = Txtfirst
s.age = Val(txtage)
s.gender = Combo1
s.State = Combo2.DataField
s.City = txtcity.Text
s.Street = txtstreet.Text
s.Zip = txtzip.Text
s.counselor = txtcounselor.Text
s.hrTeacher = txthomeroomeacher.Text
s.grade = txtgrade(9)
s.rank = txtrank
s.homeroom = txthomeroom
For Index = 0 To 5
s.teacher = txtTeacher(Index)
Next Index
For Index = 0 To 5
s.Title = txtcalss(Index)
Next Index
For Index = 0 To 5
s.kind = combotype(Index)
Next Index
For Index = 0 To 4
s.q1 = txtquarter1(Index)
Next Index



















Put #1, s.idNumber, s
Close #1



End Sub







Private Sub txtage_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Combo1.SetFocus
End If

End Sub

Private Sub txtcity_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Combo2.SetFocus
End If
End Sub

Private Sub Txtfirst_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtmiddle.SetFocus
End If

End Sub

Private Sub txtlast_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtage.SetFocus
End If
End Sub

Private Sub txtmiddle_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtlast.SetFocus
End If
End Sub

Private Sub txtstreet_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtcity.SetFocus
End If
End Sub