Form EditPassword
Biar nyambung baca dulu artikel saya sebelumnya untuk membuat Form Menu dan Form New Password. Sekarang kita membuat Form Edit Password, Tambahkan sebuah Form (Namai dengan : FrmEditPassword), tambahkan beberapa component sebagai berikut :
- 2 buah CommandButton
- 3 buah TextBox
- 1 buah Frame
- dan beberapa buah Label
Susun sedemikian rupa hingga tampilannya akan nampak seperti ini :
- command1, name : Command1, caption : Create Password, enabled = false
- command2, name : Command2, caption : Cancel
- Frame1, name : Frame1, caption : New Password
- Text1, name : Text1, Text : , PasswordChar : *
- Text2, name : Text2, Text : , PasswordChar : *
- Text3, name : Text3, Text : , PasswordChar : *
- Label1, name : Label1, caption : Enter a Password
- Label2, name : Label2, caption : Type Password Again
- Label3, name : Label3, caption : Old Password
Form Edit Password
Sekarang diteruskan untuk mengisi jendela coding
Private Sub Command1_Click()
On Error GoTo 1
If Text1.Text = "" Or Text2.Text = "" Then Exit Sub
Dim fs As Object
Dim db As Database
Set fs = CreateObject("Scripting.FileSystemObject")
fs.CopyFile FrmMenu.Text1.Text, FrmMenu.Text2.Text
Set db = OpenDatabase(FrmMenu.Text2, True, False, ";pwd=" + Text3.Text)
db.newPassword Text3.Text, Text1.Text
db.Close
MsgBox "Password has been changed!", vbInformation, ".: Password changed success"
Unload Me
1:
If Not Err.Number = 0 Then
MsgBox Err.Number, vbInformation, ".: Password Changed failed"
Exit Sub
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Text1_LostFocus()
Text2.Text = ""
End Sub
Private Sub Text2_Change()
On Error Resume Next
Command1.Enabled = False
If Not Text2.Text = "" Then
If Text2.Text = Text1.Text Then Command1.Enabled = True
Else
Command1.Enabled = False
End If
End Sub
Private Sub Text3_Change()
On Error GoTo 1
Frame1.Enabled = True
Dim db As Database
Set db = OpenDatabase(FrmMenu.Text1.Text, True, False, ";pwd=" + Text3.Text)
Text1.SetFocus
1:
If Not Err.Number = 0 Then
Frame1.Enabled = False
End If
End Sub
On Error GoTo 1
If Text1.Text = "" Or Text2.Text = "" Then Exit Sub
Dim fs As Object
Dim db As Database
Set fs = CreateObject("Scripting.FileSystemObject")
fs.CopyFile FrmMenu.Text1.Text, FrmMenu.Text2.Text
Set db = OpenDatabase(FrmMenu.Text2, True, False, ";pwd=" + Text3.Text)
db.newPassword Text3.Text, Text1.Text
' text3 -- password lama
' text1 --- password barudb.Close
MsgBox "Password has been changed!", vbInformation, ".: Password changed success"
Unload Me
1:
If Not Err.Number = 0 Then
MsgBox Err.Number, vbInformation, ".: Password Changed failed"
Exit Sub
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Text1_LostFocus()
Text2.Text = ""
End Sub
Private Sub Text2_Change()
On Error Resume Next
Command1.Enabled = False
If Not Text2.Text = "" Then
If Text2.Text = Text1.Text Then Command1.Enabled = True
Else
Command1.Enabled = False
End If
End Sub
Private Sub Text3_Change()
On Error GoTo 1
Frame1.Enabled = True
Dim db As Database
Set db = OpenDatabase(FrmMenu.Text1.Text, True, False, ";pwd=" + Text3.Text)
Text1.SetFocus
1:
If Not Err.Number = 0 Then
Frame1.Enabled = False
End If
End Sub
NOTE :
Aplikasi ini dirancang untuk mem-password, dengan terlebih dahulu mengcopy database asli ke path yang lain, untuk menghindari hal-hal yang tidak diinginkan.
Langkah selanjutnya membuat Form DelPassword
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :