DateAdd difficulties

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sravanbakhsh@gmail.com

    #1

    DateAdd difficulties

    Hello All,

    I am trying to compare an expiration date that I store against today's
    date plus 4 years. If the expiration date is greater (farther out)
    then today's date + 4 years then I want to use today+4 versus the
    actual expiration date, otherwise the expiration date will be used.
    Any help would be appreciated.

    -----------

    ExpYr: IIf(DatePart("y yyy",[tblSecurity].
    [ExpDate])>Format(DateAd d("yyyy",4,Now( )),"mm/dd/
    yyyy"),Format(D ateAdd("yyyy",4 ,Now()),"mm/dd/yyyy"),DatePart ("yyyy",
    [tblSecurity].[ExpDate]))

  • paii, Ron

    #2
    Re: DateAdd difficulties

    ExpYr:datevalue (iif(datediff(" d",dateadd("yyy y",4,now),[tblSecurity].[ExpDat
    e])<0,dateadd("yy yy",4,now),[tblSecurity].[ExpDate]))

    <sravanbakhsh@g mail.comwrote in message
    news:1185552866 .301746.266620@ i38g2000prf.goo glegroups.com.. .
    Hello All,
    >
    I am trying to compare an expiration date that I store against today's
    date plus 4 years. If the expiration date is greater (farther out)
    then today's date + 4 years then I want to use today+4 versus the
    actual expiration date, otherwise the expiration date will be used.
    Any help would be appreciated.
    >
    -----------
    >
    ExpYr: IIf(DatePart("y yyy",[tblSecurity].
    [ExpDate])>Format(DateAd d("yyyy",4,Now( )),"mm/dd/
    yyyy"),Format(D ateAdd("yyyy",4 ,Now()),"mm/dd/yyyy"),DatePart ("yyyy",
    [tblSecurity].[ExpDate]))
    >

    Comment

    Working...