View Full Version : Unexpected results from IIF statement


KristenCarr
04-12-2002, 10:56 AM
I'm using the following IIF statment in an Update query. The idea is to compare 2 dates (short date) in one table and insert a value into a third column in that same table.

It is not giving me errors but is inserting all 'C' values. The table only has 27 rows in it right now so I can easily see the results are incorrect.

IIf(([tblExportOfficeTEST]![date_added]>=[tblExportOfficeTEST]![last_updated]),"C","A")

I've tried the statement w/o the table names and that didn't help. I've used other statments and haven't ever had a problem, could it be related to these fields being DATE types?

David R
04-12-2002, 11:03 AM
If you can calculate this with an Iif statement (provided you get it working correctly, of course), why are you storing it in the table?

KristenCarr
04-12-2002, 11:08 AM
UGH...thought you had an answer.

If one date is greater I'm inserting a 'C', if the other is greater I'm inserting an 'A'. The table will then be sent to another organization for their use. The problem is they don't require the same data/values as we already store.

Now...please help me!!! http://www.access-programmers.co.uk/ubb/smile.gif

Rich
04-12-2002, 11:45 AM
Why cant you use a query then send them that?

KristenCarr
04-12-2002, 11:54 AM
I'm exporting to a fixed width file AND a SELECT statement doesn't work either. Please, please help!!!

Pat Hartman
04-12-2002, 07:49 PM
1. Are the date fields actually defined as date/time data type?
2. Do the dates also include a time component?