Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I found where is Access installed?

Status
Not open for further replies.

password99

Technical User
Jul 19, 2002
122
US
How do I found what location (folder) is Access installed?
Is there a registry I could look into?
 
Do a Folder/File search for MSAccess.exe.

Generally, Access will be in C:\Program Files\Microsoft Office\Office. The drive letter could be different depending on how you have your system set up. Larry De Laruelle
ldelaruelle@familychildrenscenter.org

 
Thanks for quick reply.

This is not what I was looking for in the answer....I need to perform some task on access programmatically...I need to find out programmatically where Access is installed...possibly from registry if it stored there.

Do you know if it is possible to read from registry where MS Access is installed.
 
where do i execute this SysCmd(acSysCmdAccessDir)
command
 
It just returns a string (i.e. debug.print SysCmd(acSysCmdAccessDir)). I used it to run another database and quit the one I'm in. (Docmd.Shell SysCmd...)
 
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SessionManager\CheckBadApps400\access.exe

This is the first registry entry for ACCESS in my PC. You can check the same.

Rollie E
 
Sorry - this was an ACCESS folder. Here is msaccess.exe

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\MSACCESS.EXE

rollie@bwsys.net
 
In a Module (or behind a button on a form), put the following

Dim Where_is_Access as string

Where_is_Access = SysCmd(acSysCmdAccessDir)

After you run that the string filed (Where_is_Access) will contain the location you are wanting.
 
password99, I presume you are trying to solve what I call the pratical mover prob. What I mean by that is when some joker decides to put Access in another location, which becomes hard if you want to run an app by location. Well hopefully this will help you, it will find Access and open it in conjuction with a MDB or MDE file. If you are after a version that runs another app before opening the MDB or MDE file let me know I have one somewhere in the dungeon.

ZeroAnarchy B-)

'-----------------------------------------------------
Private Declare Function WinExec Lib "kernel32" (ByVal lpCmdLine As String, ByVal nCmdShow As Long) As Long

Option Explicit

Private Const REG_DWORD As Long = 4
Private Const HKEY_CLASSES_ROOT = &H80000000

Private Declare Function RegOpenKey Lib "advapi32.dll" _
Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal _
lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegQueryValueEx Lib "advapi32.dll" _
Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal _
lpValueName As String, ByVal lpReserved As Long, _
lpType As Long, ByVal lpData As String, lpcbData _
As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" _
(ByVal hKey As Long) As Long

Private Function ReadRegistry(ByVal Group _
As Long, ByVal Section As String, ByVal Key _
As String) As String

Dim lResult As Long, lKeyValue As Long, _
lDataTypeValue As Long, lValueLength As Long, _
sValue As String, td As Double

On Error Resume Next
lResult = RegOpenKey(Group, Section, lKeyValue)
sValue = Space$(2048)
lValueLength = Len(sValue)
lResult = RegQueryValueEx(lKeyValue, Key, 0&, _
lDataTypeValue, sValue, lValueLength)
If (lResult = 0) And (Err.Number = 0) Then
If lDataTypeValue = REG_DWORD Then
td = Asc(Mid$(sValue, 1, 1)) + &H100& * _
Asc(Mid$(sValue, 2, 1)) + &H10000 * _
Asc(Mid$(sValue, 3, 1)) + &H1000000 * _
CDbl(Asc(Mid$(sValue, 4, 1)))
sValue = Format$(td, "000")
End If
sValue = Left$(sValue, lValueLength - 1)
Else
sValue = "Not Found"
End If
lResult = RegCloseKey(lKeyValue)
ReadRegistry = sValue
End Function
'----------------------------------------------------------
'On the button click
Private Sub sampleLabel_Click(Index As Integer)
Dim sname As String
Dim spath As String
On Error Resume Next
sname = "access.application.9"
spath = ReadRegistry(HKEY_CLASSES_ROOT, sname & "\shell\open\command", "")
spath = Left(spath, InStr(1, spath, " ""%1""") - 1)
Shell spath & " " & """c:\progra~1\sample\sample.mde""", 3
End Sub
'----------------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top