CARA MEMBUAT PROGRAM INPUT SEDERHANA


CARA MEMBUAT PROGRAM INPUT SEDERHANA 

Atur Form Seperti di atas setelah itu masukan Ssource Code Berikut :
Private koneksi As New ADODB.Connection
Private dbrec As New ADODB.Recordset
Private Sub cmdcari_Click()
Form_Activate
dbrec.Open "select * from tbservice where nama_pelanggan = '" & txtnp & "'", koneksi
If Not dbrec.EOF Then
txtnb = dbrec!barang
txtntelp = dbrec!no_telpone
txtker = dbrec!kerusakan
txtbiaya = dbrec!biaya
MsgBox "Data Ada, Berhasil di Tampilkan", vbInformation, "Informasi"
Else
MsgBox "Data Tidak di Temukan", vbInformation, "Ada Informasi"
End If
End Sub
Private Sub cmdhapus_Click()
dbservice.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 txtnp = "" Or txtnb = "" Or txtntelp = "" Or txtker = "" Or txtbiaya = "" Then
MsgBox "Ada Data Yang Belum di Masukan", vbInformation, "INFO !!!"
Else
Dim tambah As String
tambah = "insert into tbservice (nama_pelanggan,barang,no_telpone,kerusakan, biaya) values ('" _
& txtnp & "','" & txtnb & "','" & txtntelp & "','" & txtker & "','" & txtbiaya & "') "
koneksi.Execute tambah
txtnp = ""
txtnb = ""
txtntelp = ""
txtker = ""
txtbiaya = ""
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 & "\dbservice.mdb"
End Sub