Membuat Form Login Aplikasi Pembelian VB 6.0

Berikut langahnya :
Membuat Form Login Aplikasi Pembelian VB 6.0
Pada gambar diatas, kita sukses membuat Module

Klik Project
Add Form
Membuat Form Login Aplikasi Pembelian VB 6.0

Klik Open
Pada Properties, ganti name menjadi : FormLogin


Kemudian Design FormLogin seperti gambar dibawah ini :

Download Form Login VB 6.0 Database Access

Kemudian pada FormLogin, masukan koding dibawah ini :
FormLogin

Sub Terbuka()
FormMenuUtama.MnLogin.Enabled = False
FormMenuUtama.MnLogout.Enabled = True
FormMenuUtama.mnMaster.Enabled = True
FormMenuUtama.MnTransaksi.Enabled = True
FormMenuUtama.MnLaporan.Enabled = True
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Activate()
Text1 = ""
Text2 = ""
Text1.SetFocus
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
      Text2.SetFocus
    End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
    If KeyAscii = 13 Then
        Command1.SetFocus
    End If
End Sub
Function CariData()
    Call BukaDB
    RSAdmin.Open "Select * From TBL_ADMIN where kodeAdmin='" & Text1 & "'", Koneksi
End Function
Private Sub Command1_Click()
Call BukaDB
        RSAdmin.Open "Select * from TBL_ADMIN where KodeAdmin ='" & Text1 & "' and PasswordAdmin='" & Text2 & "'", Koneksi
        If RSAdmin.EOF Then
            MsgBox "KodeAdmin atau Password Salah!"
            Text1.SetFocus
        Else
            Unload Me
            FormMenuUtama.Show
            Call Terbuka
        End If
End Sub
FormMenuUtama
Sub Terkunci()
   MnLogin.Enabled = True
   MnLogout = False
   mnMaster.Enabled = False
   MnTransaksi.Enabled = False
   MnLaporan.Enabled = False
End Sub
Private Sub Form_Load()
   Call Terkunci
End Sub
Private Sub MnKeluar_Click()
   End
End Sub
   Private Sub MnLogin_Click()
   FormLogin.Show vbModal
End Sub
Jika sudah silahkan Jalankan atau Run Project anda

Post a Comment