473,765 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
(programaticall y) 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
Jul 17 '05 #1
1 5410

"RWC" <rc************ ******@hemmingw ay.com> wrote in message
news:Ybpie.1389 236$8l.321516@p d7tw1no...
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
(programaticall y) 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 "FindExecutable A" _
(ByVal lpFile As String, _
ByVal lpDirectory As String, _
ByVal sResult As String) As Long

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

Public Const MAX_PATH As Long = 260
Public Const ERROR_FILE_NO_A SSOCIATION 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_SUCC ESS As Long = 32 > is good
Public Const ERROR_BAD_FORMA T As Long = 11

Private Const ERROR_SUCCESS As Long = 0

Private Type FIXEDFILEINFO
dwSignature As Long
dwStrucVersionl As Integer
dwStrucVersionh As Integer
dwFileVersionMS l As Integer
dwFileVersionMS h As Integer
dwFileVersionLS l As Integer
dwFileVersionLS h As Integer
dwProductVersio nMSl As Integer
dwProductVersio nMSh As Integer
dwProductVersio nLSl As Integer
dwProductVersio nLSh 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 GetFileVersionI nfo Lib "Version.dl l" Alias
"GetFileVersion InfoA" (ByVal lptstrFilename As String, ByVal dwhandle As
Long, ByVal dwlen As Long, lpData As Any) As Long

Private Declare Function GetFileVersionI nfoSize Lib "Version.dl l" Alias
"GetFileVersion InfoSizeA" (ByVal lptstrFilename As String, lpdwHandle As
Long) As Long

Private Declare Function VerQueryValue Lib "Version.dl l" Alias
"VerQueryValueA " (pBlock As Any, ByVal lpSubBlock As String, lplpBuffer As
Any, puLen As Long) As Long

Private Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMem ory" (dest As
Any, ByVal Source As Long, ByVal length As Long)

' Find what is associated with mdb

Public Function GetmdbAssociati on(dwFlagReturn ed 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
GetmdbAssociati on = TrimNull(sResul t)

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(nSi ze, 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$ = GetmdbAssociati on(success)

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

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

'other possible return values
'Case ERROR_FILE_NO_A SSOCIATION
'Case ERROR_FILE_NOT_ FOUND
'Case ERROR_PATH_NOT_ FOUND
'Case ERROR_BAD_FORMA T
gAccessPath = b$
Case Else
gAccessExists = False
End Select
GetAccessPath = b$
End Function

Public Function GetVersion(sPat h) 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 = GetFileVersionI nfoSize(sPath, lDummy)
If lBufferLen < 1 Then
GetVersion = ""
Exit Function
End If

'**** Store info into struct ****
ReDim sBuffer(lBuffer Len)
rc = GetFileVersionI nfo(sPath, 0&, lBufferLen, sBuffer(0))
rc = VerQueryValue(s Buffer(0), "\", lVerPointer, lVerbufferLen)
MoveMemory udtVerBuffer, lVerPointer, Len(udtVerBuffe r)
' a very very long line below
GetVersion = Format$(udtVerB uffer.dwFileVer sionMSh) & "." &
Format$(udtVerB uffer.dwFileVer sionMSl) & "." &
Format$(udtVerB uffer.dwFileVer sionLSh) & "." &
Format$(udtVerB uffer.dwFileVer sionLSl)

On Error GoTo 0
Exit Function

GetFileVersion_ Error:
GetVersion = ""
End Function
Jul 17 '05 #2

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

Similar topics

1
1939
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 checks for a software. Thanks in advance. - Rahul A.
2
5968
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 the same version of MDAC installed. TIA, Richard Rosenheim
7
8869
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 want my users to be able to select a report, click on a command button on a form, which will then automatically create the report as a pdf file and save it to the user's machine. I am using Adobe Acrobat (5.0 I think) and have Adobe Distiller as a
11
6600
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 where the job is running, the job runs sucessfully, PDF files got generated, everything is good. If I scheduled the job to run at the time that I am not logged into the server, Access is not able to print to the printer. The error is pretty...
4
7187
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 for the ADP to determine programatically wether the correct service pack is installed (or if they are using a newer version such as 2002/2003)? Ta.
2
1819
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 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.
1
3420
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 test it on another system which had acrobat 6.0 installed.... there my application gave error while loading. I have acrobat 7.0. the solution i this is to get acrobat contorl programatically and not through adding components at design time. i...
23
2652
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 in a direction to find info on how to prevent and/or fix the db's so that these message don't pop up when the app is started. Error messages below: 1. Microsoft Jet 4.0 service pack 8 must be installed to block unsafe expressions without...
4
21749
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 webserver to see if service A needs to be updated. What service B does if it sees their is an update for service A is to download a new copy of the service A executable, stop service A, replace the executable with the new copy, and start service B...
0
9568
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10161
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9955
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9833
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.