Berikut Langkah-langkah Membuat Form Login :
Caranya anda Klik Project - Add Form
2. Caption : Form Login
Masukan Coding dibawah ini :
Private Sub CmdCancel_Click()SUMBER :
Unload Me
End Sub
Private Sub Form_Activate()
Text2.Enabled = False
End Sub
Sub Form_Load()
Call BukaDB
Text1.MaxLength = 6
Text2.MaxLength = 10
Text2.PasswordChar = "X"
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 Then
Call BukaDB
Call CariData
If RSAdmin.EOF Then
MsgBox "Admin Tidak Terdeteksi, Coba lagi"
Text1 = ""
Else
Text1.Enabled = False
Text2.Enabled = True
Text2.SetFocus
End If
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 Then
CmdLogin.SetFocus
End If
End Sub
Function CariData()
Call BukaDB
RSAdmin.Open "Select * From Admin where kodeAdmin='" & Text1 & "'", koneksi
End Function
Private Sub CmdLogin_Click()
Dim KodeAdmin As String
Dim NamaAdmin As String
Call BukaDB
RSAdmin.Open "Select * from Admin where kodeAdmin ='" & Text1 & "' and passwordAdmin='" & Text2 & "'", koneksi
If RSAdmin.EOF Then
MsgBox "Password Salah, Coba Lagi!"
Text2 = ""
Text2.SetFocus
Else
Unload Me
FormMenuUtama.Show
End If
End Sub
www.google.com
Tidak ada komentar:
Posting Komentar