Link to home
Start Free TrialLog in
Avatar of JackieLee
JackieLee

asked on

Distinguishing between Access Runtime and full version.

My code needs to figure out whether or not the client's computer has had access 2000 runtime installed or not.  Is there any way I can do this in code?

I currently use the file size to distinguish between access 2000 and 97 but access 2000 runtime is exactly the same size as access 2000 full version.
Avatar of JackieLee
JackieLee

ASKER

by "file size" I refer to the file "msaccess.exe".
Did you also check upon the registry information that a runtime environment uses?

Nic;o)
I would prefer not to have to check the registry (too complicated).  I did notice however that when I right click on the access file I get a version number as part of the properties.  Can I access that information through code at runtime?
Avatar of Jim Dettman (EE MVE)
Your going to have to check the registry as the only difference between a runtime and full version for A2000 is the registry keys.

Jim.
JackieLee,

Just checkout the site:
www.mvps.com/access
There will be some registry code there and a lot of other usefull samples !

Nic;o)
You can use Me.Application.DBEngine.Version to see the version of the Access

3.0 for Access95
3.5 for Access97
and so on

Motor Microsoft Jet       
Microsoft Access      
Visual Basic      
Microsoft Excel      

Visual C++
1.0 (1992)      1.0      -      -      -
1.1 (1993)      1.1      3.0      -      -
2.0 (1994)      2.0      -      -      -
2.5 (1995)      -      4.0 (16 bits)      -      -
3.0 (1995)      ‘95 (7.0)      4.0 (32 bits)      ‘95 (7.0)      4.0, 4.1, 4.2
3.5 (1996)      ‘97 (8.0)      5.0      ‘97 (8.0)      5.0

Copyright (c) 1996 Microsoft Corporation
Why can't I use the date modified to base my investigation?  I know the date modified for the runtime I am distributing and it will never change.
Can't follow the logic then why you need the code to check for the runtime if nothing will be changed?

What if there is already a userinstalled runtime version?

Why not create a package containing all modules you need (in- or excluding the runtime) and use that to distribute your .mdb ?

Nic;o)
Carruina,

When I have access runtime installed, Me.Application.DBEngine.Version returns the same version as it does when I run it in a normal access version.

Nico,

If the user has access 97 installed and does not have access 2000 installed then after installing my runtime 2000 I am going to alter the registry so that the default link for all 23 access file types is returned to access 97.

I have the code to alter the registry.  I now need code to decide whether or not to alter the registry.

If the User has Access 97 and Runtime 2000 then
    Alter registry
If the User has Access97 and Access 2000 then
    Do Nothing
If the User has only one version of access on their machine (after installation) then
    Do Nothing

Finally:
>>Can't follow the logic then why you need the code to check for the runtime if nothing will be changed?

I did not say that nothing will be changed I said that the date modified of my access 2000 runtime does not change.
I went to this web site and got the response:
"The requested URL was not found on this server"
www.mvps.com/access
Registry settings for runtime appear to be identical to those of full access version.
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I See what you mean.  I only have one runtime installed that I know of.  There is a registry thing under Root / Licences that looks like this

73a4c9c1-D68D-11D0-98BF-00A0C90DC8D9

And under that is the word "Runtime" Inside Runtime under "Data" is the text "okpvasjwmvjfrcatkskctmtjahdnkccdgjds"

I have code that can locate this registry information for me.  What do I do with it though?

Do I search for this exact path in the clients registry?  And if I find it that means they have my runtime?

Here is what I have come up with:

