Access 2010:条件如下:
multiply with 1.5 if:
monday - friday (08:00 - 16:00)
monday - friday (16:00 - 00:00)
satuday - sunday(08:00 - 16:00)
multiply by 2 if:
monday - friday (00:00 - 08:00)
saturday- sunday (16:00 - 00:00)
multiply by 3 if:
saturday - sunday (00:00 - 08:00)
我在表达式生成器中做了一个有趣的长表达式(不要笑,它有效):)
=IIf(([day]="monday" Or [day]="tuesday" Or [day]="wednesday" Or [day]="thursday" Or [day]="friday") And ([time_from]>=TimeValue("08:00") And [time_from]<=TimeValue("23:59") And ([time_until]>=TimeValue("08:00") And [time_until]<=TimeValue("23:59")));([time_until]-[time_from])*1,5;IIf(([day]="saturday" Or [day]="sunday") And ([time_from]>=TimeValue("08:00") And [time_from]<=TimeValue("16:00") And ([time_until]>=TimeValue("08:00") And [time_until]<=TimeValue("16:00")));([time_until]-[time_from])*1,5;IIf(([day]="monday" Or [day]="tuesday" Or [day]="wednesday" Or [day]="thursday" Or [day]="friday") And ([time_from]<TimeValue("08:00") And [time_until]<TimeValue("08:00"));([time_until]-[time_from])*2;IIf(([day]="saturday" Or [day]="sunday") And ([time_from]>=TimeValue("16:00") And [time_until]>=TimeValue("16:00"));([time_until]-[time_from])*2;IIf(([day]="saturday" Or [day]="sunday") And ([time_from]<=TimeValue("08:00") And [time_until]<=TimeValue("8:00"));([time_until]-[time_from])*3;"false")))))
有很多如果,它的工作原理......但是我如何从这一切中总结出来?我希望我能说 Sum(name_of_the_calculated_field) 但它不起作用......
你能帮我解决这个问题吗?如何总结这些结果?或者也许你有另一个更好的主意......如果是,请记住我是初学者!
谢谢