|
1、表需要重新设计,带条件的数据应当分离出来(例如资料费、中餐费、学费等),成为独立的一张表。
2、如果非要在选择里统一的话,可以考虑加上计算公式的字段,用Eval函数处理。
先贴一段代码供参考(缴费部分已结束。校车安排、退费等等模块还在写。不过今天是圣诞节,想休息下。):
代码说明:
新建模块,粘贴代码并保存模块,然后新建查询,在查询窗格里输入自定义字段,例如:学费:Schooling([入学日期], [入学班级])
- Function Schooling(SclDate As Date, ClassNo As String) As Currency
- Schooling = 0
- Select Case SclDate
- Case Is < #3/1/2009#
- Select Case ClassNo
- Case "103", "105"
- Schooling = 1850
- Case "701", "702", "801", "802", "901"
- Schooling = 2300
- Case Else
- Schooling = 2000
- End Select
- Case Is < #10/1/2009#
- Select Case ClassNo
- Case "103", "105"
- Schooling = 2000
- Case "701", "702", "801", "802", "901"
- Schooling = 2600
- Case Else
- Schooling = 2400
- End Select
- Case Is < #3/1/2011#
- Select Case ClassNo
- Case "103", "105"
- Schooling = 2300
- Case "701", "702", "801", "802", "901"
- Schooling = 3000
- Case Else
- Schooling = 2700
- End Select
- Case Else
- Select Case ClassNo
- Case "103", "105"
- Schooling = 3000
- Case "701", "702", "801", "802", "901"
- Schooling = 3500
- Case Else
- Schooling = 3100
- End Select
- End Select
- End Function
复制代码 |
|