Professional Documents
Culture Documents
Codes
Codes
End Sub
Timer2.Enabled = True
End If
End If
End Sub
btnClick = "Add"
Call clr
fraCommands.Enabled = False
fraStud.Enabled = True
fraSrch.Enabled = False
End Sub
Call clr
cmdClear.Enabled = True
fraStud.Enabled = False
fraCommands.Enabled = True
fraSrch.Enabled = True
End Sub
Call clr
End Sub
If lstStud.ListIndex = -1 Then
MsgBox "Select student record to delete from the list box --->", vbExclamation, "Error"
Exit Sub
Else
Dim X As Byte
X = MsgBox("Do you want to delete this student record?", vbYesNo + vbQuestion, "Confirm")
If X = vbYes Then
Adodc1.RecordSource = "SELECT * FROM tblStudents WHERE LRN = '" & txtLRN.Text & "'"
Adodc1.Recordset.Delete
Call Form_Load
Call clr
End If
End If
End Sub
If lstStud.ListIndex = -1 Then
End If
btnClick = "Edit"
fraCommands.Enabled = False
cmdClear.Enabled = False
fraStud.Enabled = True
fraSrch.Enabled = False
End Sub
Unload Me
End Sub
Dim X As Byte
X = MsgBox("Do you want to save this student record?", vbYesNo + vbQuestion, "Confirm")
If X = vbYes Then
Adodc1.Refresh
With Adodc1.Recordset
.AddNew
.Fields("LRN") = txtLRN.Text
.Fields("LastName") = txtLName.Text
.Fields("MiddleName") = txtMName.Text
.Fields("FirstName") = txtFName.Text
.Fields("Gender") = cmbGender.Text
.Fields("BDate") = dtBDate.Value
.Fields("Age") = cmbAge.Text
.Fields("YearLevel") = cmbYrLevel.Text
.Fields("Section") = cmbSection.Text
.Fields("Contact") = txtContact.Text
.Fields("Address") = txtAddress.Text
.Fields("Guardian") = txtGuardian.Text
.Fields("Name") = txtLName.Text & ", " & txtFName.Text & " " & txtMName.Text
.Update
End With
Call Form_Load
Call clr
End If
Else
X = MsgBox("Do you want to update this student record?", vbYesNo + vbQuestion, " Confirm")
If X = vbYes Then
Adodc1.RecordSource = "SELECT * FROM tblStudents WHERE LRN = '" & txtLRN.Text & "'"
Adodc1.Refresh
With Adodc1.Recordset
.Fields("LRN") = txtLRN.Text
.Fields("LastName") = txtLName.Text
.Fields("MiddleName") = txtMName.Text
.Fields("FirstName") = txtFName.Text
.Fields("Gender") = cmbGender.Text
.Fields("BDate") = dtBDate.Value
.Fields("Age") = cmbAge.Text
.Fields("YearLevel") = cmbYrLevel.Text
.Fields("Section") = cmbSection.Text
.Fields("Contact") = txtContact.Text
.Fields("Address") = txtAddress.Text
.Fields("Guardian") = txtGuardian.Text
.Fields("Name") = txtLName.Text & ", " & txtFName.Text & " " & txtMName.Text
.Update
End With
Call Form_Load
Call clr
Call cmdCancel_Click
End If
End If
End Sub
Adodc1.Refresh
lstStud.Clear
lstStud.AddItem (Adodc1.Recordset.Fields(0))
Adodc1.Recordset.MoveNext
Loop
age = 0
'----------
Do While age <= 50
cmbAge.AddItem (age)
age = age + 1
Loop
cmbGender.AddItem ("Male")
cmbGender.AddItem ("Female")
cmbSection.AddItem ("A")
cmbSection.AddItem ("B")
cmbSection.AddItem ("C")
cmbSection.AddItem ("D")
End Sub
txtLRN.Text = ""
txtLName.Text = ""
txtMName.Text = ""
txtFName.Text = ""
cmbGender.Text = ""
dtBDate.Value = Date
cmbAge.Text = ""
cmbYrLevel.Text = ""
cmbSection.Text = ""
txtContact.Text = ""
txtAddress.Text = ""
txtGuardian.Text = ""
End Sub
Adodc1.RecordSource = "SELECT * FROM tblStudents WHERE Name = '" & lstStud.Text & "'"
Adodc1.Refresh
With Adodc1.Recordset
txtLRN.Text = .Fields("LRN")
txtLName.Text = .Fields("LastName")
txtMName.Text = .Fields("MiddleName")
txtFName.Text = .Fields("FirstName")
cmbGender.Text = .Fields("Gender")
dtBDate.Value = .Fields("BDate")
cmbAge.Text = .Fields("Age")
cmbYrLevel.Text = .Fields("YearLevel")
cmbSection.Text = .Fields("Section")
txtContact.Text = .Fields("Contact")
txtAddress.Text = .Fields("Address")
txtGuardian.Text = .Fields("Guardian")
End With
End Sub
KeyAscii = 0
End If
End Sub
If Not ((KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 Or KeyAscii = 122)) Then
KeyAscii = 0
End Sub
If Not ((KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 Or KeyAscii = 122)) Then
KeyAscii = 0
End Sub
If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8 Or KeyAscii = 27)) Then
KeyAscii = 0
End If
End Sub
If Not ((KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 Or KeyAscii = 122)) Then
KeyAscii = 0
End Sub
Adodc1.RecordSource = "SELECT Name FROM tblStudents WHERE Name LIKE '" & txtSearch.Text & "%'"
Adodc1.Refresh
lstStud.Clear
lstStud.AddItem (Adodc1.Recordset.Fields(0))
Adodc1.Recordset.MoveNext
Loop
End Sub