Home All Groups Group Topic Archive Search About

Installed version of Access

Author
26 Nov 2006 9:11 PM
reidarT
Is it possible to check what version of Acess is running / installed on a
computer from vb.net?
reidarT

Author
27 Nov 2006 1:18 AM
Sergey Poberezovskiy
Try to lookup

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.mdb default registry value

HTH
Show quoteHide quote
"reidarT" wrote:

> Is it possible to check what version of Acess is running / installed on a
> computer from vb.net?
> reidarT
>
>
>
Author
27 Nov 2006 2:05 AM
Newbie Coder
' Imports

Imports Microsoft.win32
Imports System.IO

' Add two Buttons & a TextBox to use this code:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
        If Not GetAccessVersion() = "" Then
            Dim fvi As FileVersionInfo =
FileVersionInfo.GetVersionInfo(GetAccessVersion())
            TextBox1.Text = fvi.ProductMajorPart.ToString
        Else
            MessageBox.Show("Unable to get MS Access Version", "Error", _
                MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
        Application.Exit()
    End Sub

' Function to get Access path

    Private Function GetAccessVersion() As String
        Dim reg As RegistryKey
        Dim strPath As String = ""
        Try
            reg =
Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\
App Paths\msaccess.exe", False)
            strPath = reg.GetValue("")
            Return strPath
        Catch ex As Exception
            Return ""
        Finally
            If Not reg Is Nothing Then reg.Close()
        End Try
    End Function

' That's it

' I have included the project with this post

' I hope this helps

' Newbie Coder

[attached file: Get MS Access Version.zip]