
Private Sub Command1_Click()
A = InputBox("Ketik Id.Anggota baru : ", "Periksa Id.Baru")
If A = Empty Then Exit Sub
Adodc1.Recordset.Find "IdAnggota='" & A & "'", , adSearchForward, 1
If Not Adodc1.Recordset.EOF Then
MsgBox "Rekord anggota sudah ada !", vbOKOnly, "Periksa Id.Baru"
Form3.Adodc1.RecordSource = "Select * from Pinjaman where IdAnggota='" & A & "'"
' Adodc3.Refresh
Form3.DataGrid1.Refresh
Exit Sub
End If
Adodc1.Recordset.AddNew
Text1.Text = A
Form3.Adodc1.RecordSource = "Select * from Pinjaman where IdAnggota='" & A & "'"
'Adodc3.Refresh
Form3.DataGrid1.Refresh
Text2.SetFocus
End Sub
Private Sub Command2_Click()
Adodc1.Recordset.UpdateBatch
End Sub
Private Sub Command3_Click()
hapus = MsgBox("Apakah anda yakin akan menghapus rekord ini ?", vbYesNo + vbDefaultButton2, "Hapus Rekord")
If hapus = vbYes Then
On Error Resume Next
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
End Sub
Private Sub Command1_Click()
B = InputBox("Ketik Id.Buku baru : ", "Periksa Id.Baru")
If B = Empty Then Exit Sub
Adodc1.Recordset.Find "IdBuku='" & B & "'", , adSearchForward, 1
If Not Adodc1.Recordset.EOF Then
MsgBox "Rekord anggota sudah ada !", vbOKOnly, "Periksa Id.Baru"
Form3.Adodc1.RecordSource = "Select * from Pinjaman where IdBuku='" & B & "'"
' Adodc3.Refresh
Form3.DataGrid1.Refresh
Exit Sub
End If
Adodc1.Recordset.AddNew
Text1.Text = B
Form3.Adodc1.RecordSource = "Select * from Pinjaman where IdBuku='" & B & "'"
'Adodc3.Refresh
Form3.DataGrid1.Refresh
Text2.SetFocus
End Sub
Private Sub Command2_Click()
Adodc1.Recordset.UpdateBatch
End Sub
Private Sub Command3_Click()
hapus = MsgBox("Apakah anda yakin akan menghapus rekord ini ?", vbYesNo + vbDefaultButton2, "Hapus Rekord")
If hapus = vbYes Then
On Error Resume Next
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
End If
End Sub
Private Sub Command1_Click()
C = InputBox("Ketik id.Anggota : ", "Cari id.Anggota")
D = InputBox("Ketik id.Buku : ", "Cari id.Buku")
If C = Empty And D = Empty Then Exit Sub
Form1.Adodc1.Recordset.Find "IdAnggota='" & C & "'", , adSearchForward, 1
Form2.Adodc1.Recordset.Find "IdBuku='" & D & "'", , adSearchForward, 1
If Form1.Adodc1.Recordset.EOF And Form2.Adodc1.Recordset.EOF Then
MsgBox "Rekord anggota belum ada !", vbOKOnly, "Cari id"
Exit Sub
End If
Form1.Adodc1.Recordset.Update
Form2.Adodc1.Recordset.Update
Text1.Text = C
Form3.Adodc1.RecordSource = "Select * from Pinjaman where IdAnggota='" & C & "'"
Text2.Text = Form1.Adodc1.Recordset!NamaAnggota
Text3.Text = D
Form3.Adodc1.RecordSource = "Select * from Pinjaman where IdBuku='" & D & "'"
Text4.Text = Form2.Adodc1.Recordset!JudulBuku
Text5.Text = Date
Text6.Text = Date + 7
'Adodc3.Refresh
'DataGrid1.Refresh
'Text10.SetFocus
End Sub
Private Sub Command2_Click()
Adodc1.Recordset.UpdateBatch
Adodc1.Recordset.AddNew
End Sub
Private Sub Command3_Click()
hapus = MsgBox("Apakah anda yakin akan menghapus rekord ini ?", vbYesNo + vbDefaultButton2, "Hapus Rekord")
If hapus = vbYes Then
On Error Resume Next
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
End If
End Sub
Private Sub Form_Load()
Adodc1.Recordset.AddNew
End Sub


Tidak ada komentar:
Posting Komentar