[AccessD] Date function for adding year based on current monthandyear

dmcafee at pacbell.net dmcafee at pacbell.net
Wed Mar 16 12:05:01 CST 2005


This reminds me of my boss at my last job: "I need a report for the last 12
months...February 1st, 2004 to Feb 28th 2005" "Uh, sir...that's 13 months"
:)

Anyway, are these just text boxes that a user is entering the both dates
into, or are these fixed dates or a combination of the two?

Can you automatically calculate the EndDate in the Start Date after event
and fill it in for the user?
such as:

IF NOT ISNULL(me.txtStartDate)
	Me.txtEndDate = IIF(MONTH(me.txtStartDate)=5, CDATE("06/30/"
&(YEAR(me.txtStartDate)+1)),CDATE("06/30/" & YEAR(me.txtStartDate)) )
END IF


Or if you need do this in a query instead, simply take the IIF statement
from above and place it in the query as the end date criteria.

I formatted my date for US, you may have to change it around for use in
Australia.

I had to do something similar for my wife who originally asked to calculate
a patients 90 day return date which changed to the Tuesday closest to the 90
(but not before). Then a new exception came up, if it is the 3rd Tuesday in
the month, make that return date become a Thursday :S

Dates are fun, because they always need to be modified to fit some weird
requirement.

HTH
David

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
connie.kamrowski at agric.nsw.gov.au
Sent: Wednesday, 16 March 2005 11:34 AM
To: accessd at databaseadvisors.com
Subject: [AccessD] Date function for adding year based on current month
andyear

Hi all,

I have been virtually trouble free for a while but as usual I have been
asked to do something I am not sure how to go about it. can
someone please point me in the right direction.

I have a form with a start and an End date on it. I need to restrict the end
date in the following way.

End Date -- should only accept the following 30th June except where start
date is in May (and then it should only accept the second
30th June from the start date).

Any suggestions appreciated including telling me where to RTFM.

Connie Kamrowski

Analyst/Programmer
Information Technology
NSW Department of Primary Industries
Orange




More information about the AccessD mailing list