✔ 最佳答案
Inside a calculated query field, you can use IIF() function
This is the format:
IIF(Condition, True_Result, False_Result)
So you can try this in your query field:
Current Charge:IIF(Datediff("d",[Check-In Date], [Check-Out Date])>0, Datediff("d",[Check-In Date], [Check-Out Date])*[Rate], [Rate])
This will give you your result.
You can reference this link for how to use the functions:
http://www.techonthenet.com/access/functions/date/datediff.php
http://www.techonthenet.com/access/functions/advanced/iif.php
2006-11-21 20:59:28 補充:
Correction:Current Charge:IIF(Datediff("d",[Check-In Date], [Check-Out Date])>0, Datediff("d",[Check-In Date], [Check-Out Date])*[Rate], [Rate])This is all in one line.