Adding date parameters to expression

  • Thread starter Thread starter Denise
  • Start date Start date
D

Denise

=[PurchasePrice]/[DepreciableLife]

I want to qualify this so that it will only calucalate the
formula if the Date Acquired is June of the current year
or later.

IIF(Date([DateAcquired])>??? Help! I've only been using
Access for 2 days

Thanks!
 
Denise,

Try it like this...
=IIf([DateAcquired]>DateSerial(Year(Date()),6,0),[PurchasePrice]/[DepreciableLife],0)
 
=[PurchasePrice]/[DepreciableLife]

I want to qualify this so that it will only calucalate the
formula if the Date Acquired is June of the current year
or later.

IIF(Date([DateAcquired])>??? Help! I've only been using
Access for 2 days

Thanks!

Does this help?


=IIf([DateAquired]>=DateSerial(Year(Date()),6,1),[PurchasePrice]/[DepreciableLife],"")
 
Thank you again Fred - this is what I worked out prior to
receiving your reply:

=Sum(IIf(Month([DateAcquired])>6,[PurchasePrice]/
[DepreciableLife],0))

But this only calculates the depreciation if it's in July
or later and I needed June

Thanks again!
-----Original Message-----
=[PurchasePrice]/[DepreciableLife]

I want to qualify this so that it will only calucalate the
formula if the Date Acquired is June of the current year
or later.

IIF(Date([DateAcquired])>??? Help! I've only been using
Access for 2 days

Thanks!

Does this help?


=IIf([DateAquired]>=DateSerial(Year(Date()),6,1), [PurchasePrice]/[DepreciableLife],"")

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.
 
Thanks but it gives me a Name? error. I worked this out
and it seems to be working:

=Sum(IIf(Month([DateAcquired])>5,[PurchasePrice]/
[DepreciableLife],0))
-----Original Message-----
Denise,

Try it like this...
=IIf([DateAcquired]>DateSerial(Year(Date()),6,0), [PurchasePrice]/[DepreciableLife],0)

--
Steve Schapel, Microsoft Access MVP

=[PurchasePrice]/[DepreciableLife]

I want to qualify this so that it will only calucalate the
formula if the Date Acquired is June of the current year
or later.

IIF(Date([DateAcquired])>??? Help! I've only been using
Access for 2 days

Thanks!
.
 
Denise,

The most likely cause of the #Name? is a spelling error when you typed
the expression.

The advantage of doing it the way I suggested, as against yours, is that
yours will also include data from June onwards from previous years,
whereas your original post said current year only.
 
Thank you again Fred - this is what I worked out prior to
receiving your reply:

=Sum(IIf(Month([DateAcquired])>6,[PurchasePrice]/
[DepreciableLife],0))

But this only calculates the depreciation if it's in July
or later and I needed June

Thanks again!
-----Original Message-----
=[PurchasePrice]/[DepreciableLife]

I want to qualify this so that it will only calucalate the
formula if the Date Acquired is June of the current year
or later.

IIF(Date([DateAcquired])>??? Help! I've only been using
Access for 2 days

Thanks!

Does this help?


=IIf([DateAquired]>=DateSerial(Year(Date()),6,1), [PurchasePrice]/[DepreciableLife],"")

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.

Did i miss something here?
The expression I suggested was:

=IIf([DateAquired]>=DateSerial(Year(Date()),6,1),[PurchasePrice]/[DepreciableLife],"")

which will return all records from June 1st of the current year.
Isn't that what you wanted?

The expression you used will return records of all the years (1999,
2000, etc.) in the table that are July - December.
That's not what you asked for.
 
Back
Top