Expression that shows record depending on date

  • Thread starter Thread starter Nick Mirro
  • Start date Start date
N

Nick Mirro

Hello. In a query I have 4 fields: A B C and D

A Currency
B Currency
C "Needed expression"
D DateField

I would like field C to display A if datefield D is (before) 8/1/3
I would like field C to display B is datefield D is (on or after) 8/1/3

May I ask how I could code this as query field C's expression? Thanks.

Nick
 
SELECT IIF(FieldD < #8/1/03#, FieldA, FieldB) as ShowValue
FROM TableName

If you are using the query grid then a field cell put

Field: ShowValue:IIF(FieldD < #8/1/03#, FieldA, FieldB)
 
Thanks for your help with this. I'm getting an "invalid syntax" error with
IIF highlighted.

Total_Payed: ShowValue:IIF(DateOfVisit < #8/1/03#, Total_Payed_OLD,
Total_Payed_NEW)

Have I done this correctly?

Nick
 
oops.. heh heh. Scratch that.

Nick


Nick Mirro said:
Thanks for your help with this. I'm getting an "invalid syntax" error with
IIF highlighted.

Total_Payed: ShowValue:IIF(DateOfVisit < #8/1/03#, Total_Payed_OLD,
Total_Payed_NEW)

Have I done this correctly?

Nick
 
Back
Top