Solved

Get the ms access version

Posted on 2016-10-06
4
33 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
4 Comments
 
LVL 22

Expert Comment

by:Kelvin Sparks
Comment Utility
Use Application.Version to set a variable to the version Number


Kelvin
0
 
LVL 34

Assisted Solution

by:PatHartman
PatHartman earned 250 total points
Comment Utility
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 18
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now