Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Script to open Access Database from Specific version of Access

Posted on 2013-10-22
10
Medium Priority
?
485 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 2000 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 top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 
LVL 49

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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

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.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Six Sigma Control Plans
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

705 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