Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
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
 
Old January 29th, 2012, 11:52 AM
Registered User
 
Join Date: Jan 2012
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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..
 
Old January 29th, 2012, 03:49 PM
Friend of Wrox
 
Join Date: Sep 2010
Posts: 245
Thanks: 5
Thanked 24 Times in 23 Posts
Default

Quote:
Originally Posted by nicole05 View Post
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..
 
Old January 30th, 2012, 02:55 AM
Registered User
 
Join Date: Jan 2012
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
 
Old January 30th, 2012, 03:33 AM
Registered User
 
Join Date: Jan 2012
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
 
Old January 30th, 2012, 11:34 PM
Friend of Wrox
 
Join Date: Sep 2010
Posts: 245
Thanks: 5
Thanked 24 Times in 23 Posts
Default

Quote:
Originally Posted by nicole05 View Post
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
 
Old January 30th, 2012, 11:35 PM
Friend of Wrox
 
Join Date: Sep 2010
Posts: 245
Thanks: 5
Thanked 24 Times in 23 Posts
Default

This example may help: Reminders
__________________
Boyd Trimmell aka HiTechCoach (.com)
Microsoft Access MVP Alumni 2010-2015
 
Old February 1st, 2012, 12:31 PM
Registered User
 
Join Date: Jan 2012
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add an expiry date to Asp.net Membership cookie? chobo2 ASP.NET 3.5 Basics 6 August 19th, 2009 04:10 PM
Calculate Percentage with Date mateenmohd Access 2 February 4th, 2008 06:26 AM
query Current Month, Month+1, Month+2, Month+3 anterior Access 2 September 24th, 2006 08:25 PM
How to calculate a number of days between 2 date windy417 Pro JSP 1 July 20th, 2006 07:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.