Private Sub Text4_Change()
End Sub
Private Sub Form_Load()
xtgl = Format(Date, "DD/MM/YYYY")
Adodc1.RecordSource = "Select count(*) as JmlRec from pinjam"
Adodc1.Refresh
pj = Len(Trim(Str(Adodc1.Recordset!JmlRec)))
xno = "PJ" + Left("000", 4 - pj) + Trim(Str(Adodc1.Recordset!JmlRec + 1))
Adodc2.RecordSource = "select * from tmppinjam"
Adodc2.Refresh
Do While Not Adodc2.Recordset.EOF
Adodc2.Recordset.Delete
Adodc2.Recordset.MoveNext
Loop
xsimpan.Enabled = False
End Sub
Private Sub Label2_Click()
End Sub
Private Sub xexit_Click()
Unload Me
End Sub
Private Sub xKode_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Adodc4.RecordSource = "select * from Buku where kode_buku = '" & xKode & "'"
Adodc4.Refresh
If Adodc4.Recordset.RecordCount > 0 Then
xJudul = Adodc4.Recordset!judul
xtambah.SetFocus
Else
MsgBox " Kode Buku Takterdaftar"
xKode = ""
End If
End If
End Sub
Private Sub xnim_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Adodc3.RecordSource = "Select * From MHS where Nim ='" & xnim & "'"
Adodc3.Refresh
Adodc1.RecordSource = "Select * from Pinjam where Status = '" & 1 & "' "
Adodc1.Refresh
If Adodc3.Recordset.RecordCount = 0 Then
MsgBox "Mahasiswa Belum Mendaftar"
ElseIf Adodc1.Recordset.RecordCount > 0 Then
MsgBox " Mahasiswa masih Belum ngembalikan buku"
xnim = ""
xnim.SetFocus
Else
xnama = Adodc3.Recordset!Nama
xKode.SetFocus
End If
If Adodc1.Recordset.RecordCount > 0 Then
MsgBox " Mahasiswa masih Belum ngembalikan buku"
End If
End If
End Sub
Private Sub xsimpan_Click()
Adodc1.RecordSource = "Select * from Pinjam"
Adodc1.Refresh
Adodc2.RecordSource = "Select * from tmppinjam"
Adodc2.Refresh
Adodc1.Recordset.AddNew
Adodc1.Recordset!No_trans = xno
Adodc1.Recordset!Id_petugas = XID
Adodc1.Recordset!Tgl_pinjam = xtgl
' !Kode_buku = xkode
Adodc1.Recordset!Nim = xnim
Adodc1.Recordset!Status = 1
Adodc1.Recordset.Update
Adodc6.RecordSource = "Select * from Detail_pinjam"
Adodc6.Refresh
Do While Not Adodc2.Recordset.EOF
Adodc6.Recordset.AddNew
Adodc6.Recordset!No_trans = Adodc1.Recordset!No_trans
Adodc6.Recordset!KODE_BUKU = Adodc2.Recordset!KODE_BUKU
Adodc6.Recordset.Update
Adodc2.Recordset.MoveNext
Loop
MsgBox "data tersimpan"
Unload Me
Load Me
Show
End Sub
Private Sub xtambah_Click()
Dim a
a = 1
Adodc2.RecordSource = "select * from tmppinjam"
Adodc2.Refresh
With Adodc2.Recordset
.AddNew
!No_trans = xno
!Nama_Petugas = xnmptg
!Nim = xnim
!Nama = xnama
!KODE_BUKU = xKode
!judul = xJudul
.Update
End With
pesan = MsgBox("APAKAH ANDA MAU PINJAM LAGI", vbYesNo + vbExclamation, "PERPUSTAKAAN")
If pesan = vbYes Then
xKode = ""
xJudul = ""
xKode.SetFocus
Else
Adodc2.RecordSource = "Select * from tmppinjam"
Adodc2.Refresh
Do While Not Adodc2.Recordset.EOF
'total = total + Adodc3.Recordset!Jml_Gaji
Adodc2.Recordset.MoveNext
Loop
xsimpan.Enabled = True
xsimpan.SetFocus
End If
End Sub