From: Philippe Lang Date: 2010-02-25T22:39:03+09:00 Subject: Re: WIN32OLE & MS Access 2007: read-only... only? --PGP_Universal_42F970BF_3AE5A3F7_D363F582_2B3DA8B2 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: QUOTED-PRINTABLE > Hi, >=20 > With Office 2003, I am able to open through ruby an Access database, > make a few structure changes in it, and finally open a report, with > code similar to: >=20 > require 'win32ole' > access =3D WIN32OLE.new('Access.Application') > database =3D File.expand_path(') > access.OpenCurrentDatabase(database) > access.run("", "param1", "param2") > access.DoCmd.OpenReport("the_msaccess_report", 2, "", "") > access.Visible =3D true >=20 > This works fine with both the old Ruby One-Click Installer 1.8.6, and > the upcoming Ruby Installer 1.8.6 RC2, from Luis Lavena. >=20 > Unfortunately, things are getting worse with Office 2007. For an > unknown reason, database is opened *read-only*, and the command >=20 > access.run("", "param1", "param2") >=20 > ... fails, since it tries to modify the structure (a querydef in fact) > of a read-only database. >=20 > Strangely, this almost similar code rewritten in wsh: >=20 > Set objAcc =3D WScript.CreateObject("Access.Application") > strDBName =3D "" > objAcc.OpenCurrentDatabase strDBName > objAcc.run "", ", "param1", "param2" > objAcc.DoCmd.OpenReport "the_msaccess_report", 2, "", "" > objAcc.Visible =3D true >=20 > ... works perfectly. Access 2007 database is opened read-write, and > scripts executes fine. >=20 > I'm not sure who is the culprit here: Ruby/WIN32OLE? Not really, it > works fine with Office 2003. Office 2007? Hum, maybe, but it works > through WSH... >=20 > Does anyone have an idea maybe? One more precision: with this VBScript code, integrated into an HTML file, = database is opened read-write too. Only the ruby code opens the database re= ad-only... ------------------------------------------------------------- Attik System web : http://www.attiksystem.ch Philippe Lang phone: +41 26 422 13 75 rte de la Fonderie 2 gsm : +41 79 351 49 94 1700 Fribourg pgp : http://keyserver.pgp.com=20 --PGP_Universal_42F970BF_3AE5A3F7_D363F582_2B3DA8B2 Content-Type: application/pgp-signature; name="PGP.sig" Content-Transfer-Encoding: 7BIT Content-Disposition: attachment; filename="PGP.sig" -----BEGIN PGP SIGNATURE----- Version: 10.0.0 iQEVAwUBS4Z9bVVut9/n/zM8AQiNggf/UZZGTfP/UJDNl4JQFuAGNpdyxaY5CPYC 4RZwjgM+gP0zIbx243jQ42W5E4GCsTwS+Xer7nkzkwG950Xb2aIC5G5KYJCU8oNo Nf4ZSW8epK4M0fMOn3stntReAXq6i1/nAPBfnFDMDYC12oYfXOcAoDH6qwaAsEsQ O1H0Zzv+07ZUA2m4E++hjU3Q3ZNxL43o9RCg3NqDqup/KFIArIppYTcWhheVM7cB Jw6qtOyp3kO/PRxPZ1LbcPF8L9LkIMpRwYV2ZSJ4CFoGeoQsHHNHb+LE+mi7jZnh poW6OupqWVkl87ZX+IFX8gsOt8CJQXh79GGjYAGdD9bsYelJ2LFmqg== =BQke -----END PGP SIGNATURE----- --PGP_Universal_42F970BF_3AE5A3F7_D363F582_2B3DA8B2--