- Access 2013 数据库管理与应用从新手到高手
- 吴华 杨继萍 葛春雷等编著
- 1149字
- 2025-02-18 08:40:13
3.5 练习:创建“考勤统计表”数据表
考勤统计表是根据员工实际考勤数据统计而来的,主要用于记录员工在一定时期内的迟到、病假、事假等考勤信息。在本练习中,将通过创建新表,为表添加员工工牌号、姓名、所属部门等字段,以及对各字段属性进行相应的设置等操作,来制作一份“考勤统计表”数据表。


操作步骤
STEP|01 新建数据表。打开名为“员工信息”的数据库,执行【创建】|【表格】|【表】命令,新建一个名为“表1”的数据表。

STEP|02 设置字段属性。右击表标题空白处,执行【设计视图】命令,在弹出的【另存为】对话框中,输入表格名称,单击【确定】按钮。

STEP|03 在第1行中的【字段名称】单元格中,输入“工牌号”。然后,按下Tab键,移动到【数据类型】单元格中,单击其下拉按钮,在下拉列表中选择【短文本】选项。

STEP|04 在其下方的【常规】选项卡中,将【输入掩码】设置为000,将【必需】设置为“是”,将【允许空字符串】设置为“否”。

STEP|05 设置数字类型。选择第2行中的【字段名称】单元格,输入“姓名”,将【数据类型】设置为“短文本”。用同样方法,设置第3行中的【字段名称】和【数据类型】属性。

STEP|06 选择第4行中的【字段名称】单元格,输入“请假统计”,将【数据类型】设置为“货币”,将【小数位数】设置为2。同样添加“迟到统计”字段。

STEP|07 切换视图。右击表标题空白区域,执行【数据表视图】命令,在弹出的提示框中单击【是】按钮。

STEP|08 设置计算字段。单击【单击以添加】的下拉按钮,选择【计算字段】|【货币】选项。

STEP|09 在弹出的【表达式生成器】对话框中,选择左侧【考勤统计表】选项,双击【请假统计】字段,同时输入“+”,再双击【迟到统计】字段,并单击【确定】按钮。

STEP|10 此时,在数据表中将显示一个名为【字段1】的字段,输入新的字段名称,然后单击其他位置即可。


STEP|11 单击【单击以添加】的下拉按钮,选择【计算字段】|【货币】选项。在弹出的【表达式生成器】对话框中,输入计算公式,并单击【确定】按钮。

STEP|12 此时,在数据表中将显示一个名为【字段1】的字段,输入新的字段名称,然后单击其他位置即可。

STEP|13 单击【单击以添加】下拉按钮,选择【计算字段】|【货币】选项。在弹出的【表达式生成器】对话框中,输入计算公式,并单击【确定】按钮。

STEP|14 此时,在数据表中将显示一个名为【字段1】的字段,输入新的字段名称,单击其他位置即可。

STEP|15 输入记录。在数据表中依次输入相应的数据,其后的计算字段将会自动计算并显示出计算结果。

STEP|16 设置数据格式。选择【考勤应扣】字段列,执行【开始】|【文本格式】|【居中】命令,设置字段的对齐方式。使用同样方法,对齐其他字段列。

STEP|17 另存为数据库。执行【文件】|【另存为】命令,选择【数据库另存为】选项,同时选择【Access数据库】选项,并单击【另存为】按钮。

STEP|18 在弹出的【另存为】对话框中,设置保存位置和名称,并单击【保存】按钮。
