WinBatch Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: MW4 on September 03, 2015, 02:32:18 pm

Title: Access Version that opens
Post by: MW4 on September 03, 2015, 02:32:18 pm
I have a script that inserts records into an access mdb in Access 2003 format.

When I run it, it is now opening Access 2013...UGH.

I can only see this where I call access:

Access = ObjectOpen("Access.Application")

How do I set it to open and run in Access 2003
Title: Re: Access Version that opens
Post by: td on September 03, 2015, 03:16:13 pm
The following assumes you have both versions of Access on your system.

On would think that  using Access = ObjectOpen("Access.Application.11") would start Access 2003 because of the version number in the progid but it doesn't apparently work because of the way the registry is configured. 

So you might try using ObjectGet("C:\yourfolder\yourdb.mdb").   IIRC, this might work because Access 2013 files have a different default extension but I have never tried it.

Another approach would be to hack the registry to change the HKEY_CLASSES_ROOT\CLSID\{73A4C9C1-D68D-11D0-98BF-00A0C90DC8D9}\LocalServer32  or HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{73A4C9C1-D68D-11D0-98BF-00A0C90DC8D9}\LocalServer32 to point the Access exe you want to use.  You would also need to delete or rename the LocalServer32 value under one of the above keys or changing the key will not work.   Of course doing this could potentially break some things on your system and is therefore not the best of options.

Title: Re: Access Version that opens
Post by: MW4 on September 03, 2015, 03:47:27 pm
Just adding the 11 doesn't work, still opens 2013

if I use "RUN" and type in msaccess.exe it opens 2013.

If I click on a mdb file it opens up 2003 as expected.

Title: Re: Access Version that opens
Post by: td on September 04, 2015, 07:35:15 am
Just adding the 11 doesn't work, still opens 2013
To quote myself 'but it doesn't apparently work because of the way the registry is configured'.
Quote

if I use "RUN" and type in msaccess.exe it opens 2013.
You would need to specify the full path to the 2003 version's executable in order for Run to start the 2003 version.
Quote
If I click on a mdb file it opens up 2003 as expected.
That offers some hope for using the ObjectGet function with the full path to an Access 2003 'mdb' file but it depends on  how the file extension is setup in the registry.

If you have a specific database you want to work with, give the ObjectGet with a full path to the file approach a try.  If that doesn't work, you may have to resort to creating a script to temporarily modifying the registry before starting Access and then reverting the registry back after you shutdown Access.

Also, IIRC, Access places an entry in the Running Object Table but there is no guarantee that you would get the correct version using ObjectGet(,"Access.Application") because either one or both versions could be running.

Title: Re: Access Version that opens
Post by: stanl on September 05, 2015, 04:55:41 am
I have a script that inserts records into an access mdb in Access 2003 format.

If that is all you want to do, why not just use ADO and either the Jet or Ace Provider to perform the inserts. If Office 2013 is installed you have the Ace Provider and that works with either mdb or accdb extensions.
Title: Re: Access Version that opens
Post by: td on September 08, 2015, 08:01:37 am
Good point.