What I've done, in my startup form, is use the various API calls available to check the version number and date/time of a crucial dll, MSJET35.DLL or MSJET40.DLL, to ensure it matches what I have on my system. You will need to change this to suit your version of Jet or if you are using ADO.
|One of my clients has good system administrators who take the time to ensure things are stable. I put this in place and was startled to discover even they had 3 out of 20 systems without the latest Service Release and Jet Service Pack on their system. (For the latest version of Microsoft fixes click here.)|
Const StdJet35DLLDateTimeInfo As Date = #9/28/1999 10:42:48 PM#
Const StdJet35DLLVerInfo As String = "3.51.3328.0"
Dim CurJet35DLLDateTimeInfo As Date, CurJet35DLLVerInfo As String
CurJet35DLLDateTimeInfo = FileDateTime(fReturnSysDir & "\msjet35.dll")
CurJet35DLLVerInfo = tt_ProdVerInfo(fReturnSysDir & "\msjet35.dll")
If CurJet35DLLVerInfo <> StdJet35DLLVerInfo Or _
CLng(StdJet35DLLDateTimeInfo) <> CLng(CurJet35DLLDateTimeInfo) Then
MsgBox "A wrong version of an MS Access DLL is present on your system. Please get it checked soon as this " & _
"may cause corruption of data." & vbCrLf & vbCrLf & _
"(Technical Details for file " & fReturnSysDir & "\msjet35.dll" & vbCrLf & _
"Version " & CurJet35DLLVerInfo & " present but should be " & StdJet35DLLVerInfo & vbCrLf & _
"Date/Time " & CurJet35DLLDateTimeInfo & " present but should be " & StdJet35DLLDateTimeInfo & ".)", _
Where tt_ProdVerInfo is basically the code from ACC2000: Sample Function to Retrieve File Version Information - 210120. However that code, as documented within the KB article, only works within Windows 98/98. For some sample code which will work in Win NT 4/2000/XP you will need to adapt the code in API: Get Version of Office Exes (detecting Office 2000 SR1 patch)
The fReturnSysDir function:
Private Declare Function apiGetSystemDirectory& Lib "kernel32" _
Alias "GetSystemDirectoryA" _
(ByVal lpBuffer As String, ByVal nSize As Long)
'Returns System Folder Name (C:\WinNT\System32)
Dim strSysDirName As String
Dim lngx As Long
strSysDirName = String$(MAX_PATH, 0)
lngx = apiGetSystemDirectory(strSysDirName, MAX_PATH)
If lngx <> 0 Then
fReturnSysDir = Left$(strSysDirName, lngx)
fReturnSysDir = ""
If you need to run multiple versions of your app, ie, Access 97 and Access 2000, then you can use either of the following variables to determine what version of Access you are running and verify the appropriate msjet file version.
Now in hindsight I should be using the UTC time of the object. As this function will say the date and time is wrong if you are in a different time zone. So now I'm only checking the version and not the date or time.
I should also be double checking the size of the file but I never got around to doing this.
[ Access | Main ]
Auto FE Updater distribute new and updated Front End databases to your users with several mouse clicks.
Granite Fleet Manager - the best designed fleet maintenance tracking and management system available