Password Code Sample untuk Microsoft Access Database
Sekarang ini diberikan satu contoh bagaimana cara membuat sebuah Password.
Perhatikan dengan baik contoh berikut ini.
Private Sub COK_Click()
'ini untuk mengecek File format
Dim strFormat As String
Select Case CurrentProject.FileFormat
Case acFileFormatAccess2
strFormat = "Microsoft Access 2"
Case acFileFormatAccess95
strFormat = "Microsoft Access 95"
Case acFileFormatAccess97
strFormat = "Microsoft Access 97"
Case acFileFormatAccess2000
strFormat = "Microsoft Access 2000"
Case acFileFormatAccess2002
strFormat = "Access 2002 - 2003"
End Select
'MsgBox "This is a " & strFormat & " project."
MsgBox "Database ini adalah " & strFormat & " format."
Dim frm As Form, ctl As Control
' Return Form object pointing to active form.
Set frm = Screen.ActiveForm
MsgBox "Nama Form ini adalah: " & frm.Name & " dan sedang aktif."
' Return Control object pointing to active control.
Set ctl = Screen.ActiveControl
MsgBox "Nama Control: " & ctl.Name & " sedang aktif " _
& "pada form ini."
'MsgBox Screen.ActiveForm.Name
'ini akhir untuk mengecek File format
On Error GoTo Err_COK_Click
Dim CatchMe, MyName As String
Dim Hitung As Integer
Hitung = 0
CatchMe = Forms!FUser!Secret
MyName = Forms!FUser!Nama
'Dim InExit As Integer
Do While (True)
If (Nama = MyName And Psswd = CatchMe) Then
DoCmd.Close
DoCmd.OpenForm "switchboard"
End
Else
' ----
'If Not (Nama = MyName And Psswd = CatchMe) Then
'DoCmd.Quit
Hitung = Hitung + 1
If Hitung = 3 Then
MsgBox " Sorry! You have no access on this database."
DoCmd.Quit
End If
'End If
' ----
Exit Do
End If
Loop
Exit_COK_Click:
Exit Sub
Err_COK_Click:
MsgBox Err.Description
Resume Exit_COK_Click
End Sub
0 comments:
Post a Comment
Thank you for your comments