You are on page 1of 8

Coding: Private Sub Command1_Click() Dim a As String Dim b As String a = Text1 b = Text2 If a = "SAMIR" Then If b = "RIMAS" Then main.

Hide personal.Hide MDIForm1.Show Else MsgBox "INVALID USERNAME", vbInformation End If Else MsgBox "INVALID PASSWORD", vbCritical End If End Sub Private Sub Command2_Click() End End Sub

Coding: Private Sub manu_Click() main.Show personal.Hide End Sub

Private Sub manu1_Click() personal.Show main.Hide End Sub

Coding: Private db As Database Private mai As Recordset Private Sub cmddelete_Click() mai.Delete mai.MoveFirst MsgBox "record deleted", vbInformation clear End Sub Private Sub cmdedit_Click() mai.Edit save mai.Update MsgBox "record changed", vbInformation clear End Sub Private Sub cmdexit_Click() End End Sub Private Sub cmdfind_Click()

mai.Index = "primarykey" mai.Seek "=", Text1 If mai.NoMatch Then MsgBox "invalid number", vbCritical Else find End If End Sub Private Sub cmdgo_Click() personal.Show End Sub Private Sub cmdsave_Click() mai.AddNew save mai.Update MsgBox "record saved" clear End Sub Private Sub save() mai("SERVICENO") = Text1 mai("RANK") = Text2 mai("NAME") = Text3 mai("UNIT") = Text4 mai("MOBILENO") = Text5 End Sub Private Sub find() Text1 = mai("SERVICENO") Text2 = mai("RANK") Text3 = mai("NAME") Text4 = mai("UNIT") Text5 = mai("MOBILENO") End Sub Private Sub clear() Text1 = "" Text2 = "" Text3 = "" Text4 = ""

Text5 = "" End Sub Private Sub Form_Load() Set db = OpenDatabase("K:\my new work\Database1") Set mai = db.OpenRecordset("main") End Sub

Coding: Private db As Database Private per As Recordset Private Sub cmddelete_Click() per.Delete per.MoveFirst MsgBox "record deleted", vbInformation clear End Sub Private Sub cmdedit_Click() per.Edit save per.Update MsgBox "record changed", vbInformation clear End Sub Private Sub cmdexit_Click() End End Sub

Private Sub cmdfind_Click() per.Index = "primarykey" per.Seek "=", Text1 If per.NoMatch Then MsgBox "invalid number", vbCritical Else find End If End Sub Private Sub cmdsave_Click() per.AddNew save per.Update MsgBox "record saved", vbInformation clear End Sub Private Sub save() per("SERVICE NO") = Text1 per("NAME") = Text2 per("ADDRESS") = Text3 per("DATE OF BIRTH") = Text4 per("ISLAND") = Text5 per("NEXT OF KIN") = Text6 per("MOBILE NO") = Text7 End Sub Private Sub find() Text1 = per("SERVICE NO") Text2 = per("NAME") Text3 = per("ADDRESS") Text4 = per("DATE OF BIRTH") Text5 = per("ISLAND") Text6 = per("NEXT OF KIN") Text7 = per("MOBILE NO") End Sub Private Sub clear() Text1 = "" Text2 = "" Text3 = ""

Text4 = "" Text5 = "" Text6 = "" Text7 = "" End Sub Private Sub Form_Load() Set db = OpenDatabase("K:\my new work\Database1") Set per = db.OpenRecordset("personal") End Sub

You might also like