Minggu, 18 November 2012
Sabtu, 17 November 2012
VISUAL BASIC "FORM TABEL BUKU"
CODING PEMANGGILAN OTOMATIS DENGAN ENTER :
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii = 13 Then
Data1.Recordset.Index = "kode"
Data1.Recordset.Seek "=", Text1.Text
If Not Data1.Recordset.NoMatch Then
Text2.Text = Data1.Recordset!judul
Text3.Text = Data1.Recordset!pengarang
Text4.Text = Data1.Recordset!penerbit
Text5.Text = Data1.Recordset!tahunterbit
Text6.Text = Data1.Recordset!noisbn
Text7.Text = Data1.Recordset!stok
Combo1.Text = Data1.Recordset!jenis
Else
MsgBox "Maaf Data Tidak Terdaftar", vbOKOnly + vbInformation, "konfirmasi"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Combo1.ListIndex = 0
Text1.SetFocus
End If
End If
CODING TAMBAH
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Combo1.Text = 0
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text1.SetFocus
CODING EDIT :
Data1.Recordset.Edit
Data1.Recordset!kdbuku = Text1.Text
Data1.Recordset!judul = Text2.Text
Data1.Recordset!jenis = Combo1.Text
Data1.Recordset!pengarang = Text3.Text
Data1.Recordset!penerbit = Text4.Text
Data1.Recordset!tahunterbit = Text5.Text
Data1.Recordset!noisbn = Text6.Text
Data1.Recordset!stok = Text7.Text
Data1.Recordset.Update
Text1.Text = ""
Text2.Text = ""
Combo1.Text = 0
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text1.SetFocus
MsgBox "Data Telah Di Edit", vbOKOnly + vbInformation, "info"
CODING SIMPAN
Data1.Recordset.AddNew
Data1.Recordset!kdbuku = Text1.Text
Data1.Recordset!judul = Text2.Text
Data1.Recordset!jenis = Combo1.Text
Data1.Recordset!pengarang = Text3.Text
Data1.Recordset!penerbit = Text4.Text
Data1.Recordset!tahunterbit = Text5.Text
Data1.Recordset!noisbn = Text6.Text
Data1.Recordset!stok = Text7.Text
Data1.Recordset.Update
Text1.Text = ""
Text2.Text = ""
Combo1.Text = 0
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text1.SetFocus
MsgBox "Data Telah Tersimpan", vbOKOnly + vbInformation, "info"
CODING HAPUS :
Dim Hapus As String
Hapus = MsgBox("Yakin Akan Dihapus?", vbYesNo + vbQuestion, "konfirmasi")
If Hapus = vbYes Then
Data1.Recordset.Delete
MsgBox "Data Telah Dihapus", vbOKOnly + vbInformation, "info"
Text1.Text = ""
Text2.Text = ""
Combo1.Text = 0
Text3.Text = ""
Text4.Text = ""
Text4.Text = ""
Text6.Text = ""
Text7.Text = ""
Text1.SetFocus
End If
CODING ANGKA OTOMATIS :
On Error Resume Next
Dim nob As Long
Dim nol As String
If Data4.Recordset.BOF And Data4.Recordset.EOF Then
nob = 1
Else
Data4.Recordset.MoveLast
nob = Val(Data4.Recordset!nokembali) + 1
End If
Text1.Text = Left("00000", 6 - Len(Trim(Str(nob)))) & Trim(Str(nob))
Text3.SetFocus
CODING RELASI TAMBAH :
Data2.Recordset.Index = "kode"
Data2.Recordset.Seek "=", Text5.Text
If Not Data2.Recordset.NoMatch Then
Data2.Recordset.Edit
Data2.Recordset!Jumlahbuku = Data2.Recordset!Jumlahbuku + Val(Text8.Text)
Data2.Recordset.Update
End If
CODING RELASI PENGURANGAN :
Data2.Recordset.Edit
Data2.Recordset!Jumlahbuku = Data2.Recordset!Jumlahbuku - Val(Text7.Text)
Data2.Recordset.Update
CODING ANGKA OTOMATIS :
On Error Resume Next
Dim nob As Long
Dim nol As String
If Data4.Recordset.BOF And Data4.Recordset.EOF Then
nob = 1
Else
Data4.Recordset.MoveLast
nob = Val(Data4.Recordset!nokembali) + 1
End If
Text1.Text = Left("00000", 6 - Len(Trim(Str(nob)))) & Trim(Str(nob))
Text3.SetFocus
CODING RELASI TAMBAH :
Data2.Recordset.Index = "kode"
Data2.Recordset.Seek "=", Text5.Text
If Not Data2.Recordset.NoMatch Then
Data2.Recordset.Edit
Data2.Recordset!Jumlahbuku = Data2.Recordset!Jumlahbuku + Val(Text8.Text)
Data2.Recordset.Update
End If
CODING RELASI PENGURANGAN :
Data2.Recordset.Edit
Data2.Recordset!Jumlahbuku = Data2.Recordset!Jumlahbuku - Val(Text7.Text)
Data2.Recordset.Update
CODING KELUAR :
Unload Me
Kamis, 01 November 2012
Minggu, 14 Oktober 2012
Langganan:
Postingan (Atom)