Projected Date Comparison II

G

Guest

The query field below creates an error: "The expression is typed incorrectly,
or is to complex to be evaluated". The date comparision is killing me. I
can't seem to get it to work. The ExpDateFormatter is a field that formats a
field into mm/dd/yyyy from yyyymmdd and the point of this is to compare the
expiration date to a variable start period . This comparison does not work
at this time.

Please....anybody...help.

Month 2: IIf([ExpDateFormatter]<DateAdd("d",+30,[Last Day of Start
Period]),[qryPBMRateNext.Honor]+[qryPBMRateNext.Discount],[qryPBMRateOrig.Honor]+[qryPBMRateOrig.Discount])
 
M

[MVP] S.Clark

How about using two update queries instead?

One for the first condition, the second for the second?

FWIW, Access doesn't care what format the date is in when it compares it to
another date. So, if ExpDateFormatter is some elaborate calculated field,
it may be adding to the debacle that is this IIF() statement. (Can you tell
I don't like IIF?) :D
 
V

Van T. Dinh

It sounds to me that [ExpDateFormateer] is a String value which is being
compared with a Date value and the comparison may be performed as a String
comparison, NOT a Date comparison.

Try:

Month 2: IIf( CDate([ExpDateFormatter]) <
DateAdd("d",+30,[Last Day of Start Period]),
[qryPBMRateNext.Honor]+[qryPBMRateNext.Discount],
[qryPBMRateOrig.Honor]+[qryPBMRateOrig.Discount] )

(assuming the Short-Date format in your Regional Settings is "mm/dd/yyyy")
 

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

Similar Threads

Third time's a charm? Date query question 7
Date Comparison Query 6
query on date 1
Convert Date 3
Changing date format 2
Date comparison 2
extract part of a text value into a date 2
Cdate funtion inconsistency 4

Top