Checkbox IIF statement URGENT HELP PLEASE!!! (1 Viewer)

H2wk1

New member
Local time
Today, 11:15
Joined
Apr 4, 2009
Messages
6
Hi...

I am currently trying to read the checkbox value from a field in a table and do a calculation using the data. If the checkbox is checked then i charge a weekend rate, if it isn;t checked i charge a weekday rate.

IIf(Invoice.HiredOnWeekend=TRUE,SUM(DATEDIFF("d",Invoice.HiringDate,Invoice.ReturnDate)*Equipment.EquipmentPriceWeek),SUM(DATEDIFF("d",Invoice.HiringDate,Invoice.ReturnDate)*Equipment.EquipmentPriceWeek))

I have tried various values for what the checkbox should read but no luck yet. (true,false,0,1,-1, and just the coloum name)

Any help is greatly appreciated.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 09:15
Joined
Jul 9, 2003
Messages
16,404
I would need to see the whole function that this code is in, as I don't quite understand the context.
 

raskew

AWF VIP
Local time
Today, 03:15
Joined
Jun 2, 2001
Messages
2,734
Hi -

For starters, the Iif() statement takes this format:
Iif(Expression, True, False)

The example you provided gives identical values for both the True and False options:
SUM(DATEDIFF("d",Invoice.HiringDate,Invoice.ReturnDate)*Equipment.EquipmentPriceWeek),
SUM(DATEDIFF("d",Invoice.HiringDate,Invoice.ReturnDate)*Equipment.EquipmentPriceWeek))

That may not be the whole problem. Waiting to see the complete code. Added: ...and an explanation of what happens, e.g. error message, etc..

Bob
 
Last edited:

H2wk1

New member
Local time
Today, 11:15
Joined
Apr 4, 2009
Messages
6
Thanks guys. I was being stupid. Must have been the exhaustion. Eveything was right except that the two expressions were exactly the same. Thanks raskew.

All appreciate works like a dream now. :)
 

Users who are viewing this thread

Top Bottom