_____________________________________
Private Sub Form_Load()
x = Dir("c:\fox_sys\dept.txt")
y = Dir("c:\fox_sys\dept1.txt")
z = Dir("c:\fox_sys\dept2.txt")
w = Dir("C:\foy_sys\dept3.txt")
End Sub
_____________________________
Private Sub O_1_Click()
If x <> "c:\fox_sys\dept.txt" And z <> "c:\fox_sys\dept2.txt" Then
DoCmd.OpenForm "未核銷情況(壹部)"
ElseIf x <> "c:\fox_sys\dept.txt" And y <> "c:\fox_sys\dept1.txt" Then
DoCmd.OpenForm "未核銷情況(貳部)"
Else
If x <> "c:\fox_sys\dept.txt" And y <> "c:\fox_sys\dept1.txt" And z <> "c:\fox_sys\dept2.txt" Then
MsgBox "系統退出!", "16", "系統"
DoCmd.Quit
End If
x = Dir("c:\fox_sys\dept.txt")
y = Dir("c:\fox_sys\dept1.txt")
z = Dir("c:\fox_sys\dept2.txt")
w = Dir("C:\fox_sys\dept3.txt")
If y = "dept1.txt" Then
DoCmd.OpenForm "未核銷情況(壹部)"
ElseIf z = "dept2.txt" Then
DoCmd.OpenForm "未核銷情況(貳部)"
ElseIf x <> "dept.txt" And y <> "dept1.txt" And z <> "dept2.txt" And w <> "dept3.txt" Then
MsgBox "系統退出!", "16", "系統"
DoCmd.Quit
End If
If z = "dept1.txt" Then
DoCmd.OpenForm "未核銷情況(壹部)"
ElseIf y = "dept2.txt" Then
DoCmd.OpenForm "未核銷情況(貳部)"
Elseif x <> "dept.txt" or y <> "dept1.txt" or z <> "dept2.txt" Then
MsgBox "系統退出!", "16", "系統"
DoCmd.Quit
x = Dir("c:\fox_sys\dept.txt")
y = Dir("c:\fox_sys\dept1.txt")
z = Dir("c:\fox_sys\dept2.txt")
w = Dir("C:\foy_sys\dept3.txt")
If x = "dept.txt" And z = "dept2.txt" Then
DoCmd.OpenForm "未核銷情況(壹部)"
ElseIf x = "dept.txt" And y = "dept1.txt" Then
DoCmd.OpenForm "未核銷情況(貳部)"
Elseif x <> "dept.txt" And y <> "dept1.txt" And z <> "dept2.txt" Then
MsgBox "系統退出!", "16", "系統"
DoCmd.Quit