• How to Return Jet Version Number? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » How to Return Jet Version Number? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    Author
    Topic
    #397642

    Within the Access Application how do I return Jet Version Number for Jet Version 4 in the following format?

    4.0.7328.0

    Thanks, John

    Viewing 5 reply threads
    Author
    Replies
    • #754659

      The version property for DAO should return that for you if you specify the database as the object, at least in 2002. Search the VBA help for version and you should find an example of how to do that.

      • #754710

        I ran the Help VersionX Sub example as suggested and it returned the following:

        Version of DBEngine (Microsoft Jet in memory) = 3.6
        Version of the Microsoft Jet engine with which F:AppsAccess2kBuild.mdb was created = 4.0
        Version of the Microsoft Jet engine with which F:AppsAccess2kBuildCnfbuild_be.mdb was created = 4.0

        I

        • #754725

          You will see the same difference even within the current database: in the Immediate window,

          ? DBEngine.Version

          returns 3.6 – this is the version of DAO; compare the reference to the Microsoft DAO 3.6 Object Library; the major file is DAO360.dll (in C:Program FilesCommon FilesMicrosoft SharedDAO).

          ? CurrentDb.Version

          returns 4.0 – this is the version of the Jet Engine; the major file is MSJet40.dll (in C:WindowsSystem32).

          • #754754

            Hans

            Thanks for the info

            After working with the forum for a year, when expressing a problem, many of the responses say to check service pack of access and Jet, etc.

            What I

            • #754757

              Here is code based on the API link Charlotte posted. It should go into a general module:

              Private Type VS_FIXEDFILEINFO
              dwSignature As Long
              dwStrucVersionl As Integer
              dwStrucVersionh As Integer
              dwFileVersionMSl As Integer
              dwFileVersionMSh As Integer
              dwFileVersionLSl As Integer
              dwFileVersionLSh As Integer
              dwProductVersionMSl As Integer
              dwProductVersionMSh As Integer
              dwProductVersionLSl As Integer
              dwProductVersionLSh As Integer
              dwFileFlagsMask As Long
              dwFileFlags As Long
              dwFileOS As Long
              dwFileType As Long
              dwFileSubtype As Long
              dwFileDateMS As Long
              dwFileDateLS As Long
              End Type

              Private Declare Function GetFileVersionInfo Lib “Version.dll” Alias “GetFileVersionInfoA” _
              (ByVal lptstrFilename As String, ByVal dwhandle As Long, ByVal dwlen As Long, lpData As Any) As Long

              Private Declare Function GetFileVersionInfoSize Lib “Version.dll” Alias “GetFileVersionInfoSizeA” _
              (ByVal lptstrFilename As String, lpdwHandle As Long) As Long

              Private Declare Function VerQueryValue Lib “Version.dll” Alias “VerQueryValueA” _
              (pBlock As Any, ByVal lpSubBlock As String, lplpBuffer As Any, puLen As Long) As Long

              Private Declare Sub MoveMemory Lib “kernel32” Alias “RtlMoveMemory” _
              (dest As Any, ByVal Source As Long, ByVal length As Long)

              Public Function VerInfo(FileName As String) As String
              Dim rc As Long, lDummy As Long, sBuffer() As Byte
              Dim lBufferLen As Long, lVerPointer As Long, udtVerBuffer As VS_FIXEDFILEINFO
              Dim lVerbufferLen As Long

              lBufferLen = GetFileVersionInfoSize(FileName, lDummy)
              If lBufferLen < 1 Then
              VerInfo = "No Version Info available!"
              Exit Function
              End If

              ReDim sBuffer(lBufferLen)
              rc = GetFileVersionInfo(FileName, 0&, lBufferLen, sBuffer(0))
              rc = VerQueryValue(sBuffer(0), "", lVerPointer, lVerbufferLen)
              MoveMemory udtVerBuffer, lVerPointer, Len(udtVerBuffer)

              VerInfo = Format$(udtVerBuffer.dwFileVersionMSh) & "." & _
              Format$(udtVerBuffer.dwFileVersionMSl) & "." & _
              Format$(udtVerBuffer.dwFileVersionLSh) & "." & _
              Format$(udtVerBuffer.dwFileVersionLSl)
              End Function

              You can use this in the control source of a text box:

              =”Jet version ” & VerInfo(“C:WindowsSystem32MSJet40.dll”)

              Note: this assumes Windows 2000/XP. In Windows NT, the path will be C:WinNTWindows 32.

            • #754758

              Here is code based on the API link Charlotte posted. It should go into a general module:

              Private Type VS_FIXEDFILEINFO
              dwSignature As Long
              dwStrucVersionl As Integer
              dwStrucVersionh As Integer
              dwFileVersionMSl As Integer
              dwFileVersionMSh As Integer
              dwFileVersionLSl As Integer
              dwFileVersionLSh As Integer
              dwProductVersionMSl As Integer
              dwProductVersionMSh As Integer
              dwProductVersionLSl As Integer
              dwProductVersionLSh As Integer
              dwFileFlagsMask As Long
              dwFileFlags As Long
              dwFileOS As Long
              dwFileType As Long
              dwFileSubtype As Long
              dwFileDateMS As Long
              dwFileDateLS As Long
              End Type

              Private Declare Function GetFileVersionInfo Lib “Version.dll” Alias “GetFileVersionInfoA” _
              (ByVal lptstrFilename As String, ByVal dwhandle As Long, ByVal dwlen As Long, lpData As Any) As Long

              Private Declare Function GetFileVersionInfoSize Lib “Version.dll” Alias “GetFileVersionInfoSizeA” _
              (ByVal lptstrFilename As String, lpdwHandle As Long) As Long

              Private Declare Function VerQueryValue Lib “Version.dll” Alias “VerQueryValueA” _
              (pBlock As Any, ByVal lpSubBlock As String, lplpBuffer As Any, puLen As Long) As Long

              Private Declare Sub MoveMemory Lib “kernel32” Alias “RtlMoveMemory” _
              (dest As Any, ByVal Source As Long, ByVal length As Long)

              Public Function VerInfo(FileName As String) As String
              Dim rc As Long, lDummy As Long, sBuffer() As Byte
              Dim lBufferLen As Long, lVerPointer As Long, udtVerBuffer As VS_FIXEDFILEINFO
              Dim lVerbufferLen As Long

              lBufferLen = GetFileVersionInfoSize(FileName, lDummy)
              If lBufferLen < 1 Then
              VerInfo = "No Version Info available!"
              Exit Function
              End If

              ReDim sBuffer(lBufferLen)
              rc = GetFileVersionInfo(FileName, 0&, lBufferLen, sBuffer(0))
              rc = VerQueryValue(sBuffer(0), "", lVerPointer, lVerbufferLen)
              MoveMemory udtVerBuffer, lVerPointer, Len(udtVerBuffer)

              VerInfo = Format$(udtVerBuffer.dwFileVersionMSh) & "." & _
              Format$(udtVerBuffer.dwFileVersionMSl) & "." & _
              Format$(udtVerBuffer.dwFileVersionLSh) & "." & _
              Format$(udtVerBuffer.dwFileVersionLSl)
              End Function

              You can use this in the control source of a text box:

              =”Jet version ” & VerInfo(“C:WindowsSystem32MSJet40.dll”)

              Note: this assumes Windows 2000/XP. In Windows NT, the path will be C:WinNTWindows 32.

          • #754755

            Hans

            Thanks for the info

            After working with the forum for a year, when expressing a problem, many of the responses say to check service pack of access and Jet, etc.

            What I

        • #754726

          You will see the same difference even within the current database: in the Immediate window,

          ? DBEngine.Version

          returns 3.6 – this is the version of DAO; compare the reference to the Microsoft DAO 3.6 Object Library; the major file is DAO360.dll (in C:Program FilesCommon FilesMicrosoft SharedDAO).

          ? CurrentDb.Version

          returns 4.0 – this is the version of the Jet Engine; the major file is MSJet40.dll (in C:WindowsSystem32).

        • #754763

          If you want the specific version number for Msjet40.dll or any other system file for which version is available, you can use the Windows GetFileVersionInfo API function, which uses the somewhat complex VS_FIXEDFILEINFO structure to return detailed information concerning the specified file. If interested, see attached text file (exported code module). To use this, rename file as basVersionInfo.bas and import into your project. Run sub named DisplayDLLVersionInfo – provide file name as argument, the procedure by default uses the Windows system directory (determined by GetSystemDirectory API function) as path. (If testing non-system file, modify sub accordingly – the Jet DLL is located in system directory.) If you take a look at the attached file you will see it is not a simple task to reliably ascertain version info – a typically convoluted Windows procedure. Code was adapted from the following MSKB article:

          How to Use Functions in VERSION.DLL — A 32-bit Sample App

          See next post for test results (only one attachment allowed per post…)

          HTH

          • #754765

            In further reply, here are test results on my system (WIN XP, ACC 2002):

            DisplayDLLVersionInfo “Msjet40.dll”
            C:WINDOWSSystem32Msjet40.dll
            File Version: 4.0.7328.0
            Product Version: 4.0.7328.0
            File OS: NT-Win32
            File Type: DLL
            File Subtype:

            This version info is same as seen when you right-click actual file and open Properties dialog “Version” tab – see attached pic.

            You probably know how to check the Jet DLL version number to determine which SP is installed, but anyway for the record here is link to MSKB Article:

            How To: Obtain the Latest Service Pack for the Microsoft Jet 4.0 Database Engine

            HTH

            • #756401

              Thanks to all that replied

              MarkD, I like your code because it looks like it is not hard coded, where does it get version info? registry?

              Thanks, John

            • #756455

              No, this information is not stored in Windows Registry, it is stored in the file itself. Windows uses version stamping in DLL’s and other program files so that installation programs have a way to determine what version of a DLL or other file is the latest. A DLL that supports version stamping contains a version resource, which includes the VS_FIXEDFILEINFO data structure used by the GetFileVersionInfo API function:

              Type VS_FIXEDFILEINFO
              dwSignature As Long
              dwStrucVersionl As Integer
              dwStrucVersionh As Integer
              dwFileVersionMSl As Integer ‘ Most significant 32 bits – low 16 bits – minor revision number
              dwFileVersionMSh As Integer ‘ Most significant 32 bits – high 16 bits – major revision number
              dwFileVersionLSl As Integer ‘ Least significant 32 bits – low 16 bits
              dwFileVersionLSh As Integer ‘ Least significant 32 bits – high 16 bits
              dwProductVersionMSl As Integer
              dwProductVersionMSh As Integer
              dwProductVersionLSl As Integer
              dwProductVersionLSh As Integer
              dwFileFlagsMask As Long
              dwFileFlags As Long
              dwFileOS As Long
              dwFileType As Long
              dwFileSubtype As Long
              dwFileDateMS As Long
              dwFileDateLS As Long
              End Type

              Note that the file version number is 64 bits long, though usually only the most significant 32 bits are used, as commented above. Using the numbers derived from this data structure is considered the most reliable way to ascertain the correct version number of a version stamped file.

              HTH

            • #756456

              No, this information is not stored in Windows Registry, it is stored in the file itself. Windows uses version stamping in DLL’s and other program files so that installation programs have a way to determine what version of a DLL or other file is the latest. A DLL that supports version stamping contains a version resource, which includes the VS_FIXEDFILEINFO data structure used by the GetFileVersionInfo API function:

              Type VS_FIXEDFILEINFO
              dwSignature As Long
              dwStrucVersionl As Integer
              dwStrucVersionh As Integer
              dwFileVersionMSl As Integer ‘ Most significant 32 bits – low 16 bits – minor revision number
              dwFileVersionMSh As Integer ‘ Most significant 32 bits – high 16 bits – major revision number
              dwFileVersionLSl As Integer ‘ Least significant 32 bits – low 16 bits
              dwFileVersionLSh As Integer ‘ Least significant 32 bits – high 16 bits
              dwProductVersionMSl As Integer
              dwProductVersionMSh As Integer
              dwProductVersionLSl As Integer
              dwProductVersionLSh As Integer
              dwFileFlagsMask As Long
              dwFileFlags As Long
              dwFileOS As Long
              dwFileType As Long
              dwFileSubtype As Long
              dwFileDateMS As Long
              dwFileDateLS As Long
              End Type

              Note that the file version number is 64 bits long, though usually only the most significant 32 bits are used, as commented above. Using the numbers derived from this data structure is considered the most reliable way to ascertain the correct version number of a version stamped file.

              HTH

            • #756402

              Thanks to all that replied

              MarkD, I like your code because it looks like it is not hard coded, where does it get version info? registry?

              Thanks, John

          • #754766

            In further reply, here are test results on my system (WIN XP, ACC 2002):

            DisplayDLLVersionInfo “Msjet40.dll”
            C:WINDOWSSystem32Msjet40.dll
            File Version: 4.0.7328.0
            Product Version: 4.0.7328.0
            File OS: NT-Win32
            File Type: DLL
            File Subtype:

            This version info is same as seen when you right-click actual file and open Properties dialog “Version” tab – see attached pic.

            You probably know how to check the Jet DLL version number to determine which SP is installed, but anyway for the record here is link to MSKB Article:

            How To: Obtain the Latest Service Pack for the Microsoft Jet 4.0 Database Engine

            HTH

        • #754764

          If you want the specific version number for Msjet40.dll or any other system file for which version is available, you can use the Windows GetFileVersionInfo API function, which uses the somewhat complex VS_FIXEDFILEINFO structure to return detailed information concerning the specified file. If interested, see attached text file (exported code module). To use this, rename file as basVersionInfo.bas and import into your project. Run sub named DisplayDLLVersionInfo – provide file name as argument, the procedure by default uses the Windows system directory (determined by GetSystemDirectory API function) as path. (If testing non-system file, modify sub accordingly – the Jet DLL is located in system directory.) If you take a look at the attached file you will see it is not a simple task to reliably ascertain version info – a typically convoluted Windows procedure. Code was adapted from the following MSKB article:

          How to Use Functions in VERSION.DLL — A 32-bit Sample App

          See next post for test results (only one attachment allowed per post…)

          HTH

      • #754711

        I ran the Help VersionX Sub example as suggested and it returned the following:

        Version of DBEngine (Microsoft Jet in memory) = 3.6
        Version of the Microsoft Jet engine with which F:AppsAccess2kBuild.mdb was created = 4.0
        Version of the Microsoft Jet engine with which F:AppsAccess2kBuildCnfbuild_be.mdb was created = 4.0

        I

    • #754660

      The version property for DAO should return that for you if you specify the database as the object, at least in 2002. Search the VBA help for version and you should find an example of how to do that.

    • #754661

      This will have to be adapted… but check out this link…
      http://www.granite.ab.ca/access/verifyjetsp.htm%5B/url%5D

      Hopefully it’s a start for you anyway… smile

    • #754662

      This will have to be adapted… but check out this link…
      http://www.granite.ab.ca/access/verifyjetsp.htm%5B/url%5D

      Hopefully it’s a start for you anyway… smile

    • #754737

      The API will return a full version string for a file. Check out All-API.Net GetFileVersionInfo for instructions and sample code.

    • #754742

      The API will return a full version string for a file. Check out All-API.Net GetFileVersionInfo for instructions and sample code.

    Viewing 5 reply threads
    Reply To: How to Return Jet Version Number? (a2k (9.0.6926) SP-3 Jet 4.0 SP-7)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: