Calculating date ranges

Ezzerthegreat

New member
Local time
Today, 22:30
Joined
Jan 31, 2005
Messages
3
I am developing a library loan application but I'm having trouble with the loans table.

The fields in my loan table include Required Return Date, Actual Return Date, Returned (Yes/No) (so I can run queries aginst this table to determine books that are not returned and overdue) and Overdue (Yes/No) (Again so I can use .

I need an expression that calculates whether or not the book is over due based on "Todays" date and the Required Date of Return.

How would automate changing the Returned Field to Yes based on the presence of a date in the Actual Return date. Also how would I change the overdue field to "Yes" if the Actual Return Date was found to be greater than the Required Return Date.
 
Are you trying to do this within a form or within the Query itself?
How are you entering the Actual Returned Date in manually or is there some code the does this for you?
 
Appreciate any help at all....

How would automate changing the Returned Field to Yes based on the presence of a date in the Actual Return date. Also how would I change the overdue field to "Yes" if the Actual Return Date was found to be greater than the Required Return Date.

The returned field is in the table itself.

The actual returned date will be entered manually. Would an update query allow me to change the Returned field to Yes in the Hire table when a date has been entered into this Actual Return Date field.
 
Last edited:
I was just curious, I was going to see how you were doing that if it was automated.
Anyways...

In the form where you are entering in all the date I would create an if statement that would compare todays date vs the due date

Dim Actual as Date
Dim Reqired as Date

Actual = txtActualReturnedDate.Value
Required = txtRequiredReturnedDate.Vale

If Actual > Required then
checkboxOverdue = true
End if

and to see if the book is returned try something like this

If txtReturnedDate.value <> "" then
checkboxReturend = true
End If

Or you could check the length of txtReturnedDate and if it is > 0 the checkboxReturned = true (not sure f the code of the top of my head but I have seen it in forums here).

Hope that helps
 
Thanks

And thank you both for your time and attention. Very much appreciated. Now to try and implement what you have told me.
 

Users who are viewing this thread

Back
Top Bottom