Hi
I'm looking for some help with a query which produces 3 sets of expiry dates (1 month apart) which are all printed on a voucher.
Data is entered into a forum, for example on Monday 17th September, and the query does this:
Adds 21 days to the date entered and returns the last day of the month (in the above case it would return 31 October 2012) "Month1"
Adds 1 month + 21 days (30 November 2012) "Month2"
Adds 2 months + 21 days (31 December 2012) "Month3"
The query below works just fine with the exception of days where the report is generated around + 21 days mark. Let's say we generated the report on 10 September 2012, month 1 would be October, Month 2 would also be October because of the 31 days in September, 30 in October.
Ideally I would like the query to work on Month 1 as it is (date inputed + 21 days, showing end of that month) and then Month 2 to be month after the end of the resulting month end, Month 3 to be the month after that.
- hopefully the script will make this clearer. Sorry if any of this is a little 'clumsy', I have no formal training in access, I just try and work it out...
Thanks for looking
Code:SELECT Data.* UCase(Format(DateSerial(Year([Record Added Date]),Month([Record Added Date]),Day([Record Added Date])+21),"mmmyy")) AS Month1 UCase(Format(DateSerial(Year([Record Added Date]),Month([Record Added Date])+1,Day([Record Added Date])+21),"mmmyy")) AS Month2 UCase(Format(DateSerial(Year([Record Added Date]),Month([Record Added Date])+2,Day([Record Added Date])+21),"mmmyy")) AS Month3 DateSerial(Year([Record Added Date]),Month([Record Added Date]),Day([Record Added Date])+21) AS Month1Hidden Format(DateSerial(Year([Month1Hidden]),Month([Month1Hidden])+1,0),"dd mmmm yyyy") AS FullMonth1 DateSerial(Year([Record Added Date]),Month([Record Added Date])+1,Day([Record Added Date])+21) AS Month2Hidden Format(DateSerial(Year([Month2Hidden]),Month([Month2Hidden])+1,0),"dd mmmm yyyy") AS FullMonth2 DateSerial(Year([Record Added Date]),Month([Record Added Date])+2,Day([Record Added Date])+21) AS Month3Hidden Format(DateSerial(Year([Month3Hidden]),Month([Month3Hidden])+1,0),"dd mmmm yyyy") AS FullMonth3 FROM Data WHERE (((Data.[Request Type])="New Trader") AND ((Data.[Record Added Date])>Date()-[The last how many days?]+1));