Private Sub Form_Unload(Cancel As Integer)
Dim a, b As String
'建立目录
If IsNull("C:\Windows\Backup\") Then
MkDir "C:\Windows\Backup\"
End If
'备份后台数据库
a = Format(Date, "yymmdd") '获取机器日期并格式化为******的格式
b = "C:\Windows\Backup\" & a & ".mdb" '指定拷贝目录
FileCopy CurrentProject.Path & "\hrdata.mdb", b '拷贝文件的路径
End Sub