A Nu

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 4

students marks analyizing system..

Login Form
Dim rs As ADODB.Recordset
Dim cn As ADODB.Connection
Private Sub Command1_Click()
Dim f As Integer
f = 0
If Text1 = "" Then
MsgBox "Please Enter your Password."
Exit Sub
End If
rs.MoveFirst
If Combo1.Text = rs(0) And Text1 = rs(1) Then
f = 1
GoTo l
End If
rs.MoveNext
If Combo1.Text = rs(0) And Text1 = rs(1) Then
f = 2
GoTo l
End If
l:
If f = 1 Then
operations.Show
Unload Me
ElseIf f = 2 Then
operations.Command4.Enabled = False
operations.Command5.Enabled = False
operations.Command14.Enabled = False
operations.Show
Unload Me
End If
End Sub
Private Sub Form_Load()
Set cn = New Connection
Set rs = New Recordset
cn.Provider = "microsoft.jet.OLEDB.4.0"
cn.Open ("E:\ebi\student.mdb")
rs.Open "select * from verification", cn, adOpenDynamic, adLockOptimistic
Combo1.Text = Combo1.List(0)
End Sub
Operations Form
Dim rs As ADODB.Recordset
Dim cn As ADODB.Connection
Dim i As Integer, f1 As Integer, f As Integer, total As Double, average As Doubl
e
Private Sub Command11_Click()
For i = 0 To 9
Text(i).ForeColor = vbBlack
Next
If Text19 = "" Then
MsgBox "Please Enter a Record Number to view"
Text19.SetFocus
Exit Sub
End If
For i = 0 To 7
Text(i).Locked = False
Next i
f1 = 0
rs.MoveFirst
While Not rs.EOF
If Val(Text19) = rs(0) Then
For i = 0 To 9
If Val(rs(i)) < 50 Or rs(i) = "A" Or rs(i) = "a" Or rs(i) = "absent" Or rs(i) =
"Absent" Then
Text(i).ForeColor = vbRed
Text(i) = rs(i)
Else
Text(i).ForeColor = vbBlack
Text(i) = rs(i)
End If
Next i
GoTo l
Else
rs.MoveNext
End If
Wend
l:
If Text(9) = "FAIL" Then
Text(9).ForeColor = vbRed
Else
Text(9).ForeColor = vbBlack
End If
Text19 = ""
End Sub
Private Sub Command14_Click()
If Text20 = "" Then
MsgBox "Please Enter a Record Number to Delete"
Exit Sub
End If
If rs.BOF Then
MsgBox "DataBase is Empty.Please Enter Records to continue"
Exit Sub
End If
rs.MoveFirst
While Not rs.EOF
If Val(Text20) = rs(0) Then
If MsgBox("Are you Sure to delete this record?", vbYesNo) = vbYes Then
rs.Delete
MsgBox "Record Succesfully Deleted."
f = 1
GoTo l
Else
Text20 = ""
Exit Sub
End If
Else
rs.MoveNext
End If
Wend
l:
If f = 0 Then
MsgBox "Record not found."
End If
Text20 = ""
Text20.SetFocus
rs.MoveFirst
End Sub
Private Sub Command3_Click()
For i = 11 To 18
Text(i) = ""
Next i
Text(11).SetFocus
End Sub
Private Sub Command4_Click()
total = 0#
f = 0
If Text(11) = "" Or Text(12) = "" Or Text(13) = "" Or Text(14) = "" Or Text(15)
= "" Or Text(16) = "" Or Text(17) = "" Or Text(18) = "" Then
MsgBox "please Enter all the Fields correctly."
Else
rs.AddNew
rs(8) = total
average = total / 6
For i = 13 To 18
If (Text(i) <> "A" Or Text(i) <> "a" Or Text(i) <> "Absent" Or Text(i) <> "absen
t") And Val(Text(i)) >= 50 Then
f = 2
Else
rs(9) = "FAIL"
GoTo l
End If
Next i
If f = 2 Then
Call calculateAvg
End If
l:
rs.Update
MsgBox "Data Entered Succesfully."
For i = 11 To 18
Text(i) = ""
Next i
Text(11).SetFocus
End If
End Sub

Private Sub Command8_Click()


For i = 0 To 9
Text(i).ForeColor = vbBlack
Next
rs.MovePrevious
l:
If Not rs.BOF Then
For i = 0 To 9
If Val(rs(i)) < 50 Or rs(i) = "A" Or rs(i) = "a" Or rs(i) = "absent" Or rs(i) =
"Absent" Then
Text(i).ForeColor = vbRed
Text(i) = rs(i)
Else
Text(i).ForeColor = vbBlack
Text(i) = rs(i)
End If
Next i
Else
rs.MoveLast
GoTo l
End If
End Sub
Private Sub Form_Load()
Set cn = New Connection
Set rs = New Recordset
cn.Provider = "microsoft.jet.OLEDB.4.0"
cn.Open ("E:\ebi\student.mdb")
rs.Open "select * from marksdb", cn, adOpenDynamic, adLockOptimistic
End Sub
Private Sub TabStrip1_Click()
If TabStrip1.Tabs(1).Selected = True Then
Frame1.Visible = True
Frame2.Visible = False
Text(11).SetFocus
ElseIf TabStrip1.Tabs(2).Selected = True Then
Frame1.Visible = False
Frame2.Visible = False
Frame3.Visible = True
Text19.SetFocus
ElseIf TabStrip1.Tabs(3).Selected = True Then
Frame4.Visible = True
Frame6.Visible = False
Frame7.Visible = False
Text20.SetFocus
Else
Frame6.Visible = False
Frame7.Visible = True
Command16.SetFocus
End If
End Sub
Private Sub calculateAvg()
End Sub

You might also like