A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

What is the system name for the version of Access?



 
 
Thread Tools Display Modes
  #1  
Old May 21st, 2010, 07:46 PM posted to microsoft.public.access
shaw15222
external usenet poster
 
Posts: 1
Default What is the system name for the version of Access?


  #2  
Old May 22nd, 2010, 12:45 AM posted to microsoft.public.access
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default What is the system name for the version of Access?

This will work across multiple versions:

Public Function GetAccessVersion(Optional db As DAO.Database) As String
'Purpose: Return full version information for the msaccess.exe file.
'Argument: The database to examine. Current database if nothing passed in.
'Return: Full version number as string, e.g. "11.0.6566.0".
' Zero-length string on error.
'Requires: Access 95 and later. (Change the constant for Access 1/2.)
'Note: We don't use SysCmd(acSysCmdAccessVer), since we want the minor
version too.
'GetAccessVersion"

GetAccessVersion = fGetProductVersion(SysCmd(acSysCmdAccessDir) &
"msaccess.exe")
End Function



For A2007 you can use this:

MsgBox "You are currently running Microsoft Access, " _
& " version " & Application.Version & ", build " _
& Application.Build & "."



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"shaw15222" wrote in message
...



  #3  
Old May 22nd, 2010, 01:34 AM posted to microsoft.public.access
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default What is the system name for the version of Access?

Here is the rest of the code you need if you are using
Public Function GetAccessVersion

This will work across multiple versions:

'These declarations go at the top of the module in the declaration section

'Returns size of version info in Bytes
Private Declare Function apiGetFileVersionInfoSize Lib "version.dll" Alias
"GetFileVersionInfoSizeA" _
(ByVal lptstrFilename As String, lpdwHandle As Long) As Long

'Read version info into buffer: Arguments:
' 1. Length of buffer for info. 2.Information from GetFileVersionSize. 3.
Filename of version stamped file
Private Declare Function apiGetFileVersionInfo Lib "version.dll" Alias
"GetFileVersionInfoA" _
(ByVal lptstrFilename As String, ByVal dwHandle As Long, ByVal dwLen As
Long, lpData As Any) As Long

'Returns selected version information from the specified version-information
resource.
Private Declare Function apiVerQueryValue Lib "version.dll" Alias
"VerQueryValueA" _
(pBlock As Any, ByVal lpSubBlock As String, lplpBuffer As Long, puLen As
Long) As Long



Private Function fGetProductVersion(strExeFullPath As String) As String
On Error GoTo Err_Handler
'Purpose: return the full build number for an executable.
'Return: Version number as string, e.g. "9.0.0.2719"
' Zero-length string on error.
'Argument: The executable to examine.
'Usage: fGetProductVersion(SysCmd(acSysCmdAccessDir) & "msaccess.exe")
Dim lngSize As Long
Dim lngRet As Long
Dim pBlock() As Byte
Dim lpfi As VS_FIXEDFILEINFO
Dim lppBlock As Long

'GetFileVersionInfo requires us to get the size of the file version
information first,
' this info is in the format of VS_FIXEDFILEINFO struct
lngSize = apiGetFileVersionInfoSize(strExeFullPath, lngRet)

'Proceed If the OS can obtain version info.
If lngSize Then
'The info in pBlock is always in Unicode format
ReDim pBlock(lngSize)
lngRet = apiGetFileVersionInfo(strExeFullPath, 0, lngSize,
pBlock(0))
If Not lngRet = 0 Then
'The same pointer to pBlock can be passed to VerQueryValue
lngRet = apiVerQueryValue(pBlock(0), "\", lppBlock, lngSize)

'Fill the VS_FIXEDFILEINFO struct with bytes from pBlock
'VerQueryValue fills lngSize with the length of the block.
Call sapiCopyMem(lpfi, ByVal lppBlock, lngSize)
'Build the version info strings
With lpfi
fGetProductVersion = HiWord(.dwFileVersionMS) & "." &
LoWord(.dwFileVersionMS) & "." & _
HiWord(.dwFileVersionLS) & "." &
LoWord(.dwFileVersionLS)
End With
End If
End If

Exit_Handler:
Erase pBlock
Exit Function
Err_Handler:
Resume Exit_Handler
End Function

Private Function LoWord(dw As Long) As Integer
'Retrieves the low-order word from the given 32-bit value.

If dw And &H8000& Then
LoWord = dw Or &HFFFF0000
Else
LoWord = dw And &HFFFF&
End If

End Function

Private Function HiWord(dw As Long) As Integer
'Retrieves the high-order word from the given 32-bit value.

HiWord = (dw And &HFFFF0000) \ &H10000

End Function

Public Function GetAccessVersion(Optional db As DAO.Database) As String
'Purpose: Return full version information for the msaccess.exe file.
'Argument: The database to examine. Current database if nothing passed in.
'Return: Full version number as string, e.g. "11.0.6566.0".
' Zero-length string on error.
'Requires: Access 95 and later. (Change the constant for Access 1/2.)
'Note: We don't use SysCmd(acSysCmdAccessVer), since we want the minor
version too.
'GetAccessVersion"

GetAccessVersion = fGetProductVersion(SysCmd(acSysCmdAccessDir) &
"msaccess.exe")
End Function



For A2007 you can use this:

MsgBox "You are currently running Microsoft Access, " _
& " version " & Application.Version & ", build " _
& Application.Build & "."



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"shaw15222" wrote in message
...



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:52 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.