0% found this document useful (0 votes)
26 views

Dim DB As ADODB - Connection Dim rs1 As ADODB - Recordset Dim rs2 As ADODB - Recordset Dim rs3 As ADODB - Recordset

This document contains code for managing a library database using recordsets. It includes procedures for returning a book, checking for fines, loading recordsets from database tables, and populating text boxes with member and book details based on inputs. When a book is returned, the number of books in the recordset is incremented and updated. To check for fines, the return date is compared to the current date and a message box is shown with the result.

Uploaded by

nishamusbanu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Dim DB As ADODB - Connection Dim rs1 As ADODB - Recordset Dim rs2 As ADODB - Recordset Dim rs3 As ADODB - Recordset

This document contains code for managing a library database using recordsets. It includes procedures for returning a book, checking for fines, loading recordsets from database tables, and populating text boxes with member and book details based on inputs. When a book is returned, the number of books in the recordset is incremented and updated. To check for fines, the return date is compared to the current date and a message box is shown with the result.

Uploaded by

nishamusbanu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Dim db As ADODB.

Connection

Dim rs1 As ADODB.Recordset

Dim rs2 As ADODB.Recordset

Dim rs3 As ADODB.Recordset

Private Sub Command1_Click()

Dim n As Integer

rs1.MoveFirst

While rs1.EOF = False

If rs1("bnum") = Val(Text4.Text) Then

'rs1.EditMode
n = rs1("noofbooks")

rs1("noofbooks") = n + 1

rs1.Update

MsgBox "book returned sucessfully"

End If

rs1.MoveNext

Wend

End Sub

Private Sub Command2_Click()

rs3.MoveFirst

While rs3.EOF = False

If rs3("memberid") = Val(Text1.Text) And rs3("mname") = Text2.Text And rs3("booknum") =


Val(Text3.Text) And rs3("bname") = Text4.Text And rs3("returndate") > Text5.Text Then

MsgBox "no fine"

On Error GoTo err1

End If

rs3.MoveNext

Wend

err1:

MsgBox "fine"

End Sub

Private Sub Form_Load()

Set db = New ADODB.Connection


db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\mehar\lib\lib\libdb1.mdb;Persist Security
Info=False"

Set rs1 = New ADODB.Recordset

rs1.CursorLocation = adUseClient

rs1.Open "select * from bookdetails", db, adOpenDynamic, adLockOptimistic

Set rs2 = New ADODB.Recordset

rs2.Open "select * from lib", db, adOpenDynamic, adLockOptimistic

Set rs3 = New ADODB.Recordset

rs3.Open "select * from issue", db, adOpenDynamic, adLockOptimistic

End Sub

Private Sub Text2_Click()

rs3.MoveFirst

While rs3.EOF = False

If rs3("memberid") = Val(Text1.Text) Then

Text2.Text = rs3("mname")

End If

rs3.MoveNext

Wend

End Sub

Private Sub Text4_Click()

rs3.MoveFirst

While rs3.EOF = False

If rs3("memberid") = Val(Text1.Text) And rs3("booknum") = Text3.Text Then

Text4.Text = rs3("bname")
End If

rs3.MoveNext

Wend

End Sub

Private Sub Text5_Click()

Text5.Text = DateValue(Now)

End Sub

You might also like