Solved

Script to open Access Database from Specific version of Access

Posted on 2013-10-22
10
459 Views
Last Modified: 2013-11-20
I have an Access ADP in which I have used for a long time. Since the upgrade of Office 2013 pro apparently Access 2013 no longer support ADP, Also you cannot just choose which applications in Office 2013 as you could before. I can install the older version of Access and if I right click the ADP and open with Access 2003 it will open. I however use a script to open the ADP (in the past) to force the database to open with lower security to avoid the prompts. The problem now though is that when I run this script it tries to open the ADP from Access 2013 which errors saying that Access 2013 no longer supports ADP files.

is there a way to force the script to open the ADP with Access 2003?

Const cDatabaseToOpen = "C:\Users\Username\AppData\Local\Dbase.adp"

On Error Resume Next
Dim AcApp 
Set AcApp = CreateObject("Access.Application")
If Val(AcApp.Version) >= 11 Then
    AcApp.AutomationSecurity = 1 ' msoAutomationSecurityLow
End If
AcApp.Visible = True
AcApp.OpenCurrentDatabase cDatabaseToOpen 
If AcApp.CurrentProject.FullName <> "" Then
    AcApp.UserControl = True
Else
    AcApp.Quit
    MsgBox "Failed to open '" & cDatabaseToOpen  & "'."
End I

Open in new window

0
Comment
Question by:afsfire
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 39592509
I don't think you can do this with the methods described above, but you could do it from a .bat file, perhaps.

First create a shortcut to run the .ADP file with the correct version of Access. The Target of that shortcut would be something like this:

"full path to msaccess.exe" "full path to your database"

Then create a .bat file that will launch that shortcut. The .bat file would look like this:

@echo off
Run "full path to your shortcut"

The call that .bat file with Shell:

Shell "full path to your .bat file"

However, there are known issues with running multiple versions of Access 2007 - 2013 alongside earlier versions, and I've personally had data loss issues. I would strongly suggest you come up with a different way to handle this, or move away from the .ADP platform altogether.
0
 
LVL 21
ID: 39592604
Here is one method to do what you want::       
 
How to specify which version of Access to use
http://www.everythingaccess.com/tutorials.asp?ID=How-to-specify-which-version-of-Access-to-use-for-OLE-automation

Many Access developers have multiple version of Access installed on their development machines.  This generally won't cause too many problems, however if you have combinations of Access 2000 / 2002 (XP) / 2003 then you may encounter problems when using OLE Automation trying to obtain an instance of a lower version of Access than the last version that was installed.

For example, consider the following scenario: I have a client that has Access 2000 and Access 2003 on the same machine and we need to use OLE automation to obtain an instance of Access 2000 (please note: in most circumstances Access 2003 can be used in place of Access 2000 so this scenario won't happen very often).  The normal methods will not work - for example;  Late binding: CreateObject("Access.Application.9") - Specifying the Access Version in the ProgID string will not help for Access 2000 or above - the latest version of Access that was installed will be used.
0
 

Author Comment

by:afsfire
ID: 39606495
Thanks TheHiTechCoach. I have attempted that before starting this case however it is not working for me. It still attempts to open with Access 2013.

I'll attempt the bat file approach
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39660440
I've requested that this question be deleted for the following reason:

The question has either no comments or not enough useful information to be called an "answer".
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 84
ID: 39660441
The method I suggest will definitely work.
0
 
LVL 21
ID: 39660631
LSMConsulting's  and my suggestions will work for afsfire's needs.
0
 

Author Comment

by:afsfire
ID: 39660978
Sorry got moved onto something else I'll try the bat file approach and respond today
0
 

Author Closing Comment

by:afsfire
ID: 39664282
Thanks this worked!
0
 
LVL 21
ID: 39664494
Glad to hear you found a solution.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

910 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

21 Experts available now in Live!

Get 1:1 Help Now