Solved

Script to open Access Database from Specific version of Access

Posted on 2013-10-22
10
452 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 45

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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

706 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

13 Experts available now in Live!

Get 1:1 Help Now