Jumat, 07 Januari 2011

Form Login



Kode Programnya adalah:
Option Explicit
Dim x As Integer
Private koneksi As ADODB.Connection


Private Function konek() As Boolean
    On Error GoTo out
        Set koneksi = New ADODB.Connection
        koneksi.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DbSekolah.mdb;Persist Security Info=False"
        koneksi.CursorLocation = adUseClient
        konek = True
out:
End Function


Private Sub CmdBatal_Click()
Unload Me
End Sub


Private Sub CmdOK_Click()
If TxtPass.Text = TextCek.Text Then
    With Adodc2.Recordset
    .Fields("Administrator") = LbName.Caption
    .Fields("Tanggal") = MaskEdBox1.Text
    .Fields("Jam_Login") = LbJam.Caption
    .Update
    End With
        MsgBox "AKSES DITERIMA ! Selamat Datang, " & UCase(TxtAdmin), , "OK"
      Unload Me
       FrmSPP.Show
     Else
         If x = 3 Then
        MsgBox "Anda tidak berhak mengoperasikan aplikasi ini!", vbOKOnly + vbCritical, "UnAuthorized"
        End
        Else
        MsgBox "Password& Admin SALAH, masukkan lagi Admin & passwordnya!" & Chr(10) & "Kesempatan anda" & 3 - x & " lagi", vbOKOnly + vbCritical, "Password Salah"
        x = x + 1
                TxtAdmin.Text = ""
                TxtPass = ""
                TextCek.Text = "rtbr345435*&^#2325hhutyu6788"
                TxtAdmin.SetFocus
           Exit Sub
         End If
    End If
End Sub


Private Sub Form_Activate()
‘mengatur tiggi form Login
FrmLogin.Height = 3300
 x = 1
‘Kode Mengseting tanggal
Dim t$
    Dim thn$, bln$, tgl$
    t = MaskEdBox1.Text
    If t <> "__/__/__" Then
        thn = Right(t, 4)
        bln = Mid(t, 4, 2)
        tgl = Left(t, 2)
       
        If IsDate(thn & "-" & bln & "-" & tgl) = False Then
                 MaskEdBox1.Text = Format(Now, "dd/MM/yyyy")
        End If
    End If
End Sub


Private Sub Form_Load()
If Not konek() Then
        MsgBox "Gak bisa terhubung ke database!", vbCritical
        End
    End If
    Adodc1.ConnectionString = koneksi.ConnectionString
    Adodc1.RecordSource = "Login"
    Set DataGrid1.DataSource = Adodc1
    Adodc2.ConnectionString = koneksi.ConnectionString
    Adodc2.RecordSource = "AktifvitasOP"
    Set DataGrid1.DataSource = Adodc2
End Sub





Private Sub Timer1_Timer()
‘Jam Hitungan 24 Jam
Dim dblSecond As Double, dblMinute As Double, dblHour As Double
dblSecond = Second(Now) * 6 - 90
dblMinute = (Minute(Now) + Second(Now) / 60) * 6 - 90
dblHour = (Hour(Now) + Minute(Now) / 60) * 30 - 90
LbJam.Caption = Format(Now, "hh:mm:ss")
End Sub


Private Sub TxtAdmin_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Adodc1.Recordset.Find "Adminstrator='" + TxtAdmin.Text + "'", , adSearchForward, 1
If Not Adodc1.Recordset.EOF Then
     TextCek.Text = Adodc1.Recordset!Pasword
     LbName.Caption = Adodc1.Recordset!Nama
Else
  



End If
TxtPass.SetFocus
End If
End Sub
Private Sub TxtPass_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call CmdOK_Click
End If
End Sub







Pembayaran SPP.rar
Program_Pembayaran_SPP.pdf

Tidak ada komentar:

Posting Komentar