Adding date parameters to expression

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!
 
S

Steve Schapel

Denise,

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

fredg

=[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],"")
 
G

Guest

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.
.
 
G

Guest

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!
.
 
S

Steve Schapel

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.
 
F

fredg

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top