'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
Dim a As AddressRecord
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
address As AddressRecord
class(9) As Course
idNumber As String * 5
End Type
Dim s As Student
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
txtid.Text = s.idNumber
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
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