-
· Buat frmUtama seperti
-
· Buat frmkey melalui Add form
- klik pada Project lalu Project Properties..Untuk Startup Objec pilih frmkey
-
- Berikan code seperti berikut
Private Sub cmdCancel_Click()
'set the global var to false
'to denote a failed login
LoginSucceeded = False
Me.Hide
End Sub
Private Sub cmdOK_Click()
'check for correct password
If txtUser = "admin" Then
txtPassword = "password"
'place code to here to pass the
'success to the calling sub
'setting a global var is the easiest
LoginSucceeded = True
Me.Hide
frmUtama.Show
Else
MsgBox "Login gagal, Coba Kembali!", , "Login"
txtPassword.SetFocus
End If
End Sub
- Jalankan...(F5)