Comparing Dates in an IIf expression

G

Guest

So I need a calculated field in a query that looks at two dates and depending
on which is later, returns a value of either 0 or the value in another field.

Here's what I have:

Expr2: If([LEASE_START]>DateAdd("m",-11,[
Forms![Month-Year]![Text6]),0,[ABOVE_Line])

LEASE_START and ABOVE_Line are fields in my query.

When I try to run the query I get a "COMP_SALES is not a valid name" error.


Any hints?
 
R

Rick B

I do not see "COMP_SALES" anywhere in your statement.

This error is coming from someplace other than the statement you shared with
us.

We can only diagnose what you share with us.

Did you define a parameter, or enter some criteria with "COMP_SALES" in it?
 
G

Guest

COMP_SALES is the name of the query. The query works fine when I don't
include the field with the expression below.

Rick B said:
I do not see "COMP_SALES" anywhere in your statement.

This error is coming from someplace other than the statement you shared with
us.

We can only diagnose what you share with us.

Did you define a parameter, or enter some criteria with "COMP_SALES" in it?

--
Rick B



Elizabeth- MDC said:
So I need a calculated field in a query that looks at two dates and
depending
on which is later, returns a value of either 0 or the value in another
field.

Here's what I have:

Expr2: If([LEASE_START]>DateAdd("m",-11,[
Forms![Month-Year]![Text6]),0,[ABOVE_Line])

LEASE_START and ABOVE_Line are fields in my query.

When I try to run the query I get a "COMP_SALES is not a valid name"
error.


Any hints?
 

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