Okay so I've been here before and some of you may remember me. It has gotten to the stage now where my library is complete and I only have one tiny problem that I can't for the life of me figure out how to fix, so heres hoping you can:
Okay so the problem occurs when a user wishes to return a book to the library. To return a book the user simply chooses the borrow ID (the primary key) from the drop down in the form and selects return. The script on the return button adds one to the stock of the book, marks the borrow as returned, sets the returned date as the current date, and then compares the due date of the borrowed book with the returned date to calculate if a fee is due. If the book is late the due date is subtracted from the return date to find out how many days i has been late for. An overdue fee of £1 is added to the members account for every day the book is late and if the fee is voer £50 they are banned.
Here is the code:
The problem occurs when a user tries to return a book late. What happens is that the Return Date is added, the stock is added, and the borrow is marked as returned but the overdue fee is not calculated nor added to the member and I get the following error:Code:Private Sub Borrow_IDSelect_Change() 'When user changes the borrow ID field 'Open the form again showing the record with this ID DoCmd.OpenForm "BorrowReturn", , , "[Borrow_ID] = " & Me.Borrow_IDSelect End Sub Private Sub Confirm_Click() 'When the confirm button is clickec On Error GoTo Err_Confirm_Click Dim diff As Variant 'Add one to the number of stock for this book Let Me!Stock = Me!Stock + 1 'Set the return date to the current date Let Me!BorrowReturnedDate = Date 'Mark the borrow as returned Let Me!BorrowStatus = True 'Save the record DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 'Check if the book is overdue If Me!BorrowReturnedDate > Me!Due_Date Then 'Calculate how many days the book is overdue Let diff = Me!BorrowReturnedDate - Me!Due_Date 'Add the over due fee for this borrow to the members ofverall fee Let Me!Overdue_Fee = Me!Overdue_Fee + diff 'Check to see if the members fee is over £50 If Me!Overdue_Fee > 50 Then 'Ban the member Let Me!Member_Active = False End If End If 'Save the record DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 'Close the form DoCmd.Close 'Open the return successfull form DoCmd.OpenForm "ReturnSuccess" Exit_Confirm_Click: Exit Sub Err_Confirm_Click: MsgBox Err.Description Resume Exit_Confirm_Click End Sub
The expression entered has a field, control, or property name that Hunners O Books can't Find
Hunners O Books is my library name.
I can upload the latetst copy of my library if it helps, just ask.
Thanks to anybody who can help.



LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks