casscar
asked on
Date Automatic Increment
Hi,
I'm working on a database for a book library. I would like to input the Issue Date for a borrowed book and then i would like to have the Due Date (book return date) to be automatically generated as two weeks from the issue date. Can this be done? If yes, how?
I'm working on a database for a book library. I would like to input the Issue Date for a borrowed book and then i would like to have the Due Date (book return date) to be automatically generated as two weeks from the issue date. Can this be done? If yes, how?
DateAdd ("ww", 2, ISSUE_DATE)-1
becuase
for example if you run
issue date equal 01/08/2011
DateAdd ("ww", 2, ISSUE_DATE)
the results will come
15/08/2011
Its wrong becuase of that you need to deduct one day to get correct day
becuase
for example if you run
issue date equal 01/08/2011
DateAdd ("ww", 2, ISSUE_DATE)
the results will come
15/08/2011
Its wrong becuase of that you need to deduct one day to get correct day
ASKER
change format to Date
Don't add a field to the table as you can always calculate the due date:
In a query:
DateDue: DateAdd("d",14",[DateIssue d])
As controlsource for a textbox:
=DateAdd("d",14",[DateIssu ed])
/gustav
In a query:
DateDue: DateAdd("d",14",[DateIssue
As controlsource for a textbox:
=DateAdd("d",14",[DateIssu
/gustav
pratima_mcs,
Kind of ironic that you posted Allen Browne's page on calculated fields, seeing as the main theme of that page is NOT to use calculated fields :)
casscar,
As gustav is suggesting, the way to do this is to have your FORM default to a due date that is 14 days in the future. (I am presuming that, like many library systems, while there may be a default due date, the clerk has an ability to override that due date.)
Patrick
Kind of ironic that you posted Allen Browne's page on calculated fields, seeing as the main theme of that page is NOT to use calculated fields :)
casscar,
As gustav is suggesting, the way to do this is to have your FORM default to a due date that is 14 days in the future. (I am presuming that, like many library systems, while there may be a default due date, the clerk has an ability to override that due date.)
Patrick
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi all,
Have tried all the options but it seems that i'm still doing something wrong. Attached is the database that I'm working with and I was trying to work on the below tasks, which apperently i ended up getting stuck in most of them.
Would appreciate if i can get any help.
In the book lending form
• Book Code to be generated automatically as per table 1 book list, once the book title is selected.
• Due Date to be equal to 2weeks from the date issued (inputted by the user when a book is borrowed)
General Queries:
• To identify any overdue books
• To identify the borrowing history of a specific book
• To identify the borrowing history of a specific employee
One last thing please, I added a new field ‘currently borrowed’ in the book list table; I would like this update to appear in the relative form if possible please.
Hope you can help me
Regards
Have tried all the options but it seems that i'm still doing something wrong. Attached is the database that I'm working with and I was trying to work on the below tasks, which apperently i ended up getting stuck in most of them.
Would appreciate if i can get any help.
In the book lending form
• Book Code to be generated automatically as per table 1 book list, once the book title is selected.
• Due Date to be equal to 2weeks from the date issued (inputted by the user when a book is borrowed)
General Queries:
• To identify any overdue books
• To identify the borrowing history of a specific book
• To identify the borrowing history of a specific employee
One last thing please, I added a new field ‘currently borrowed’ in the book list table; I would like this update to appear in the relative form if possible please.
Hope you can help me
Regards
ASKER
use this codes
Private Sub Date_Issued_AfterUpdate()
Me.[Due Date] = DateAdd("d", 14, Me.[Date Issued])
End Sub
Database-Testing.mdb
Private Sub Date_Issued_AfterUpdate()
Me.[Due Date] = DateAdd("d", 14, Me.[Date Issued])
End Sub
Database-Testing.mdb
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for casscar's comment http:/Q_27243847.html#36333987
for the following reason:
k
Accepted answer: 0 points for casscar's comment http:/Q_27243847.html#36333987
for the following reason:
k
refer
http://office.microsoft.com/en-us/access-help/add-a-calculated-field-to-a-table-HA101820564.aspx
http://allenbrowne.com/casu-14.html
try for date
DateAdd ("ww", 2, ISSUE_DATE)
or
DateAdd ("d", 14, ISSUE_DATE)