Solved

Get the ms access version

Posted on 2016-10-06
4
78 Views
Last Modified: 2016-11-27
how can i get the ms access information in the about the program in vba
thanks
0
Comment
Question by:Svgmassive
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 41832745
Use Application.Version to set a variable to the version Number


Kelvin
0
 
LVL 36

Assisted Solution

by:PatHartman
PatHartman earned 250 total points
ID: 41832748
This is a sub that I run from within a form.  You can modify it to remove the form references.  
Sub ReferenceProperties(frm As Form)
    Dim ref As Reference
    Dim db As dao.Database
    Dim TD1 As dao.TableDef
    Dim QD1 As dao.QueryDef
    Dim TS1 As dao.Recordset
    Dim strDatabase As String
    Dim ThisDB As dao.Database
    
    On Error GoTo Err_ReferenceProperties
    'strDatabase = "C:\hartman\LinkDB2.mdb"
    strDatabase = frm.txtDBName
    
    Set ThisDB = CurrentDb()
    If strDatabase = "" Then
        Set db = CurrentDb()
    Else
        Set db = DBEngine.Workspaces(0).OpenDatabase(strDatabase)
    End If
    
    db.Containers.Refresh
    
    frm.txtAccessVersion = db.Properties("AccessVersion")
    frm.txtJetVersion = db.Version
    Set QD1 = ThisDB.QueryDefs!qDeltblReferences
        QD1.Execute
    Set TD1 = ThisDB.TableDefs!tblReferences
    Set TS1 = TD1.OpenRecordset

    ' Enumerate through References collection.
    For Each ref In References
        ' Check IsBroken property.
        TS1.AddNew
        TS1!RefName = ref.Name
        TS1!RefFullPath = ref.FullPath
        TS1!RefVersion = ref.Major & "." & ref.Minor
        TS1!RefGUID = ref.Guid
        TS1!RefKind = ref.Kind
        
        If ref.IsBroken = False Then
            TS1!RefBroken = 0
            'Debug.Print "Name: ", ref.Name
            'Debug.Print "FullPath: ", ref.FullPath
            'Debug.Print "Version: ", ref.Major & "." & ref.Minor
        Else
            Debug.Print "GUIDs of broken references:"
            Debug.Print ref.Guid
            TS1!RefBroken = -1
        End If
        TS1.Update
Next ref
Exit_ReferenceProperties:
    db.Close
    Exit Sub

Err_ReferenceProperties:
    Select Case Err.Number
        Case 3043
            MsgBox "Please select a valid database", vbOKOnly
        Case 91   ' db was not opened so it cannot be closed.
            Exit Sub
        Case Else
            MsgBox Err.Number & "-" & Err.Description
    End Select
    Resume Exit_ReferenceProperties
    Resume
End Sub

Open in new window

This is the table that the references get added to.
tblReferences.JPG
One interesting anomaly that I just noticed is that the Access reference version returned by the loop is 9.0 but the version returned by db.Properties("AccessVersion") is 9.5.  I don't know why.  I am using A2016 (64-bit) to run the database this code is in but the database is an .mdb and was created in an earlier version of Access.  Probably AXP(32-bit).
0
 
LVL 20
ID: 41832947
there is also
     CurrentProject.FileFormat

Open in new window

https://msdn.microsoft.com/en-us/library/office/ff836251.aspx
0
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 250 total points
ID: 41833241
My 2 cents:
Private Sub VersionButton_Click()
Dim AccessVersion As String
Dim Msg As Variant
Dim V As String
V = SysCmd(acSysCmdAccessVer) & "." & SysCmd(715)
Select Case V
          Case "9.0.0.0000" To "9.0.0.2999": AccessVersion = "Microsoft Access 2000 - Build: " & sAccessVerNo
        Case "9.0.0.3000" To "9.0.0.3999": AccessVersion = "Microsoft Access 2000 SP1 - Build: " & V
        Case "9.0.0.4000" To "9.0.0.4999": AccessVersion = "Microsoft Access 2000 SP2 - Build: " & V
        Case "9.0.0.6000" To "9.0.0.6999": AccessVersion = "Microsoft Access 2000 SP3 - Build: " & V
        'Access 2002
        Case "10.0.2000.0" To "10.0.2999.9": AccessVersion = "Microsoft Access 2002 - Build: " & V
        Case "10.0.3000.0" To "10.0.3999.9": AccessVersion = "Microsoft Access 2002 SP1 - Build: " & V
        Case "10.0.4000.0" To "10.0.4999.9": AccessVersion = "Microsoft Access 2002 SP2 - Build: " & V
        'Access 2003
        Case "11.0.0000.0" To "11.0.5999.9999": AccessVersion = "Microsoft Access 2003 - Build: " & V
        Case "11.0.6000.0" To "11.0.6999.9999": AccessVersion = "Microsoft Access 2003 SP1 - Build: " & V
        Case "11.0.7000.0" To "11.0.7999.9999": AccessVersion = "Microsoft Access 2003 SP2 - Build: " & V
        Case "11.0.8000.0" To "11.0.8999.9999": AccessVersion = "Microsoft Access 2003 SP3 - Build: " & V
        'Access 2007
        Case "12.0.0000.0" To "12.0.5999.9999": AccessVersion = "Microsoft Access 2007 - Build: " & V
        Case "12.0.6000.0" To "12.0.6422.9999": AccessVersion = "Microsoft Access 2007 SP1 - Build: " & V
        Case "12.0.6423.0" To "12.0.5999.9999": AccessVersion = "Microsoft Access 2007 SP2 - Build: " & V
        Case "12.0.6000.0" To "12.0.9999.9999": AccessVersion = "Microsoft Access 2007 SP3 - Build:" & V
        'Access 2010
        Case "14.0.0000.0000" To "14.0.6022.1000": AccessVersion = "Microsoft Access 2010 - Build:" & V
        Case "14.0.6023.1000" To "14.0.7014.9999": AccessVersion = "Microsoft Access 2010 SP1 - Build:" & V
        Case "14.0.7015.1000" To "14.0.9999.9999": AccessVersion = "Microsoft Access 2010 SP2 - Build:" & V
        'Access 2013
        Case "15.0.0000.0000" To "15.0.4569.1505": AccessVersion = "Microsoft Access 2013 - Build:" & V
        Case "15.0.4569.1506" To "15.0.9999.9999": AccessVersion = "Microsoft Access 2013 SP1 - Build:" & V
        'Access 2016
        Case "16.0.0000.0000" To "16.0.9999.9999": AccessVersion = "Microsoft Access 2016 - Build:" & V
        Case Else: AccessVersion = "Unknown Version"
   End Select
Msg = MsgBox(AccessVersion, vbInformation)
End Sub

Open in new window

How it looks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Check a field in Access on a Timer 1 32
Access Query Top 20 from subquery 11 44
Microsoft Access 2016 Bug? 9 46
MS Access Combobox to Disable Controls on a Separate Form 10 26
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question