INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 39 Chapter V: Conclusion and Recommendation
Code
Splash Option Explicit
Private Sub Form_KeyPress(KeyAscii As Integer) frmLogin.txtUser.SetFocus
End Sub
Private Sub Timer1_Timer()
pbLoader.Value = pbLoader.Value + 1
Private Sub cmdClose_Click()
If MsgBox("Are you sure you want to Close?", vbQuestion + vbYesNo, "Close") = vbYes Then End
End If End Sub
Private Sub cmdOK_Click() Static try As Integer
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 40 Chapter V: Conclusion and Recommendation
Set con = New ADODB.Connection Set rs = New ADODB.Recordset Call connect
rs.Open "select * from tbluser where username = '" & Replace(Trim(txtUser.Text), "'", "") & "' and password = '" &
Replace(Trim(txtPass.Text), "'", "") & "'", conn, adOpenStatic, adLockReadOnly If rs.EOF Then
MsgBox "Invalid Username or Password! " & (2 - try) & " Try remaining", vbExclamation, "LNHS"
txtUser.Text = ""
txtPass.Text = ""
txtUser.SetFocus try = try + 1 If try = 3 Then
MsgBox "You have reached the maximum trial for Logging in!", vbInformation, "Program Shutting Down"
End End If Else
MsgBox "Welcome " & rs.Fields("username") & " to Computerized Grading System of LNHS", vbInformation,
"LNHS"
frmMain.StatusBar1.Panels(2).Text = rs.Fields("username") If rs.Fields("Type").Value = "User" Then
'Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer) 'Dim a As Integer
'a = MsgBox("Are you sure you want to exit?", vbQuestion + vbOKCancel, "LNHS Computerized Grading System") ' If a = vbOK Then
Private Sub mnuclassrec1_Click() frmClassRec.Show vbModal, frmMain End Sub
Private Sub mnuclassrec2_Click()
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 41 Chapter V: Conclusion and Recommendation
frmChooseSubj.Label2.Caption = 1 frmChooseSubj.Show vbModal, frmMain End Sub
Private Sub mnucompute_Click() frmgrade.Show
End Sub
Private Sub mnudeveloper_Click() frmDeveloper.Show vbModal, frmMain End Sub
Private Sub mnuexit_Click()
If MsgBox("Are You Sure You Want to Exit?", vbQuestion + vbYesNo, "Exit") = vbYes Then Unload Me
End If End Sub
Private Sub mnugradingsheet_Click() frmChooseSubj.Show
frmChooseSubj.Label2.Caption = 2 End Sub
Private Sub mnuGS_Click()
frmChooseGS.Show vbModal, frmMain End Sub
Private Sub mnuindividualgrade_Click() frmgrade.Show
End Sub
Private Sub mnulistsubj_Click() frmChooseYL.Show vbModal, frmMain End Sub
Private Sub mnulogout_Click()
If MsgBox("Are You Sure You Want to Logout?", vbQuestion + vbYesNo, "Logout") = vbYes Then Unload Me
frmLogin.Show End If
End Sub
Private Sub mnuranking_Click() frmRank.Show vbModal, frmMain End Sub
Private Sub mnusection_Click()
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 42 Chapter V: Conclusion and Recommendation
frmSection.Show End Sub
Private Sub mnustudent_Click() frmStudent.Show vbModal, frmMain End Sub
Private Sub mnusubject_Click() frmSubject.Show vbModal, frmMain End Sub
Private Sub mnusystem_Click() frmSystem.Show
End Sub
Private Sub mnuuseracc_Click() frmUserAcc.Show vbModal, frmMain End Sub
Private Sub mnuyearlevel_Click() frmYearLevel.Show
End Sub Student
Dim temocode As Integer Private Sub cmbreligion_Click() t9.Text = cmbreligion.Text End Sub
Private Sub cmdAdd_Click()
Adodc1.RecordSource = "SELECT * FROM tblstudent order by studentno"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then tempcode = 1
Else
Adodc1.Recordset.MoveLast
tempcode = Val(Adodc1.Recordset(0)) + 1 End If
Adodc1.Recordset.AddNew ENA
t1.Text = Format(tempcode, "0") t2.SetFocus
End Sub
Private Sub cmdCancel_Click()
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 43 Chapter V: Conclusion and Recommendation
If MsgBox("Are You Sure You Want to Cancel?", vbQuestion + vbYesNo, "Cancel") = vbYes Then Adodc1.Recordset.CancelBatch
Adodc1.Refresh dis
End If End Sub
Private Sub cmdClose_Click()
If MsgBox("Are You Sure You Want to Close?", vbQuestion + vbYesNo, "Close") = vbYes Then Unload Me
End If End Sub
Private Sub cmdDel_Click()
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "No Record to Delete.", vbInformation, "Delete"
Else
If MsgBox("Are You Sure you Want to Delete", vbQuestion + vbYesNo, "Delete") = vbYes Then Adodc1.Recordset.Delete
Private Sub cmdEdit_Click()
If Adodc1.Recordset.RecordCount = 0 Then MsgBox "No Record to Edit.", vbInformation, "Edit"
Else ENA t1.SetFocus End If End Sub
Private Sub cmdFirst_Click()
If Adodc1.Recordset.RecordCount <> 0 Then Adodc1.Recordset.MoveFirst
End If End Sub
Private Sub cmdLast_Click()
If Adodc1.Recordset.RecordCount <> 0 Then Adodc1.Recordset.MoveLast
End If End Sub
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 44 Chapter V: Conclusion and Recommendation
Private Sub cmdNext_Click()
If Adodc1.Recordset.RecordCount = 0 Then MsgBox "No Records", vbInformation, "LNHS"
Else
Adodc1.Recordset.MoveNext If Adodc1.Recordset.EOF Then
If MsgBox("Last Record", vbInformation, "LNHS Computerized Grading System") = vbOK Then Adodc1.Recordset.MoveLast
End If End If End If End Sub
Private Sub cmdPre_Click()
If Adodc1.Recordset.RecordCount = 0 Then MsgBox "No Records", vbInformation, "LNHS"
Else
Adodc1.Recordset.MovePrevious If Adodc1.Recordset.BOF Then Adodc1.Recordset.MoveFirst
If MsgBox("First Record", vbInformation, "LNHS Computerized Grading System") = vbYes Then End If
End If End If End Sub
Private Sub cmdsave_Click()
If t1.Text = "" Or t2.Text = "" Or t3.Text = "" Or t4.Text = "" Or t5.Text = "" Or cmbSection.Text = "" Or _ DTPicker1.Value = "" Or t8.Text = "" Or t9.Text = "" Or cmbgender.Text = "" Or cmbYL.Text = "" Then MsgBox "Please Fill Out All Fields", vbInformation
Else
If MsgBox("Are You Sure You Want to Save?", vbQuestion + vbYesNo, "Save") = vbYes Then Adodc1.Recordset.Update
dis End If End If End Sub Function ENA() Frame1.Enabled = True cmdAdd.Enabled = False cmdEdit.Enabled = False cmdDel.Enabled = False cmdSave.Enabled = True cmdCancel.Enabled = True
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 45 Chapter V: Conclusion and Recommendation
cmdClose.Enabled = False End Function
Function dis()
Frame1.Enabled = False cmdAdd.Enabled = True cmdEdit.Enabled = True cmdDel.Enabled = True cmdSave.Enabled = False cmdCancel.Enabled = False cmdClose.Enabled = True End Function
Private Sub cmdSearch_Click()
Adodc2.RecordSource = "select * from tblStudent where Year_Level like '" & Combo1.Text & "' and StudentSec like '" &
Text2.Text & "' order by Lname "
Adodc2.Refresh DataGrid2.Refresh End Sub
Private Sub Command1_Click()
If Adodc2.Recordset.RecordCount = 0 Then Adodc2.Refresh
MsgBox ("No Record!") Else
With de.rsStudent
.Open de.rsCommand2_Grouping.Filter = "Year_level ='" & Combo1.Text & "' And StudentSec ='" & Text2.Text & "'"
rptStudent.Show vbModal, frmMain .Close
End With End If Unload Me End Sub
Private Sub t8_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
cmbreligion.SetFocus End If
Dim str As String str = "0123456789"
If KeyAscii > 26 Then
If InStr(str, Chr(KeyAscii)) = 0 Then KeyAscii = 0
End If End If End Sub
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 46 Chapter V: Conclusion and Recommendation
Private Sub txtdate_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
t8.SetFocus End If
Dim str As String str = "0123456789"
If KeyAscii > 26 Then
If InStr(str, Chr(KeyAscii)) = 0 Then KeyAscii = 0
End If End If End Sub Subject
Dim temocode As Integer Private Sub cmbgender_Click() t6.Text = cmbgender.Text End Sub
Private Sub cmdAdd_Click()
Adodc1.RecordSource = "select * from tblsubj order by subjno"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then tempcode = 1
Else
Adodc1.Recordset.MoveLast
tempcode = Val(Adodc1.Recordset(0)) + 1 End If
Adodc1.Recordset.AddNew ENA
t1.Text = Format(tempcode, "000") t2.SetFocus
End Sub
Private Sub cmdCancel_Click()
If MsgBox("Are You Sure You Want to Cancel?", vbQuestion + vbYesNo, "LNHS Computerized Grading System") = vbYes Then
Private Sub cmdClose_Click()
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 47 Chapter V: Conclusion and Recommendation
If MsgBox("Are You Sure You Want to Close?", vbQuestion + vbYesNo, "LNHS Computerized Grading System") = vbYes Then
Unload Me End If End Sub
Private Sub cmdDel_Click()
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "No Record to Delete.", vbInformation, "LNHS Computerized Grading System"
Else
If MsgBox("Are You Sure you Want to Delete", vbQuestion + vbYesNo, "LNHS Computerized Grading System") = vbYes Then
Private Sub cmdEdit_Click()
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "No Record to Edit.", vbInformation, "LNHS Computerized Grading System"
Else ENA t1.SetFocus End If End Sub
Private Sub cmdFirst_Click()
If Adodc1.Recordset.RecordCount <> 0 Then Adodc1.Recordset.MoveFirst
End If End Sub
Private Sub cmdLast_Click()
If Adodc1.Recordset.RecordCount <> 0 Then Adodc1.Recordset.MoveLast
End If End Sub
Private Sub cmdNext_Click()
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "No Records", vbInformation, "LNHS Computerized Grading System"
Else
Adodc1.Recordset.MoveNext
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 48 Chapter V: Conclusion and Recommendation
If Adodc1.Recordset.EOF Then
If MsgBox("Last Record", vbInformation, "LNHS Computerized Grading System") = vbOK Then Adodc1.Recordset.MoveLast
End If End If End If End Sub
Private Sub cmdPre_Click()
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "No Records", vbInformation, "LNHS Computerized Grading System"
Else
Adodc1.Recordset.MovePrevious If Adodc1.Recordset.BOF Then Adodc1.Recordset.MoveFirst
If MsgBox("First Record", vbInformation, "LNHS Computerized Grading System") = vbYes Then End If
End If End If End Sub
Private Sub cmdsave_Click()
If t1.Text = "" Or t2.Text = "" Or t3.Text = "" Or t4.Text = "" Or t5.Text = "" Or t6.Text = "" Or _ t7.Text = "" Or t8.Text = "" Or t9.Text = "" Then
MsgBox "Please Fill Out All Fields", vbInformation, "LNHS Computerized Grading System"
Else
If Val(t10.Text) = 100 Then
If MsgBox("Are You Sure You Want to Save?", vbQuestion + vbYesNo, "LNHS Computerized Grading System") = vbYes Then
Adodc1.Recordset.Update dis
End If Else
MsgBox "Total must be 100%", vbInformation, "LNHS Computerized Grading System"
End If End If End Sub Function ENA() Frame1.Enabled = True Frame2.Enabled = True cmdAdd.Enabled = False cmdEdit.Enabled = False cmdDel.Enabled = False cmdSave.Enabled = True cmdCancel.Enabled = True
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 49 Chapter V: Conclusion and Recommendation
cmdClose.Enabled = False End Function
Function dis()
Frame1.Enabled = False Frame2.Enabled = False cmdAdd.Enabled = True cmdEdit.Enabled = True cmdDel.Enabled = True cmdSave.Enabled = False cmdCancel.Enabled = False cmdClose.Enabled = True End Function
Private Sub t3_Change() COMPTOTAL
End Sub
Function COMPTOTAL()
t10.Text = Val(t3.Text) + Val(t4.Text) + Val(t5.Text) + Val(t6.Text) + Val(t7.Text) + Val(t8.Text) + Val(t9.Text) End Function
Private Sub t4_Change() COMPTOTAL
End Sub
Private Sub t5_Change() COMPTOTAL
End Sub
Private Sub t6_Change() COMPTOTAL
End Sub
Private Sub t7_Change() COMPTOTAL
End Sub
Private Sub t8_Change() COMPTOTAL
End Sub
Private Sub t9_Change() COMPTOTAL
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 50 Chapter V: Conclusion and Recommendation
End Sub User Account
Private Sub chkpas_Click() If chkpas.Value = 1 Then
Private Sub cmbLevel_Click() txtLevel.Text = cmbLevel.Text End Sub
Private Sub cmdAdd_Click() ENA
On Error Resume Next Adodc1.Recordset.AddNew txtusername.SetFocus End Sub
Private Sub cmdCancel_Click()
If MsgBox("Are you sure you want to Cancel?", vbQuestion + vbYesNo, "Cancel") = vbYes Then Adodc1.Recordset.CancelBatch
Adodc1.Refresh dis
End If End Sub
Private Sub cmdClose_Click()
If MsgBox("Are You Sure You Want to Close?", vbQuestion + vbYesNo, "Close") = vbYes Then Unload Me
End If End Sub
Private Sub cmdDelete_Click()
If MsgBox("Are You Sure you Want to Delete this Supplier from the List", vbQuestion + vbYesNo, "LNHS Computerized Grading System") = vbYes Then
Adodc1.Recordset.Fields("Deleted").Value = "YES"
Adodc1.Recordset.Update End If
dis
PosLeft = Me.Left PosTop = Me.Top
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 51 Chapter V: Conclusion and Recommendation
Unload Me Me.Show Me.Left = PosLeft Me.Top = PosTop End Sub
Private Sub cmdDel_Click()
If txtLevel.Text = "Administrator" Then
MsgBox "Sorry, Unable to Delete The Administrator Account.", vbInformation, "Delete"
Else
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "No Record to Delete.", vbInformation, "Delete"
Else
If MsgBox("Are You Sure you Want to Delete", vbQuestion + vbYesNo, "Delete") = vbYes Then Adodc1.Recordset.Delete
Private Sub cmdEdit_Click()
If Adodc1.Recordset.RecordCount = 0 Then MsgBox "No Record to Edit.", vbInformation, "Edit"
Else ENA End If End Sub
Private Sub cmdFirst_Click() Adodc1.Recordset.MoveFirst End Sub
Private Sub cmdLast_Click() Adodc1.Recordset.MoveLast End Sub
Private Sub cmdNext_Click() Adodc1.Recordset.MoveNext If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast
MsgBox "Last Record", vbInformation, "LNHS Computerized Grading System"
End If
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 52 Chapter V: Conclusion and Recommendation
End Sub
Private Sub cmdPre_Click() Adodc1.Recordset.MovePrevious If Adodc1.Recordset.BOF Then Adodc1.Recordset.MoveFirst
MsgBox "First Record", vbInformation, "LNHS Computerized Grading System"
End If End Sub
Private Sub cmdsave_Click()
If txtusername.Text = "" Or txtpassword.Text = "" Or txtLevel.Text = "" Then MsgBox "Please Fill Out All Fields", vbInformation, "Save"
Else
If MsgBox("Are You Sure You Want to Save?", vbQuestion + vbYesNo, "Save") = vbYes Then Adodc1.Recordset.Update Frame2.Enabled = True cmdAdd.Enabled = False cmdEdit.Enabled = False cmdDel.Enabled = False cmdSave.Enabled = True cmdCancel.Enabled = True cmdClose.Enabled = False End Function
Function dis()
Frame2.Enabled = False cmdAdd.Enabled = True cmdEdit.Enabled = True cmdDel.Enabled = True cmdSave.Enabled = False cmdCancel.Enabled = False cmdClose.Enabled = True End Function
Private Sub Form_Load()
Adodc1.RecordSource = "select * from tblUser"
Adodc1.Refresh dis
End Sub
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 53 Chapter V: Conclusion and Recommendation
First Grading
Private Sub cmdAdd_Click() ENA
End Sub
Private Sub cmd1_Click() frmgrade.Show
cmd1.Enabled = True cmd2.Enabled = False cmd3.Enabled = False cmd4.Enabled = False Frame1.Enabled = True Frame2.Enabled = True Frame3.Enabled = True Frame4.Enabled = True End Sub
Private Sub cmd2_Click() frmgrade2.Show Unload Me End Sub
Private Sub cmd3_Click() frmgrade3.Show Unload Me End Sub
Private Sub cmd4_Click() frmgrade4.Show Unload Me End Sub
Private Sub cmd5_Click() frmCompute.Show Unload Me End Sub
Private Sub cmd6_Click() frmComputeFG.Show Unload Me
End Sub
Private Sub cmdCancel_Click()
If MsgBox("Are You Sure You Want to Cancel?", vbQuestion + vbYesNo, "Cancel") = vbYes Then AdoGrade.Recordset.CancelBatch
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 54 Chapter V: Conclusion and Recommendation
AdoGrade.Refresh Unload Me Me.Show End If End Sub
Private Sub cmdClose_Click()
If MsgBox("Are You Sure You Want to Close?", vbQuestion + vbYesNo, "CLose") = vbYes Then Unload Me
End If End Sub
Private Sub cmdsave_Click() On Error GoTo bj
AdoGrade.Recordset(0).Value = t1.Text
AdoGrade.Recordset(1).Value = t2.Text & ", " & t3.Text & " " & t4.Text AdoGrade.Recordset(2).Value = t5.Text
AdoGrade.Recordset(3).Value = t6.Text AdoGrade.Recordset(4).Value = t7.Text AdoGrade.Recordset(5).Value = t8.Text AdoGrade.Recordset(6).Value = t9.Text AdoGrade.Recordset(7).Value = t10.Text AdoGrade.Recordset(8).Value = t11.Text AdoGrade.Recordset(9).Value = t12.Text AdoGrade.Recordset(10).Value = t13.Text AdoGrade.Recordset(11).Value = t14.Text AdoGrade.Recordset(37).Value = Text1.Text AdoGrade.Recordset(38).Value = Text2.Text
If Me.t7.Text = "" Or Me.t8.Text = "" Or Me.t9.Text = "" Or Me.t10.Text = "" Or Me.t11.Text = "" Or Me.t12.Text = "" Or Me.t13.Text = "" Or Me.t14.Text = "" Then
MsgBox "All textboxes are required to fill-up.", vbInformation, "LNHS Computerized Grading System"
Else
If MsgBox("Waiting for your confirmation to Save.", vbQuestion + vbYesNo, "Save") = vbYes Then AdoGrade.Recordset.Update
Private Sub cmdSearch_Click() frmSearch.Show
frmSearch.Label1 = 1
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 55 Chapter V: Conclusion and Recommendation
End Sub
Private Sub cmdsearch2_Click() frmSearch2.Show
frmSearch2.Label1 = 1 End Sub
Private Sub Form_Load()
AdoStud.RecordSource = "select * from tblStudENt where Studentno ='" & t1.Text & "' "
AdoStud.Refresh
AdoSubj.RecordSource = "select * from tblSubj where SubjNo='" & t5.Text & "' "
AdoSubj.Refresh
AdoSubj.RecordSource = "select * from tblSubj where Subject='" & t5.Text & "' "
AdoSubj.Refresh End Sub
Private Sub t1_Change()
AdoStud.RecordSource = "select * from tblStudENt where Studentno ='" & t1.Text & "' "
AdoStud.Refresh End Sub
Private Sub t5_Change() On Error Resume Next
AdoSubj.RecordSource = "select * from tblSubj where SubjNo='" & t5.Text & "' "
AdoSubj.Refresh
l(0).Caption = "X " & AdoSubj.Recordset(2).Value & " % "
l(1).Caption = "X " & AdoSubj.Recordset(3).Value & " % "
l(2).Caption = "X " & AdoSubj.Recordset(4).Value & " % "
l(3).Caption = "X " & AdoSubj.Recordset(5).Value & " % "
l(4).Caption = "X " & AdoSubj.Recordset(6).Value & " % "
l(5).Caption = "X " & AdoSubj.Recordset(7).Value & " % "
l(6).Caption = "X " & AdoSubj.Recordset(8).Value & " % "
AdoGrade.RecordSource = "select * from tblgrade1 where idno = '" & t1.Text & "' and SubjNo = '" & t5.Text & "'"
AdoGrade.Refresh
If AdoGrade.Recordset.RecordCount = 1 Then t7.Text = AdoGrade.Recordset(4).Value t8.Text = AdoGrade.Recordset(5).Value t9.Text = AdoGrade.Recordset(6).Value t10.Text = AdoGrade.Recordset(7).Value t11.Text = AdoGrade.Recordset(8).Value t12.Text = AdoGrade.Recordset(9).Value t13.Text = AdoGrade.Recordset(10).Value t14.Text = AdoGrade.Recordset(11).Value AdoGrade.Recordset.Requery
Else
t7.Text = ""
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 56 Chapter V: Conclusion and Recommendation
t8.Text = ""
AdoGrade.Recordset.AddNew Me.Frame3.Enabled = True Me.cmdsave.Enabled = True Me.cmdCancel.Enabled = True End If
End Sub
Private Sub t7_Change() On Error Resume Next Dim dig$, i, digi$, digits$
If t7.Text <> "" Then
dig$ = Mid(t7.Text, Len(t7.Text), 1)
l(0).Caption = "X " & AdoSubj.Recordset(2).Value & " % = " & Val(t7.Text) * (Val(AdoSubj.Recordset(2).Value) / 100) comp
End Sub
Private Sub t8_Change() On Error Resume Next Dim dig$, i, digi$, digits$
If t8.Text <> "" Then
dig$ = Mid(t8.Text, Len(t8.Text), 1)
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 57 Chapter V: Conclusion and Recommendation
l(1).Caption = "X " & AdoSubj.Recordset(3).Value & " % = " & Val(t8.Text) * (Val(AdoSubj.Recordset(3).Value) / 100) comp
End Sub
Private Sub t9_Change() On Error Resume Next Dim dig$, i, digi$, digits$
If t9.Text <> "" Then
dig$ = Mid(t9.Text, Len(t9.Text), 1)
l(2).Caption = "X " & AdoSubj.Recordset(4).Value & " % = " & Val(t9.Text) * (Val(AdoSubj.Recordset(4).Value) / 100) comp
End Sub
Private Sub t10_Change() On Error Resume Next Dim dig$, i, digi$, digits$
If t10.Text <> "" Then
dig$ = Mid(t10.Text, Len(t10.Text), 1)
l(3).Caption = "X " & AdoSubj.Recordset(5).Value & " % = " & Val(t10.Text) * (Val(AdoSubj.Recordset(5).Value) / 100) comp
End Sub
Private Sub t11_Change() On Error Resume Next Dim dig$, i, digi$, digits$
If t11.Text <> "" Then
dig$ = Mid(t11.Text, Len(t11.Text), 1) If Asc(dig$) < 46 Or Asc(dig$) > 57 Then For i = 1 To Len(t11.Text) - 1
digi$ = Mid(t11.Text, i, 1)
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 58 Chapter V: Conclusion and Recommendation
digits$ = digits$ & digi$
l(4).Caption = "X " & AdoSubj.Recordset(6).Value & " % = " & Val(t11.Text) * (Val(AdoSubj.Recordset(6).Value) / 100) comp
End Sub
Private Sub t12_Change() On Error Resume Next Dim dig$, i, digi$, digits$
If t12.Text <> "" Then
dig$ = Mid(t12.Text, Len(t12.Text), 1)
l(5).Caption = "X " & AdoSubj.Recordset(7).Value & " % = " & Val(t12.Text) * (Val(AdoSubj.Recordset(7).Value) / 100) comp
End Sub
Private Sub t13_Change() On Error Resume Next Dim dig$, i, digi$, digits$
If t13.Text <> "" Then
dig$ = Mid(t13.Text, Len(t13.Text), 1)
l(6).Caption = "X " & AdoSubj.Recordset(7).Value & " % = " & Val(t13.Text) * (Val(AdoSubj.Recordset(8).Value) / 100) comp
End Sub Function comp()
t14.Text = Val(t7.Text) * (Val(AdoSubj.Recordset(2).Value) / 100) + _
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 59 Chapter V: Conclusion and Recommendation
Val(t8.Text) * (Val(AdoSubj.Recordset(3).Value) / 100) + _ Val(t9.Text) * (Val(AdoSubj.Recordset(4).Value) / 100) + _ Val(t10.Text) * (Val(AdoSubj.Recordset(5).Value) / 100) + _ Val(t11.Text) * (Val(AdoSubj.Recordset(6).Value) / 100) + _ Val(t12.Text) * (Val(AdoSubj.Recordset(7).Value) / 100) + _ Val(t13.Text) * (Val(AdoSubj.Recordset(8).Value) / 100) End Function
Function ENA() Frame1.Enabled = True Frame2.Enabled = True Frame3.Enabled = True cmdAdd.Enabled = False cmdEdit.Enabled = False cmdDel.Enabled = False cmdsave.Enabled = True cmdCancel.Enabled = True cmdClose.Enabled = False End Function
Function dis()
Frame1.Enabled = False Frame2.Enabled = False Frame3.Enabled = False cmdAdd.Enabled = True cmdEdit.Enabled = True cmdDel.Enabled = True cmdsave.Enabled = False cmdCancel.Enabled = False cmdClose.Enabled = True End Function
Private Sub t9_KeyPress(KeyAscii As Integer) Dim str As String
str = "0123456789"
If KeyAscii > 26 Then
If InStr(str, Chr(KeyAscii)) = 0 Then KeyAscii = 0
End If End If End Sub Second Grading
Private Sub cmdAdd_Click() ENA
End Sub
Private Sub cmdCancel_Click()
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 60 Chapter V: Conclusion and Recommendation
If MsgBox("Are You Sure You Want to Cancel?", vbQuestion + vbYesNo, "Cancel") = vbYes Then AdoGrade.Recordset.CancelBatch
Private Sub cmdClose_Click()
If MsgBox("Are You Sure You Want to Close?", vbQuestion + vbYesNo, "CLose") = vbYes Then Unload Me
End If End Sub
Private Sub cmdsave_Click() On Error GoTo bj
AdoGrade.Recordset(0).Value = t1.Text
AdoGrade.Recordset(1).Value = t2.Text & ", " & t3.Text & " " & t4.Text AdoGrade.Recordset(2).Value = t5.Text
AdoGrade.Recordset(3).Value = t6.Text AdoGrade.Recordset(12).Value = t7.Text AdoGrade.Recordset(13).Value = t8.Text AdoGrade.Recordset(14).Value = t9.Text AdoGrade.Recordset(15).Value = t10.Text AdoGrade.Recordset(16).Value = t11.Text AdoGrade.Recordset(17).Value = t12.Text AdoGrade.Recordset(18).Value = t13.Text AdoGrade.Recordset(19).Value = t14.Text
If Me.t7.Text = "" Or Me.t8.Text = "" Or Me.t9.Text = "" Or Me.t10.Text = "" Or Me.t11.Text = "" Or Me.t12.Text = "" Or Me.t13.Text = "" Or Me.t14.Text = "" Then
MsgBox "All textboxes are required to fill-up.", vbInformation, "LNHS Computerized Grading System"
Else
If MsgBox("Waiting for your confirmation to Save.", vbQuestion + vbYesNo, "Save") = vbYes Then AdoGrade.Recordset.Update
Private Sub cmdSearch_Click() frmSearch.Show
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 61 Chapter V: Conclusion and Recommendation
frmSearch.Label1 = 2 End Sub
Private Sub cmdsearch2_Click() frmSearch2.Show
frmSearch2.Label1 = 2 End Sub
Private Sub Form_Load()
AdoStud.RecordSource = "select * from tblStudENt where Studentno ='" & t1.Text & "' "
AdoStud.Refresh
AdoSubj.RecordSource = "select * from tblSubj where Subjno='" & t5.Text & "' "
AdoSubj.Refresh Me.Top = 2000 Me.Left = 5000 End Sub
Private Sub Option1_Click() t5.Text = ""
Frame6.Enabled = True End Sub
Private Sub Option2_Click() t5.Text = ""
Frame6.Enabled = True End Sub
Private Sub t1_Change()
AdoStud.RecordSource = "select * from tblStudENt where Studentno ='" & t1.Text & "' "
AdoStud.Refresh End Sub
Private Sub t5_Change() On Error Resume Next
AdoSubj.RecordSource = "select * from tblSubj where SubjNo='" & t5.Text & "' "
AdoSubj.Refresh
l(0).Caption = "X " & AdoSubj.Recordset(2).Value & " % "
l(1).Caption = "X " & AdoSubj.Recordset(3).Value & " % "
l(2).Caption = "X " & AdoSubj.Recordset(4).Value & " % "
l(3).Caption = "X " & AdoSubj.Recordset(5).Value & " % "
l(4).Caption = "X " & AdoSubj.Recordset(6).Value & " % "
l(5).Caption = "X " & AdoSubj.Recordset(7).Value & " % "
l(6).Caption = "X " & AdoSubj.Recordset(8).Value & " % "
AdoGrade.RecordSource = "select * from tblgrade1 where idno = '" & t1.Text & "' and SubjNo = '" & t5.Text & "'"
INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC Alimannao Hills, Peñablanca, Cagayan
Page 62 Chapter V: Conclusion and Recommendation
AdoGrade.Refresh
If AdoGrade.Recordset.RecordCount = 1 Then t7.Text = AdoGrade.Recordset(12).Value t8.Text = AdoGrade.Recordset(13).Value t9.Text = AdoGrade.Recordset(14).Value t10.Text = AdoGrade.Recordset(15).Value t11.Text = AdoGrade.Recordset(16).Value t12.Text = AdoGrade.Recordset(17).Value t13.Text = AdoGrade.Recordset(18).Value t14.Text = AdoGrade.Recordset(19).Value AdoGrade.Recordset.Requery
Else
AdoGrade.Recordset.AddNew Me.Frame3.Enabled = True Me.cmdsave.Enabled = True Me.cmdCancel.Enabled = True End If
End Sub
Private Sub t7_Change() On Error Resume Next Dim dig$, i, digi$, digits$
If t7.Text <> "" Then
dig$ = Mid(t7.Text, Len(t7.Text), 1)
dig$ = Mid(t7.Text, Len(t7.Text), 1)