 |
| Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

January 29th, 2012, 11:52 AM
|
|
Registered User
|
|
Join Date: Jan 2012
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How to calculate 1 month before the expiry date
Good day,
I have a Table Which have 4 Columns.
Table Name- Personnel Details
Fields- Name, Position, Commence Date and Expiry Date.
What I want to make is before 1 month date for expiration which is based on Expiry Date there will be notice or pop up message "To be renew". I don't know how to calculate the date. Thanks..
|
|

January 29th, 2012, 03:49 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2010
Posts: 245
Thanks: 5
Thanked 24 Times in 23 Posts
|
|
Quote:
Originally Posted by nicole05
Good day,
I have a Table Which have 4 Columns.
Table Name- Personnel Details
Fields- Name, Position, Commence Date and Expiry Date.
What I want to make is before 1 month date for expiration which is based on Expiry Date there will be notice or pop up message "To be renew". I don't know how to calculate the date. Thanks..
|
TIP 1: Name and Position should not be sued as field names. They are reserved words and will cause issue.
TIP 2: Don't use spaces in Field or Object Names
To get the computer's current data use Date()
Check out the DateAdd() function.
To test if the Expiry Date is within a month in the future of today's date try:
Code:
[Expiry Date]) <= DateAdd(+1,"m", Date())
__________________
Boyd Trimmell aka HiTechCoach (.com)
Microsoft Access MVP Alumni 2010-2015
Last edited by HiTechCoach; January 30th, 2012 at 09:37 PM..
|
|

January 30th, 2012, 02:55 AM
|
|
Registered User
|
|
Join Date: Jan 2012
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sir Thanks for the reply. I changed the fields which have spaces.
Where i can bound this code?
[Expiry Date]) <= DateAdd(+1,"m", Date())
This is what i want to do
I added one more field which is "Remarks" to populate the notice or pop up message "To be renew". I want that before 1 month date on "Expiry Date" there will be some message on the "Remarks" field which is "To be renew".Is there a way for me to format a field so that the Expiry Date that I enter can flag me 30days before a renewal expires and then another flag when it expires. Any help would be appreciated.
|
|

January 30th, 2012, 03:33 AM
|
|
Registered User
|
|
Join Date: Jan 2012
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Some Addition: a warning calculated EXACTLY 30 days before the expiration, then I MUST ensure that the database runs the expiration warning code at least once every day, including Saturdays and Sundays.
A method which flags expirations WITHIN 30 days would ensure that, if i miss a day, i'll still see the warning.
|
|

January 30th, 2012, 11:34 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2010
Posts: 245
Thanks: 5
Thanked 24 Times in 23 Posts
|
|
Quote:
Originally Posted by nicole05
Some Addition: a warning calculated EXACTLY 30 days before the expiration, then I MUST ensure that the database runs the expiration warning code at least once every day, including Saturdays and Sundays.
A method which flags expirations WITHIN 30 days would ensure that, if i miss a day, i'll still see the warning.
|
Using [Expiry Date]) <= DateAdd(+1,"m", Date()) does not mean EXACTLY 30 days. the <= is everything within a month span or between today and the same day next month.
__________________
Boyd Trimmell aka HiTechCoach (.com)
Microsoft Access MVP Alumni 2010-2015
|
|

January 30th, 2012, 11:35 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2010
Posts: 245
Thanks: 5
Thanked 24 Times in 23 Posts
|
|
This example may help: Reminders
__________________
Boyd Trimmell aka HiTechCoach (.com)
Microsoft Access MVP Alumni 2010-2015
|
|

February 1st, 2012, 12:31 PM
|
|
Registered User
|
|
Join Date: Jan 2012
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Good day,
Sir i used this code on my query:
Remark: [ExpiredDate]<=DateAdd(+1,"m",Date())
But it's error "Data type mismatch in criteria expression"
I tried also this code:
Remarks: IIf(Date() >= [ExpiredDate â expires in one month],"Expired","Unexpired")
This will return 'Expired' if true, 'Unexpired' if false.
But it has error too "Enter Parameter value of ExpiredDate â expires in one month
Sir can you please help me on this issue. I was really new in this program.Thank you very much
|
|
 |