PC Review


Reply
Thread Tools Rate Thread

Calculating dates dates in the future

 
 
Tony Williams
Guest
Posts: n/a
 
      1st Oct 2003
I have a form that has a control DateDestroytxt and a control DocTypetxt. I
want the DateDestroytxt date to be a number of months in the future which
are dependent upon the type of document in Doctypetxt eg if doctypetxt is a
letter the dateDestroytxt date should be 6 months after today. I know I can
use the DateAdd function but how do I add months and make it dependent on
the Doctypetxt control?
TIA
Tony



 
Reply With Quote
 
 
 
 
John Vinson
Guest
Posts: n/a
 
      1st Oct 2003
On Wed, 1 Oct 2003 14:09:21 +0000 (UTC), "Tony Williams" <(E-Mail Removed)>
wrote:

>I have a form that has a control DateDestroytxt and a control DocTypetxt. I
>want the DateDestroytxt date to be a number of months in the future which
>are dependent upon the type of document in Doctypetxt eg if doctypetxt is a
>letter the dateDestroytxt date should be 6 months after today. I know I can
>use the DateAdd function but how do I add months and make it dependent on
>the Doctypetxt control?
>TIA
>Tony
>
>


Just reference the Doctypetxt control in your call to DateAdd:

DateAdd("m", Choose([Doctypetxt] = "Letter", 6, [Doctypetxt] = "Memo",
1, ...), Date())

You may want instead to create a Retention table with document types
and the retention period for that document type, or add a retention
period field to the table of document types. You could then simply
look up the retention using DLookUp.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
 
Reply With Quote
 
Fredg
Guest
Posts: n/a
 
      1st Oct 2003
Tony,
How many choices?
If just a few:
=IIf([DocTypext] = "letter",DateAdd("m",6,Date()),IIf([DocTypetxt] =
"What?",DateAdd("m",12,Date()),DateAdd("m",24,Date()))

6 months, 12 months, or 24 months will be added to the current date.

If you have many more choices, make a User Defined function in a module, and
refer to it in the control's control source:
=YourFunction([DocTypetxt])

Your Function can then utilize a more complex If..Then .. Else,
or a Select Case statement to return the future date to the control.
See Access help on how to write them.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


"Tony Williams" <(E-Mail Removed)> wrote in message
news:blen6h$seo$(E-Mail Removed)...
> I have a form that has a control DateDestroytxt and a control DocTypetxt.

I
> want the DateDestroytxt date to be a number of months in the future which
> are dependent upon the type of document in Doctypetxt eg if doctypetxt is

a
> letter the dateDestroytxt date should be 6 months after today. I know I

can
> use the DateAdd function but how do I add months and make it dependent on
> the Doctypetxt control?
> TIA
> Tony
>
>
>



 
Reply With Quote
 
Tony Williams
Guest
Posts: n/a
 
      2nd Oct 2003
Thanks John given me ideas
Tony
"John Vinson" <jvinson@STOP_SPAM.WysardOfInfo.com> wrote in message
news(E-Mail Removed)...
> On Wed, 1 Oct 2003 14:09:21 +0000 (UTC), "Tony Williams" <(E-Mail Removed)>
> wrote:
>
> >I have a form that has a control DateDestroytxt and a control DocTypetxt.

I
> >want the DateDestroytxt date to be a number of months in the future which
> >are dependent upon the type of document in Doctypetxt eg if doctypetxt is

a
> >letter the dateDestroytxt date should be 6 months after today. I know I

can
> >use the DateAdd function but how do I add months and make it dependent on
> >the Doctypetxt control?
> >TIA
> >Tony
> >
> >

>
> Just reference the Doctypetxt control in your call to DateAdd:
>
> DateAdd("m", Choose([Doctypetxt] = "Letter", 6, [Doctypetxt] = "Memo",
> 1, ...), Date())
>
> You may want instead to create a Retention table with document types
> and the retention period for that document type, or add a retention
> period field to the table of document types. You could then simply
> look up the retention using DLookUp.
>
> John W. Vinson[MVP]
> Come for live chats every Tuesday and Thursday
> http://go.compuserve.com/msdevapps?loc=us&access=public



 
Reply With Quote
 
Tony Williams
Guest
Posts: n/a
 
      2nd Oct 2003
Thanks Fred the first option looks within my capabilities, I'd need more
guidance on the second although it looks better
Tony
"Fredg" <(E-Mail Removed)> wrote in message
news:0CEeb.166015$(E-Mail Removed)...
> Tony,
> How many choices?
> If just a few:
> =IIf([DocTypext] = "letter",DateAdd("m",6,Date()),IIf([DocTypetxt] =
> "What?",DateAdd("m",12,Date()),DateAdd("m",24,Date()))
>
> 6 months, 12 months, or 24 months will be added to the current date.
>
> If you have many more choices, make a User Defined function in a module,

and
> refer to it in the control's control source:
> =YourFunction([DocTypetxt])
>
> Your Function can then utilize a more complex If..Then .. Else,
> or a Select Case statement to return the future date to the control.
> See Access help on how to write them.
> --
> Fred
>
> Please reply only to this newsgroup.
> I do not reply to personal e-mail.
>
>
> "Tony Williams" <(E-Mail Removed)> wrote in message
> news:blen6h$seo$(E-Mail Removed)...
> > I have a form that has a control DateDestroytxt and a control

DocTypetxt.
> I
> > want the DateDestroytxt date to be a number of months in the future

which
> > are dependent upon the type of document in Doctypetxt eg if doctypetxt

is
> a
> > letter the dateDestroytxt date should be 6 months after today. I know I

> can
> > use the DateAdd function but how do I add months and make it dependent

on
> > the Doctypetxt control?
> > TIA
> > Tony
> >
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculating future dates using WORKDAY & specific requirements seltzer Microsoft Excel Worksheet Functions 7 23rd Oct 2008 03:26 PM
Formula for shift schedule & calculating future dates - 2003 paankadu Microsoft Excel Misc 0 11th Jun 2008 02:53 AM
Calculating number of weeks between dates (start and end dates) =?Utf-8?B?R2VyYWxkIExlbWF5?= Microsoft Excel Discussion 1 28th Mar 2007 01:13 PM
Calculating future dates in Access =?Utf-8?B?Uy4gUm9iZXJ0cw==?= Microsoft Access Getting Started 3 18th Jan 2004 03:17 AM
Calculating dates - Need to calculate years and months between source dates. jmw748 Microsoft Access Queries 2 7th Jan 2004 12:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:48 AM.