Code:
'>>Here's the declaration:
Option Compare Database
Option Explicit
Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" _
(ByVal lpExistingFileName As String, _
ByVal lpNewFileName As String, _
ByVal bFailIfExists As Long) As Long
Sub CopyFile(SourceFile As String, DestFile As String)
Dim Result As Long
If Dir(SourceFile) = "" Then
MsgBox Chr(34) & SourceFile & Chr(34) & _
" is not valid file name."
Else
Result = apiCopyFile(SourceFile, DestFile, False)
End If
End Sub
'>>Here's the autoexec fxn:
Function DatabaseLoad()
On Error Resume Next
If DLookup("VersionID", "tblVersion") <> DLookup("VersionID", "tblVersionMasterELISA Log") And Err = 0 Then
MsgBox "Your version of " & CurrentProject.Name & " is out of date." & Chr(13) & Chr(10) & "Please reopen the database after it closes.", vbInformation, "Updating database"
CopyFile "X:\Database.mdb", CurrentProject.FullName
Application.Quit acQuitSaveNone
End If
End Function