Jumat, 07 Januari 2011

FORM SETING ADMINISTRATOR


Tabel TOOL :




Kode Programnya:
Option Explicit
Dim posTengah 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


Sub CekPass()
If Textpass.Text = Text1.Text Then

Else
MsgBox "Adminstrator Name & Password tidak cocok ini!", vbOKOnly + vbCritical, "UnAuthorized"
Textadm.Text = ""
Textpass.Text = ""
Text1.Text = "5457hhh43%*tyy*&^.,ll%$$#$#$"
End If
End Sub


Private Sub CmdBatal_Click()
Textadm.Text = ""
Textpass.Text = ""
TxtAdm.Text = ""
TxtPass.Text = ""
TxtNama.Text = ""
CmdGanti.Caption = "Ganti"
CmdTambah.Caption = "Tambah"
CmdTambah.Enabled = True
CmdKeluar.Enabled = True
End Sub


Private Sub CmdGanti_Click()
If CmdGanti.Caption = "Ganti" Then
CmdGanti.Caption = "Simpan"
CmdTambah.Enabled = False
CmdKeluar.Enabled = False
Textadm.SetFocus
Else
CekPass
With Adodc1.Recordset
.Fields("Administrator") = TxtAdm.Text
.Fields("Pasword") = TxtPass.Text
.Fields("Nama") = TxtNama.Text
.Update
End With
MsgBox "Nana dan Pasword Telah Diganti!", vbInformation + vbOKOnly = vbIgnore
Call CmdBatal_Click
End If
End Sub


Private Sub CmdHapus_Click()
Dim x As String
x = MsgBox(("Anda Yakin data ingin di hapus?"), vbYesNo + vbCritical)
If x = vbYes Then
  If Textpass.Text = Text1.Text Then
    Adodc1.Recordset.Delete
    Adodc1.Recordset.MoveFirst
    DataGrid1.ReBind
    DataGrid1.Refresh
    MsgBox "Operator telah di Hapus!", vbInformation + vbOKOnly = vbIgnore
  Else
    MsgBox "Adminstrator Name & Password tidak cocok ini!", vbOKOnly + vbCritical, "UnAuthorized"
    Textadm.Text = ""
    Textpass.Text = ""
    TxtNama.Text = ""
    Text1.Text = "5457hhh43%*tyy*&^.,ll%$$#$#$"
  End If
End If
End Sub


Private Sub CmdKeluar_Click()
If MsgBox("Yakin mau keluar?", vbQuestion + vbYesNo) = vbYes Then
        Keluar
    End If
End Sub
Sub Keluar()
    posTengah = Me.Top
    Me.Top = Me.Top + 10
    Me.Timer2.Interval = 50
End Sub
Private Sub CmdTambah_Click()
If CmdTambah.Caption = "Tambah" Then
CmdGanti.Enabled = False
CmdHapus.Enabled = False
CmdTambah.Caption = "Simpan"
Else
If MsgBox("Anda yakin data sudah benar", vbQuestion + vbYesNo) = vbYes Then
With Adodc1.Recordset
.AddNew
.Fields("Adminstrator") = TxtAdm.Text
.Fields("Pasword") = TxtPass.Text
.Fields("Nama") = TxtNama.Text
.Update
End With
MsgBox "Operator telah di tambah!", vbInformation + vbOKOnly = vbIgnore
Call CmdBatal_Click
CmdGanti.Enabled = True
CmdHapus.Enabled = True
End If
End If
End Sub

Private Sub Form_Activate()
FrmAdmin.Height = 4560
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
    Me.Top = Me.Height * -1
    Me.Left = (Screen.Width - Me.Width) / 2
    posTengah = (Screen.Height - Me.Height) / 2
    Me.Timer1.Interval = 50
End Sub


Private Sub Textadm_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Adodc1.Recordset.Find "Adminstrator='" + Textadm.Text + "'", , adSearchForward, 1
If Not Adodc1.Recordset.EOF Then
     Text1.Text = Adodc1.Recordset!Pasword
     TxtNama.Text = Adodc1.Recordset!Nama
     Textpass.SetFocus
Else
    Textpass.SetFocus
End If

End If
End Sub


Private Sub Textpass_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TxtAdm.SetFocus
End If
End Sub


Private Sub Timer1_Timer()
 If Me.Top < posTengah Then
        Me.Top = Me.Top + ((posTengah - Me.Top) / 2)
    Else
        Me.Top = posTengah
        Me.Timer1.Interval = 0
    End If
End Sub


Private Sub Timer2_Timer()
If Me.Top < Screen.Height Then
        Me.Top = Me.Top + ((Me.Top - posTengah) * 2)
    Else
        Unload Me
    End If
End Sub


Private Sub TxtAdm_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TxtPass.SetFocus
End If
End Sub


Private Sub TxtPass_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TxtNama.SetFocus
End If
End Sub



Pembayaran SPP.rar
Program_Pembayaran_SPP.pdf

Tidak ada komentar:

Posting Komentar