Solved

Script to open Access Database from Specific version of Access

Posted on 2013-10-22
10
476 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
[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
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 85

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 48

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 85
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Simple Linear Regression
Introduction to Processes
Suggested Courses

623 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