Private Sub Form_Load()
CmdPassword.Caption = "Edit Data" 'Posisi caption tombol pertama kali
Me.AllowEdits = False 'Form tidak dapat di edit
End Sub
Private Sub CmdPassword_Click()
Dim Password As String
Password = "user" ' Isi variable password
If CmdPassword.Caption = "Hasil" Then 'Menguji caption tombol
Me.AllowEdits = False
CmdPassword.Caption = "Edit Data" 'Mengembalikan caption semula
TxtHasilKuadrat = Val(TxtKuadrat ^ 2)
Else
If InputBox("Maukkan Password Anda : ", "Password") = "user" Then
Me.AllowEdits = True 'Form dapat di edit
TxtKuadrat = ""
TxtHasilKuadrat = ""
CmdPassword.Caption = "Hasil" 'Mengubah Caption tombol menjadi tombol hasil
Else
MsgBox ("Password Anda Salah") 'Menampilkan Message Box
End If
End If
End Sub
Private Sub CmdKeluar_Click()
DoCmd.Close
End Sub