How to reference MS Access 2016 for use with DoCmd, etc.
-
Hi, I have a couple of windows applications that use MS Access to print reports. They were built on MS Access 2007, and worked fine until I was forced to upgrade to Office365 and thus MS Access 2016. Unfortunately (apparently) Office365's version of Office 2016 does not allow you to have other Office versions installed, so I had to remove my Access 2007 version. The simplified version of my code that worked fine until now:
Dim oAccess As Access.Application
Dim x As Long
AccessExecutablePath = New FileInfo("C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE").FullName
x = Shell(AccessExecutablePath & " " & Chr(34) & DatabasePath & Chr(34) & " /runtime", AppWinStyle.MinimizedNoFocus)
oAccess = New Access.Application
oAccess = GetObject(DatabasePath)
oAccess.PrintReport("Some_Report_Saved_In_MSACCESS")Apparently when you install Office 2016, it no longer has the necessary interop driver for Access, and the code no longer works. However, all microsoft's (I suppose outdated) documentation still says to use the code above. Here is my question: Has anyone else faced this issue, and more importantly can anyone suggest a solution, or another method to interact with the Access client? Regards, Johan
My advice is free, and you may get what you paid for.
-
Hi, I have a couple of windows applications that use MS Access to print reports. They were built on MS Access 2007, and worked fine until I was forced to upgrade to Office365 and thus MS Access 2016. Unfortunately (apparently) Office365's version of Office 2016 does not allow you to have other Office versions installed, so I had to remove my Access 2007 version. The simplified version of my code that worked fine until now:
Dim oAccess As Access.Application
Dim x As Long
AccessExecutablePath = New FileInfo("C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE").FullName
x = Shell(AccessExecutablePath & " " & Chr(34) & DatabasePath & Chr(34) & " /runtime", AppWinStyle.MinimizedNoFocus)
oAccess = New Access.Application
oAccess = GetObject(DatabasePath)
oAccess.PrintReport("Some_Report_Saved_In_MSACCESS")Apparently when you install Office 2016, it no longer has the necessary interop driver for Access, and the code no longer works. However, all microsoft's (I suppose outdated) documentation still says to use the code above. Here is my question: Has anyone else faced this issue, and more importantly can anyone suggest a solution, or another method to interact with the Access client? Regards, Johan
My advice is free, and you may get what you paid for.
Have you tried the code from this MSKB article[^]?
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Have you tried the code from this MSKB article[^]?
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Hi Richard, Thanks, I have read this article, but it only covers data access, whereas I specifically need the reports / printing functionality. The basic idea is that my access database is linked to an MS SQL database, and takes its data from there. Data access simply goes through MS SQL client. Regards, Johan
My advice is free, and you may get what you paid for.
-
Hi Richard, Thanks, I have read this article, but it only covers data access, whereas I specifically need the reports / printing functionality. The basic idea is that my access database is linked to an MS SQL database, and takes its data from there. Data access simply goes through MS SQL client. Regards, Johan
My advice is free, and you may get what you paid for.
Johan Hakkesteegt wrote:
I specifically need the reports / printing functionality.
So what's wrong with the second example, "Print or Preview an Access Report"?
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Johan Hakkesteegt wrote:
I specifically need the reports / printing functionality.
So what's wrong with the second example, "Print or Preview an Access Report"?
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Hi, Sorry, I mixed up the articles, because it mentions "...vs ADO...", and there is another article about using ADO to connect to an Access database. Anyway, my original code was written according to this article, and indeed worked fine. The problem is, that the code in this article no longer works once you install Office 2016 (at least the version that comes with Office365, if there is a difference), as apparently it does not include the Access Object Library. Regards, Johan
My advice is free, and you may get what you paid for.
-
Johan Hakkesteegt wrote:
I specifically need the reports / printing functionality.
So what's wrong with the second example, "Print or Preview an Access Report"?
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Hi Richard, It all turned out to be an installation issue with Office. After an online repair of my Office 2016 installation, the references were back, and my code ran just fine again. Thanks for your help though. Regards, Johan
My advice is free, and you may get what you paid for.
-
Hi Richard, It all turned out to be an installation issue with Office. After an online repair of my Office 2016 installation, the references were back, and my code ran just fine again. Thanks for your help though. Regards, Johan
My advice is free, and you may get what you paid for.
Johan Hakkesteegt wrote:
It all turned out to be an installation issue with Office.
and this is why most of us do not use office. Office and access are great tool but should be used for individual productivity not a developed application. MS has a track record of breaking office.
Never underestimate the power of human stupidity RAH
-
Johan Hakkesteegt wrote:
It all turned out to be an installation issue with Office.
and this is why most of us do not use office. Office and access are great tool but should be used for individual productivity not a developed application. MS has a track record of breaking office.
Never underestimate the power of human stupidity RAH
No argument here. I just use Access because it happens to be in Office anyway, and I have neither budget to purchase any better tools, nor the time to build my own.
My advice is free, and you may get what you paid for.
-
Hi, I have a couple of windows applications that use MS Access to print reports. They were built on MS Access 2007, and worked fine until I was forced to upgrade to Office365 and thus MS Access 2016. Unfortunately (apparently) Office365's version of Office 2016 does not allow you to have other Office versions installed, so I had to remove my Access 2007 version. The simplified version of my code that worked fine until now:
Dim oAccess As Access.Application
Dim x As Long
AccessExecutablePath = New FileInfo("C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE").FullName
x = Shell(AccessExecutablePath & " " & Chr(34) & DatabasePath & Chr(34) & " /runtime", AppWinStyle.MinimizedNoFocus)
oAccess = New Access.Application
oAccess = GetObject(DatabasePath)
oAccess.PrintReport("Some_Report_Saved_In_MSACCESS")Apparently when you install Office 2016, it no longer has the necessary interop driver for Access, and the code no longer works. However, all microsoft's (I suppose outdated) documentation still says to use the code above. Here is my question: Has anyone else faced this issue, and more importantly can anyone suggest a solution, or another method to interact with the Access client? Regards, Johan
My advice is free, and you may get what you paid for.
Hai Johan, Me too faced the same problem recently, with excel 2013 and I fixed that by installing Office 2013 PIA (Primary Interop Assemblies). So here I strongly suggest you to install office 2016 PIA, which you can directly download from Microsoft official site. To know more about Microsoft Office PIA please refer: Office Primary Interop Assemblies[^]
Thanks and regards Ashwin 😃