Ini neh jawaban dari soal latihan vb2 kasus PERPUSTAKAAN, dari pada copast ga jelas,mending di cek ajah neh langsung di pisah per event aja biar jelas.buat penampakannya dilihat dulu deh
Bagi yang belum tau bentuk dari form peminjamannya.
Berikut Listing per EVENT nya :
Nah buat source codenya di download ajah deh. . .
Download disini :
Bagi yang belum tau bentuk dari form peminjamannya.
Berikut Listing per EVENT nya :
- Private Sub ccancel_Click()
- Call bersih
- np.Enabled = False
- noa.Enabled = False
- naa.Enabled = False
- kb.Enabled = False
- jd.Enabled = False
- tglbatas.Enabled = False
- jp.Enabled = False
- End Sub
- Sub bersih()
- np.Text = ""
- noa.Text = ""
- naa.Text = ""
- kb.Text = "pilih"
- jd.Text = ""
- tglbatas.Text = ""
- jp.Text = ""
- End Sub
- Private Sub cclose_Click()
- a = MsgBox("Anda ingin keluar???", vbQuestion + vbOKCancel, "Konfirmasi")
- If a = vbOK Then End
- End Sub
- Private Sub cinput_Click()
- simpankedetailpinjam = "insert into detail_pinjam values('" & np.Text & "','" & kb.Text & "','" & jd.Text & "','" & tglbatas.Text & "')"
- Set d = a.Execute(simpankedetailpinjam, , adCmdText)
- naa.Text = ""
- kb.Text = "pilih"
- jd.Text = ""
- tglbatas.Text = ""
- jp.Text = ""
- End Sub
- Private Sub cnew_Click()
- nopinjamotomatis = "select *from pinjam order by nopinjam desc"
- Set c = a.Execute(nopinjamotomatis, , adCmdText)
- If c.BOF And c.EOF Then
- np.Text = "P" + Format(Date, "yy") & Format(Date, "mm") & "001"
- Else
- c.MoveFirst
- np.Text = "P" + Format(Date, "yy") & Format(Date, "mm") & Right(Str(Val(Right(c!nopinjam, 3)) + 1001), 3)
- End If
- noa.SetFocus
- End Sub
- Private Sub csave_Click()
- simpankedetailpinjam = "insert into detail_pinjam values('" & np.Text & "','" & kb.Text & "','" & jd.Text & "','" & tglbatas.Text & "')"
- Set d = a.Execute(simpankedetailpinjam, , adCmdText)
- simpankepinjam = "insert into pinjam values('" & np.Text & "','" & lbltanggal.Caption & "','" & jp.Text & "','" & noa.Text & "')"
- Set c = a.Execute(simpankepinjam, , adCmdText)
- Set Grid1.DataSource = c
- End Sub
- Private Sub Form_Activate()
- Call koneksi
- tampilgrid = "select *from pinjam"
- 'Set c = a.Execute(tampilgrid, , adCmdText)
- 'Set Grid1.DataSource = c
- Call bersih
- csave.Enabled = False
- cinput.Enabled = False
- ccancel.Enabled = False
- lbltanggal.Caption = Format(Date, "yy-mm-dd")
- End Sub
- Private Sub kb_Click()
- If kb.Text = "001" Then
- jd.Text = "pudarnya pesona cleopatra"
- ElseIf kb.Text = "002" Then
- jd.Text = "berteduh di taman hati"
- Else
- jd.Text = "sarah rasmul bayan tarbiyah"
- End If
- cinput.Enabled = True
- csave.Enabled = True
- ccancel.Enabled = True
- End Sub
- Private Sub noa_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then
- carinamaanggota = "select *from anggota where no_agt='" & noa.Text & "'"
- Set b = a.Execute(carinamaanggota, , adCmdText)
- If b.BOF And b.EOF Then
- MsgBox "Kode Anggota Tidak ada ", , "Info"
- Else
- naa.Text = b!nama
- End If
- End If
- End Sub
Download disini :
maah bisa minta form ya gk....mash bingungnh tata letakya....
BalasHapusitu di akhir artikel ada link download nya tuh mas :)
Hapus