-- 作者:石四
-- 发布时间:2014/11/11 10:13:00
-- 编排考勤表
参考帮助文件"临时表生成器"示例2,将考勤数据编排成表格样式:
Dim dtb As New DataTableBuilder("表B")
dtb.AddDef("姓名", Gettype(String), 32)
For Each v As Date In DataTables("部门考勤").GetValues("考勤日期")
dtb.AddDef(v, Gettype(Date))
Next
dtb.Build()
For Each v As String In DataTables("部门考勤").GetValues("姓名")
Dim dr1 As DataRow = DataTables("表B").AddNew()
dr1("姓名") = v
For Each dr2 As DataRow In DataTables("部门考勤").DataRows
If dr2("姓名") = v Then
dr1(dr2("考勤日期")) = dr2("备注")
End If
Next
Next
MainTable = Tables("表B")
由于"备注"是字符型数据,与"考勤日期"格式不符,上面粉色字体代码怎么改,使其转为字符型,以1,2,3...样式出现?
|