Detect Version of Office within Access 2007 code

Posted on 2011-09-26
Last Modified: 2012-06-21
Based on which version of Office (2007 or 2010) that a user has installed on the local machine, I need to take certain action. Is there any easy way to detect this?
Question by:terpsichore
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
  • 3
  • 2
  • 2
  • +1
LVL 120

Accepted Solution

Rey Obrero (Capricorn1) earned 500 total points
ID: 36599834
LVL 58
ID: 36599922
There's also the SYSCMD call:

Function GetVersion() As String
' Determine the version of Microsoft Access
' used to create this application.

      GetVersion = SysCmd(acSysCmdAccessVer)

End Function

LVL 26

Expert Comment

ID: 36599929
Ditto to @capricorn1

If Application.Version > 11 Then
    'because this is the use I have for knowing if things are A2007+
    'sub in what you need
    Call SaveAsOfficePDF(stDocName)
    Exit Sub
End If

Private Sub SaveAsOfficePDF(stDocName As String)
Dim FormatValue As String
If Application.Version > 11 Then
    FormatValue = "PDF Format (*.pdf)"
    FormatValue = acFormatRTF
End If
'yes if it's RTF the file ending will be screwy--but it should never get that far anyway
DoCmd.OpenReport stDocName, acPreview
DoCmd.OutputTo acOutputReport, stDocName, FormatValue, "c:\tempPdf\" & Reports(stDocName).Caption & ".pdf"
DoCmd.Close acReport, stDocName, acSaveYes
End Sub
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.


Author Comment

ID: 36599947
just to be clear - I need the application installed on the machine, NOT the version of the application that created this Access app... please confirm solution if you would. Thanks.
LVL 58
ID: 36599956

 BTW, if you need the build number (which includes service packs and hotfixes), see the procedure here:

LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36599962
just to be clear,
what is your intention after you found the version installed on the machine?

you need to run a .bat file ?
LVL 26

Expert Comment

ID: 36599986
Application.Version detects the running version of MS Access.
It is not concerned with the mdb or Accdb file type, but rather the version of the executable.

Author Closing Comment

ID: 36600015
excellent dialog with the group, very insightful and quick.
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36600047

you could have split the points for the comments that have given you more info..

click on Request Attention and ask that the thread be reopen to allocate points properly..

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

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.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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…

687 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