Thứ Bảy, 14 tháng 11, 2009

Code Kiểm tra sự tồn tại của 1 file trong Access

' kiem tra su ton tai file
Function FileExit(fname As String) As Boolean

If Dir(fname) <> "" Then
FileExit = True
Else
FileExit = False
End If

End Function



Ví dụ: Ở sự kiện Load form của Form chính, bạn chọn cho code này vào:

If not(FileExit("\\May2\DULIEU\LUU.MDB")) then
msgbox " Phải cài file dữ liệu "
docmd.quit
End if

Không có nhận xét nào:

Đăng nhận xét