Solved

Script to open Access Database from Specific version of Access

Posted on 2013-10-22
10
465 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:Bill Warren
  • 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:Bill Warren
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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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
 
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:Bill Warren
ID: 39660978
Sorry got moved onto something else I'll try the bat file approach and respond today
0
 

Author Closing Comment

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

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

808 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