From: golfinray on 26 Feb 2010 11:44 I can't quite figure out the syntax of what I need. I need IIF([date field]<= "12/31/2012), "2011-2012","2012-2013") I think it can be done with dateserial but I can't get it to work. -- Milton Purdy ACCESS State of Arkansas
From: Ken Snell on 26 Feb 2010 11:54 IIf([datefield] <= DateSerial(2012,12,31),"2011-2012","2012-2013") The above assumes that [datefield] is a DateTime datatype. -- Ken Snell http://www.accessmvp.com/KDSnell/ "golfinray" <golfinray(a)discussions.microsoft.com> wrote in message news:6009504E-DA9F-4780-B348-6E4528E4DC8B(a)microsoft.com... >I can't quite figure out the syntax of what I need. I need IIF([date >field]<= > "12/31/2012), "2011-2012","2012-2013") I think it can be done with > dateserial > but I can't get it to work. > -- > Milton Purdy > ACCESS > State of Arkansas
From: fredg on 26 Feb 2010 12:22 On Fri, 26 Feb 2010 08:44:07 -0800, golfinray wrote: > I can't quite figure out the syntax of what I need. I need IIF([date field]<= > "12/31/2012), "2011-2012","2012-2013") I think it can be done with dateserial > but I can't get it to work. You need to wrap the date criteria within the date delimiter symbol #. As written, Access is looking for a string "12/31/2012". And you don't need DateSerial. IIf([DateField] <= #12/31/2012#,"2011-2012","2012-2013") You could also use: IIf Year([DateField])<= 2012, 2011-2012,2012-2013) The above both assume [DateField] is a Date/Time datatype field. -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail
From: golfinray on 26 Feb 2010 13:24 Thanks, guys, worked like a charm! -- Milton Purdy ACCESS State of Arkansas "Ken Snell" wrote: > IIf([datefield] <= DateSerial(2012,12,31),"2011-2012","2012-2013") > > The above assumes that [datefield] is a DateTime datatype. > > -- > > Ken Snell > http://www.accessmvp.com/KDSnell/ > > > "golfinray" <golfinray(a)discussions.microsoft.com> wrote in message > news:6009504E-DA9F-4780-B348-6E4528E4DC8B(a)microsoft.com... > >I can't quite figure out the syntax of what I need. I need IIF([date > >field]<= > > "12/31/2012), "2011-2012","2012-2013") I think it can be done with > > dateserial > > but I can't get it to work. > > -- > > Milton Purdy > > ACCESS > > State of Arkansas > > > . >
|
Pages: 1 Prev: Form Search Parameters Next: new to access - please forgive ignorance |