in reply to Re: How to List MS Access 2007 Modules with Perl
in thread How to List MS Access 2007 Modules with Perl
Thanks
Modules collection is part of "CurrentProject." here's the OLE connection I'm making:
#!perl -w #-- code to access Ms Access objects use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft DAO'; use Win32::OLE::Const 'Microsoft ActiveX Data Objects'; my $file = q{C:\\...\\Northwind 2007.accdb}; my $appAcc = Win32::OLE->new('Access.Application', 'Quit'); my $Workspace = $appAcc->DBEngine->CreateWorkspace('', 'Admin', ''); # $appAcc->OpenCurrentDatabase my $Database = $Workspace->OpenDatabase($file); # my $Database = $appAcc->OpenCurrentDatabase($file); if (!$Database) { print Win32::OLE->LastError(), "\n"; } else { print $Database->{Name}, "\n"; print $Database->{CurrentProject}->Modules(0)->{Name}, "\n"; }
The last statement causes the error:
OLE exception from "DAO.TableDefs": Item not found in this collection. Win32::OLE(0.1709) error 0x80020009: "Exception occurred" in METHOD/PROPERTYGET "CurrentProject" at getAccessOLE.pl line 27
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to List MS Access 2007 Modules with Perl
by Corion (Patriarch) on Mar 28, 2010 at 19:40 UTC | |
|
Re^3: How to List MS Access 2007 Modules with Perl
by Mundi (Initiate) on Mar 28, 2010 at 19:44 UTC |