--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('<the_msaccess_database_name>) > access.OpenCurrentDatabase(database) > access.run("<the_msaccess_public_sub_in_vbs>", "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("<the_msaccess_public_sub_in_vbs>", "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 "<the_msaccess_database_path>" > objAcc.OpenCurrentDatabase strDBName > objAcc.run "<the_msaccess_public_sub_in_vbs>", ", "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... <HTML> <BODY> <INPUT id=3Dbutton1 name=3Dbutton1 type=3Dbutton value=3DButton> <SCRIPT LANGUAGE=3D"VBScript"> sub button1_onclick() =20 dim objAcc Set objAcc =3D createobject("Access.Application") strDBName =3D "C:\Users\Philippe Lang\Desktop\db2000.mdb" objAcc.OpenCurrentDatabase strDBName objAcc.run "get_document_lines_store", "1234", "L", "1" objAcc.DoCmd.OpenReport "rptTest", 2, "", "" objAcc.Visible =3D true end sub =20 </SCRIPT> </BODY> </HTML> ------------------------------------------------------------- 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-- > Hi, > > 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: > > require 'win32ole' > access = WIN32OLE.new('Access.Application') > database = File.expand_path('<the_msaccess_database_name>) > access.OpenCurrentDatabase(database) > access.run("<the_msaccess_public_sub_in_vbs>", "param1", "param2") > access.DoCmd.OpenReport("the_msaccess_report", 2, "", "") > access.Visible = true > > 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. > > Unfortunately, things are getting worse with Office 2007. For an > unknown reason, database is opened *read-only*, and the command > > access.run("<the_msaccess_public_sub_in_vbs>", "param1", "param2") > > ... fails, since it tries to modify the structure (a querydef in fact) > of a read-only database. > > Strangely, this almost similar code rewritten in wsh: > > Set objAcc = WScript.CreateObject("Access.Application") > strDBName = "<the_msaccess_database_path>" > objAcc.OpenCurrentDatabase strDBName > objAcc.run "<the_msaccess_public_sub_in_vbs>", ", "param1", "param2" > objAcc.DoCmd.OpenReport "the_msaccess_report", 2, "", "" > objAcc.Visible = true > > ... works perfectly. Access 2007 database is opened read-write, and > scripts executes fine. > > 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... > > 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 read-only... <HTML> <BODY> <INPUT id=button1 name=button1 type=button value=Button> <SCRIPT LANGUAGE="VBScript"> sub button1_onclick() dim objAcc Set objAcc = createobject("Access.Application") strDBName = "C:\Users\Philippe Lang\Desktop\db2000.mdb" objAcc.OpenCurrentDatabase strDBName objAcc.run "get_document_lines_store", "1234", "L", "1" objAcc.DoCmd.OpenReport "rptTest", 2, "", "" objAcc.Visible = true end sub </SCRIPT> </BODY> </HTML> ------------------------------------------------------------- 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 -----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-----