473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Programatically determining if Access is installed and which version

RWC
Hi Folks,

I'm looking for a way to determine if the client machine has access
installed and if so, what version. The reason I need this is to determine
(programatically) if the Access Runtime is required to be installed and if
not, which version of the program database needs to be installed with the
current version of Access. (hope that makes sense).

If anyonoe could point me in the right direction, I'd really appreciate it.

Thanks in advance!
Rick
Nov 13 '05 #1
2 1792
Br
RWC <rc******************@hemmingway.com> wrote:
Hi Folks,

I'm looking for a way to determine if the client machine has access
installed and if so, what version. The reason I need this is to
determine (programatically) if the Access Runtime is required to be
installed and if not, which version of the program database needs to
be installed with the current version of Access. (hope that makes
sense).
If anyonoe could point me in the right direction, I'd really
appreciate it.
Thanks in advance!
Rick


check out http://www.mvps.org/access/
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #2

"RWC" <rc******************@hemmingway.com> wrote in message
news:Ybpie.1389236$8l.321516@pd7tw1no...
Hi Folks,

I'm looking for a way to determine if the client machine has access
installed and if so, what version. The reason I need this is to determine
(programatically) if the Access Runtime is required to be installed and if
not, which version of the program database needs to be installed with the
current version of Access. (hope that makes sense).

If anyonoe could point me in the right direction, I'd really appreciate it.
Thanks in advance!
Rick


My logic is that since normally mdb is associated with access, we can find
the application associated with mdb then find the file version. I have not
tested this code but give it a shot:

' Calling code in form

exePath = GetAccessPath
exeversion = GetVersion(Trim(exePath))
'===module level
Option Explicit
Public gAccessExists As Boolean
Public gAccessPath As String

Public Declare Function FindExecutable Lib "shell32" _
Alias "FindExecutableA" _
(ByVal lpFile As String, _
ByVal lpDirectory As String, _
ByVal sResult As String) As Long

Public Declare Function GetTempPath Lib "kernel32" _
Alias "GetTempPathA" _
(ByVal nSize As Long, _
ByVal lpBuffer As String) As Long

Public Const MAX_PATH As Long = 260
Public Const ERROR_FILE_NO_ASSOCIATION As Long = 31
Public Const ERROR_FILE_NOT_FOUND As Long = 2
Public Const ERROR_PATH_NOT_FOUND As Long = 3
Public Const ERROR_FILE_SUCCESS As Long = 32 > is good
Public Const ERROR_BAD_FORMAT As Long = 11

Private Const ERROR_SUCCESS As Long = 0

Private Type 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)

' Find what is associated with mdb

Public Function GetmdbAssociation(dwFlagReturned As Long) As String
Dim sTempFolder
Dim hfile
Dim sResult As String

'get the user's temp folder
sTempFolder = GetTempDir()

'create a dummy mdb file in the temp dir
hfile = FreeFile
Open sTempFolder & "dummy.mdb" For Output As #hfile
Close

'get the file path & name associated with the file
sResult = Space$(MAX_PATH)
dwFlagReturned = FindExecutable("dummy.mdb", sTempFolder, sResult)

'clean up
Kill sTempFolder & "dummy.mdb"

'return result
GetmdbAssociation = TrimNull(sResult)

End Function
Public Function TrimNull(item As String)
Dim pos As Integer
pos = InStr(item, Chr$(0))
If pos Then
TrimNull = Left$(item, pos - 1)
Else
TrimNull = item
End If
End Function
Public Function GetTempDir() As String
Dim nSize As Long
Dim tmp As String
tmp = Space$(MAX_PATH)
nSize = Len(tmp)
Call GetTempPath(nSize, tmp)
GetTempDir = TrimNull(tmp)
End Function

Public Function GetAccessPath() As String
Dim b$
Dim success As Long
'success is passed and filled in the routine
b$ = GetmdbAssociation(success)

'possible return values from the call
'returned in success
Select Case success

'the call succeeded
Case Is >= ERROR_FILE_SUCCESS '>32 good
gAccessExists = True

'other possible return values
'Case ERROR_FILE_NO_ASSOCIATION
'Case ERROR_FILE_NOT_FOUND
'Case ERROR_PATH_NOT_FOUND
'Case ERROR_BAD_FORMAT
gAccessPath = b$
Case Else
gAccessExists = False
End Select
GetAccessPath = b$
End Function

Public Function GetVersion(sPath) As String
Dim rc As Long
Dim lDummy As Long
Dim sBuffer() As Byte
Dim lBufferLen As Long
Dim lVerPointer As Long
Dim udtVerBuffer As FIXEDFILEINFO
Dim lVerbufferLen As Long

On Error GoTo GetFileVersion_Error

'*** Get size ****
lBufferLen = GetFileVersionInfoSize(sPath, lDummy)
If lBufferLen < 1 Then
GetVersion = ""
Exit Function
End If

'**** Store info into struct ****
ReDim sBuffer(lBufferLen)
rc = GetFileVersionInfo(sPath, 0&, lBufferLen, sBuffer(0))
rc = VerQueryValue(sBuffer(0), "\", lVerPointer, lVerbufferLen)
MoveMemory udtVerBuffer, lVerPointer, Len(udtVerBuffer)
' a very very long line below
GetVersion = Format$(udtVerBuffer.dwFileVersionMSh) & "." &
Format$(udtVerBuffer.dwFileVersionMSl) & "." &
Format$(udtVerBuffer.dwFileVersionLSh) & "." &
Format$(udtVerBuffer.dwFileVersionLSl)

On Error GoTo 0
Exit Function

GetFileVersion_Error:
GetVersion = ""
End Function
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: RWC | last post by:
Hi Folks, I'm looking for a way to determine if the client machine has access installed and if so, what version. The reason I need this is to determine (programatically) if the Access Runtime...
1
by: Rahul Apte | last post by:
How do I programmatically check whether ASP and Server Side Includes sub-components of the World Wide Web service are installed on a Windows 2003 Box? I want to do these checks as pre-install...
2
by: Richard L Rosenheim | last post by:
How can I determine which version of MDAC is installed on the machine. I have a program which works on one machine, but not another and I would like to confirm whether or not the two machines have...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
4
by: Br | last post by:
We're using an Access2000 ADP with an SQL2000 back-end. Because SQL2000 was released after Access2000 you need to be running Access2000 SP1 (2 or 3) for it to work properly. Is there an easy way...
1
by: Khadim | last post by:
greetings, i am trying to develop an application which is supposed to show pdf. i have added the activeX control from the acrobat in my application. everything was working fine, until i got to...
23
by: Reggie | last post by:
Hi and TIA. I developed several A2K dbs which are now being run on my clients computer which have been upgraded to Access 03. I'm not sure exactly what they mean but of you know or could point me...
4
by: carson | last post by:
I have written two windows services: - service A does some crunching of local data files and uploads them to a central processing computer via http. - service B monitors a manifest file on a...
17
by: Neil | last post by:
A client of mine likes some of the new bells and whistles in Access 2007, and is thinking about converting our A03 format MDB to an A07 format file. However, while some of the users have A07, many...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.