2 comments
Private Sub Command3_Click()
Data1.Recordset.MoveNext
Do While Not Data1.Recordset.EOF = True
    If Data1.Recordset("CrimeID") = Crimes Then
        found = True
        Exit Do
    Else
        Data1.Recordset.MoveNext
        found = False
    End If
Loop
If found = True Then
    susname = Data1.Recordset("SuspectName")
    caseno = Data1.Recordset("CaseNo")
    compid = Data1.Recordset("CompID")
    age = Data1.Recordset("SuspectAge")
    Crimeloc = Data1.Recordset("CrimeLoc")
    date = Data1.Recordset("FilledDate")
    time = Data1.Recordset("FilledTime")
    Command4.Enabled = True
Else
    MsgBox "No more record match", vbExclamation, "NO MATCH FOUND"
    Command3.Enabled = False
End If
Command1.Enabled = True
End Sub


Private Sub Command4_Click()
Data1.Recordset.MoveFirst
Do While Not Data1.Recordset.EOF = True
    If Data1.Recordset("CrimeID") = Crimes Then
        found = True
        Exit Do
    Else
        Data1.Recordset.MoveNext
        found = False
    End If
Loop
If found = True Then
    susname = Data1.Recordset("SuspectName")
    compid = Data1.Recordset("CompID")
    caseno = Data1.Recordset("CaseNo")
    age = Data1.Recordset("SuspectAge")
    Crimeloc = Data1.Recordset("CrimeLoc")
    date = Data1.Recordset("FilledDate")
    time = Data1.Recordset("FilledTime")
    Command3.Enabled = True
Else
    MsgBox "No more record match", vbExclamation, "NO MATCH FOUND"
    Command4.Enabled = False
0 comments
ADD RECORD
If Command1.Caption = "Add Complaint" Then
Data2.Recordset.AddNew
Picture1.Visible = False
Command1.Caption = "Save"
Command2.Enabled = True
Command3.Caption = "Cancel"
show_forms
Label3.Caption = X
time.Caption = Y
ElseIf Command1.Caption = "Save" Then
Data2.Recordset.Update
hide_forms
Picture1.Visible = True
Command1.Caption = "Add Complaint"
Command2.Enabled = False
Command3.Caption = "Back to Menu"
End If


UPDATE
edit.Enabled = True
Data1.Refresh
Do While Not Data1.Recordset.EOF = True
    If Data1.Recordset("LName") = lsearch Then
        found = True
        Exit Do
    Else
        Data1.Recordset.MoveNext
        found = False
    End If
Loop
If found = True Then
    MsgBox "Record Found!", vbInformation, "MATCH FOUND"
    fname = Data1.Recordset("FName")
    mname = Data1.Recordset("MName")
    lname = Data1.Recordset("LName")
    age = Data1.Recordset("Age")
    contactno = Data1.Recordset("ContactNo")
    sex = Data1.Recordset("Sex")
    compid = Data1.Recordset("CompID")
Else
    MsgBox "Record Not Found!", vbExclamation, "NO MATCH FOUND"
    lsearch.SelStart = 0
    lsearch.SelLength = Len(lname.Text)
    lsearch.SetFocus
End If
lsearch.Text = ""
Command4.Enabled = True
End Sub

DELETE
Data1.Recordset.Delete
MsgBox "Record Deleted", vbExclamation, "Process"
fname.Text = ""
mname.Text = ""
lname.Text = ""
age.Text = ""
contactno.Text = ""
sex.Text = ""
compid.Text = ""
Picture1.Visible = True
Command4.Enabled = False
End Sub


Private Sub edit_Click()
If edit.Caption = "Edit" Then
    edit.Caption = "Save"
    Data1.Recordset.edit
    Data1.Recordset("FName") = fname.Text
    Data1.Recordset("MName") = mname.Text
    Data1.Recordset("LName") = lname.Text
    Data1.Recordset("Age") = age.Text
    Data1.Recordset("ContactNo") = contactno.Text
    Data1.Recordset("Sex") = sex.Text
Else
MsgBox "Update Complete"
    Data1.Recordset("FName") = fname.Text
    Data1.Recordset("MName") = mname.Text
    Data1.Recordset("LName") = lname.Text
    Data1.Recordset("Age") = age.Text
    Data1.Recordset("ContactNo") = contactno.Text
    Data1.Recordset("Sex") = sex.Text
    Data1.Recordset.Update
fname.Text = ""
mname.Text = ""
lname.Text = ""
age.Text = ""
contactno.Text = ""
sex.Text = ""
compid.Text = ""
edit.Caption = "Edit"