CARA MEMBUAT PROGRAM PSG SEDERHANA


CARA MEMBUAT PROGRAM PSG SEDERHANA


Atur Form Seperti di atas setelah itu masukan Source Code Berikut :
Private koneksi As New ADODB.Connection
Private dbrec As New ADODB.Recordset
Private Sub cmdcari_Click()
Form_Activate
dbrec.Open "select * from tbpsg where nis = '" & txtnis & "'", koneksi
If Not dbrec.EOF Then
txtns = dbrec!nama
txtk = dbrec!kelas
txtjur = dbrec!jurusan
txttp = dbrec!tempat_psg
MsgBox "Data Ada, Berhasil di Tampilkan", vbInformation, "Informasi"
Else
MsgBox "ID Penitip Masih Kosong Atau Data Tidak di Temukan", vbInformation, "Informasi Pencarian"
End If
End Sub
Private Sub cmdedit_Click()
dbpsg.Recordset!nis = txtnis
dbpsg.Recordset!nama = txtns
dbpsg.Recordset!kelas = txtk
dbpsg.Recordset!jurusan = txtjur
dbpsg.Recordset!tempat_psg = txttp
End Sub
Private Sub cmdhapus_Click()
dbpsg.Recordset.Delete
End Sub
Private Sub cmdkeluar_Click()
End
End Sub
Private Sub cmdrefresh_Click()
Unload Me
Form1.Show
End Sub
Private Sub cmdsimpan_Click()
If txtnis = "" Or txtns = "" Or txtk = "" Or txtjur = "" Or txttp = "" Then
MsgBox "Ada Data Yang Belum di Masukan", vbInformation, "INFO !!!"
Else
Dim tambah As String
tambah = "insert into tbpsg (nis,nama,kelas,jurusan, tempat_psg) values ('" _
& txtnis & "','" & txtns & "','" & txtk & "','" & txtjur & "','" & txttp & "') "
koneksi.Execute tambah
txtnis = ""
txtns = ""
txtk = ""
txtjur = ""
txttp = ""
MsgBox "Data Berhasil di Tambahkan", vbInformation, "Berhasil"
End If
End Sub
Private Sub Form_Activate()
Set koneksi = New ADODB.Connection
Set dbrec = New ADODB.Recordset
koneksi.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\dbpsg.mdb"
End Sub