excuse me everyone
i'm new in vb and this is my first project
i got problem with command button
it keep hiding
i have doing everything with all of the way
but never come to resolved
please help me
i'm new in vb and this is my first project
i got problem with command button
it keep hiding
i have doing everything with all of the way
but never come to resolved
Code:
Dim con As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset
Private Sub cmdBatal_Click()
kosongform
End Sub
Private Sub CmdProses_Click()
Dim skatakunci1 As String
Dim skatakunci2 As String
On Error Resume Next
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open "Select * from login", con
If Len(txtUserID.Text) < 1 Then
MsgBox "Tidak Ada Nilainya", vbCritical, "Error!"
Exit Sub
End If
If Len(txtPassword.Text) < 1 Then
MsgBox "Tidak Ada Nilainya", vbCritical, "Error!"
Exit Sub
End If
skatakunci1 = txtUserID.Text
skatakunci2 = txtPassword.Text
Loop
If Sentity = "admin" _
Or Sentity = "Kepsek" _
Or Sentity = "Guru" _
Or Sentity = "Dosen" _
Or Sentity = "Sensei" _
Then
FormMenuUtama.Show
FormLogin.Hide
Else
MsgBox "Anda Terdaftar!", vbCritical, "Tidak Ada"
Exit Sub
End If
End Sub
Private Sub cmdSelesai_Click()
FromMenuUtama.Show
FormLogin.Hide
rs.Close
Set rs = Nothing
Unload Me
End Sub
Private Sub Form_Activate()
txtUserID.Text = ""
txtPassword.Text = ""
End Sub
Private Sub Form_Load()
Set con = New ADODB.Connection
con.ConnectionString = "DSN=dsnanimehq"
con.Open
txtUserID.Text = ""
txtPassword.Text = ""
txtUserID.Enabled = True
txtPassword.Enabled = True
CmdProses.Enabled = False
CmdBatal.Enabled = False
CmdSelesai.Enabled = False
End Sub
Private Sub txtpassword_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys vbTab
Else
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End If
End Sub
Private Sub txtPassword_LostFocus()
Dim katakunci1 As String
Dim katakunci2 As String
Dim kode As Integer
kode = 0
On Error Resume Next
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open "Select * from login", con
katakunci1 = txtUserID.Text
katakunci2 = txtPassword.Text
If Len(txtUserID.Text) = 1 Then
MsgBox "Tidak Ada Nilainya", vbCritical, "Error!"
Exit Sub
End If
If Len(txtPassword.Text) < 1 Then
MsgBox "Tidak Ada NIlainya", vbCritical, "Eroor!"
Exit Sub
End If
rs.MoveFirst
Do While Not rs.EOF
If (katakunci1 = rs!userid And katakunci2 = rs!Password) Then
kode = 1
CmdProses.Enabled = True
CmdBatal.Enabled = True
CmdSelesai.Enabled = True
End If
rs.MoveNext
Loop
If kode = 0 Then
MsgBox "Tidak Ada Hasilnya", vbCritical, "Error!"
Exit Sub
End If
End Sub
Private Sub txtUseerID_Change()
End Sub
Private Sub txtUseerID_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys vbTab
Else
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End If
End Sub
Public Sub kosongform()
txtUserID.Text = ""
txtPassword.Text = ""
End Sub
Private Sub txtUserID_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys vbTab
Else
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End If
End Sub