Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Get the ms access version

Posted on 2016-10-06
4
Medium Priority
?
250 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 39

Assisted Solution

by:PatHartman
PatHartman earned 1000 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 22
ID: 41832947
there is also
     CurrentProject.FileFormat

Open in new window

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

Accepted Solution

by:
Ferruccio Accalai earned 1000 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

618 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