'DECLARE THESE IN A CLASS MODULE
Public Property Get Value() As Variant
Dim vValue As Variant
Dim cData As Long, sData As String, ordType As Long, e As Long
Dim hKey As Long

    e = RegOpenKeyEx(m_hClassKey, m_sSectionKey, 0, KEY_QUERY_VALUE, hKey)
    'ApiRaiseIf e

    e = RegQueryValueExLong(hKey, m_sValueKey, 0&, ordType, 0&, cData)
    If e And e <> ERROR_MORE_DATA Then
        Value = m_vDefault
        Exit Property
    End If
     
    m_eValueType = ordType
    Select Case ordType
    Case REG_DWORD, REG_DWORD_LITTLE_ENDIAN
        Dim iData As Long
        e = RegQueryValueExLong(hKey, m_sValueKey, 0&, _
                               ordType, iData, cData)
        vValue = CLng(iData)
         
    Case REG_DWORD_BIG_ENDIAN  ' Unlikely, but you never know
        Dim dwData As Long
        e = RegQueryValueExLong(hKey, m_sValueKey, 0&, _
                               ordType, dwData, cData)
        vValue = SwapEndian(dwData)
         
    Case REG_SZ, REG_MULTI_SZ ' Same thing to Visual Basic
        sData = String$(cData - 1, 0)
        e = RegQueryValueExStr(hKey, m_sValueKey, 0&, _
                               ordType, sData, cData)
        vValue = sData
         
    Case REG_EXPAND_SZ
        sData = String$(cData - 1, 0)
        e = RegQueryValueExStr(hKey, m_sValueKey, 0&, _
                               ordType, sData, cData)
        vValue = ExpandEnvStr(sData)
         
    ' Catch REG_BINARY and anything else
    Case Else
        Dim abData() As Byte
        ReDim abData(cData)
        e = RegQueryValueExByte(hKey, m_sValueKey, 0&, _
                                ordType, abData(0), cData)
        vValue = abData
         
    End Select
    Value = vValue
     
End Property

Public Property Let ValueType(ByVal eValueType As ERegistryValueTypes)
    m_eValueType = eValueType
End Property

Public Property Let ClassKey( _
        ByVal eKey As ERegistryClassConstants _
    )
    m_hClassKey = eKey
End Property

Public Property Get SectionKey() As String
    SectionKey = m_sSectionKey
End Property
Public Property Let SectionKey( _
        ByVal sSectionKey As String _
    )
    m_sSectionKey = sSectionKey
End Property



'DECLARE THESE LOCALLY

Private Sub Command3_Click()
'To get a String Value from the Registry:'
'
Dim HasRuntime As Boolean
Dim HasRetail As Boolean
HasRuntime = False
HasRetail = False
HasRuntime = AccessKeySearch("Runtime")
HasRetail = AccessKeySearch("Retail")
If HasRuntime = True And HasRetail = False Then
    MsgBox "The user is running Access Runtime"
ElseIf HasRetail = True Then
    MsgBox "The user is running Access Retail"
Else
    MsgBox "The Process Failed"
End If
End Sub

Function AccessKeySearch(component As String) As Boolean
On Error GoTo err_accesskeysearch
Dim str As String
    Dim c As New cRegistry '
    With c
        .ClassKey = HKEY_CLASSES_ROOT
        .SectionKey = "Licenses\73A4C9C1-D68D-11D0-98BF-00A0C90DC8D9\" & component
        '.ValueKey = "Tip1"
        .ValueType = REG_SZ
        str = .Value
        AccessKeySearch = IIf(Len(str) = 0, False, True)
    End With
Exit Function
err_accesskeysearch:
AccessKeySearch = False
End Function
My System relies on this number: 73a4c9c1-D68D-11D0-98BF-00A0C90DC8D9  being standard throughout all versions of Access 2000

I have SR1 installed I'm fairly confident though that the same number is used by the previous release of A2000.
Here's the key's I have:

73A4C9C1-D68D-11d0-98BF-00A0C90DC8D9

8CC49940-3146-11CF-97A1-00AA00424A9F

B54DCF20-5F9C-101B-AF4E-00AA003F0F07

  The last only has a retail and I believe it's for A95 as I never installed the ADT for it.

  I believe your correct in that the first is for A2000.  The 2nd listed should be for A97.

Jim.