3. Buatlah form1 (sebagai form login) dengan tampilan properties dibawah ini
Tools Properties
Label1 Caption : Kode Admin
Label 2 Caption : Password
Text1 Name : Text1
Text2 Name : Text2
Command Button1 Name : CmdLogin
Captio: &Login
Command Button1 Name : CmdCancel
Caption: &Cancel
Microsoft Ado Data Control 6 Name : Adodc1
MEMBUAT FORM LOGIN DENGAN VB 6.0
Unload Me
End Sub
Text2.Enabled = False
End Sub
Sub Form_Load()
Call BukaDB
Text1.MaxLength = 6
Text2.MaxLength = 10
Text2.PasswordChar = "X"
End Sub
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 Then
Call BukaDB
Call CariData
If RSAdmin.EOF Then
Text1 = ""
Else
Text1.Enabled = False
Text2.Enabled = True
Text2.SetFocus
End If
End If
End Sub
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
MEMBUAT FORM LOGIN DENGAN VB 6.0
Call BukaDB
RSAdmin.Open "Select * from Admin where kodeAdmin ='" & Text1 & "' and passwordAdmin='" &
Text2 & "'", koneksi
If RSAdmin.EOF Then
Text2 = ""
Text2.SetFocus
Else
Unload Me
FormMenuUtama.Show
End If
End Sub
4. Kemudian tambahkan module pada vb, dengan klik Project, pilih ,module