Hello all, currently I am developing a Library management Software for my school library as part of my school project. The software is supposed to save records of people that borrow books, those that wish to return, list of books and some other features. Right now the problem I have is this: I want students to return books using the Check In form. Now a record of the students transaction(when he borrowed the book) has been saved in a database which I have connected to.I want to compare the input with the record in database and if it matches the book is returned. However, whenever I want to return the book I get "Run-time error 91, Object variable or With block variable not set." I am using an Access file. I would appreciate any help at all given to me. The code below is for the function Deposit books which is called when I click the check in button Function DepositBooks() Dim Check As Boolean With Form1.Data1 .Refresh Form1.Data1.Recordset.Fields("Name") = Form1.Text1.Text Form1.Data1.Recordset.Fields("Year") = Form1.Text2.Text Form1.Data1.Recordset.Fields("Book Title") = Form1.Text3.Text Form1.Data1.Recordset.Fields("Author") = Form1.Text4.Text Form1.Data1.Recordset.Fields("Lib code") = Form1.Text5.Text Form1.Data1.Recordset.Fields("Date Borrowed") = Form1.Label10.Caption Form1.Data1.Recordset.Fields("Return Date") = Form1.Label9.Caption If .Recordset.Fields("Name") = Form1.Text1.Text Then If .Recordset.Fields("Book Title") = Form1.Text3.Text Then Form1.Data1.Recordset.Fields("Lib code") = "ACC 007" MsgBox "Book Deposited.", vbOKOnly, "Deposited" Check = True Exit Function Else MsgBox "This book was not issued to this student." Exit Function End If Else .Recordset.MoveNext End If End With End Function Thanks for reading.
|