in reply to Re: Ms Access and win32 ole
in thread Ms Access and win32 ole
Hi Sinistral
I am now trying to open using this codeIt says invalid argument.Do we need to provide other arguments also.$oDatabase = $oAccess->DBEngine->OpenCurrentDatabase($filename);
With this code $oDatabase = $oAccess->DBEngine->OpenDatabase($filename);
It opens fine but the custom properties doesnot get added to the file's custom tab in the database properties. Is there any difference between OpenDatabase and OpenCurrentDatabase.
my $filename = 'C:\Documents and Settings\551970\Desktop\database.accd +b'; # $ARGV[0]; print $filename."\n"; $oAccess = Win32::OLE->new('Access.Application') or die qq{Couldn't st +art new Access instance!}; # Open Access File $oDatabase = $oAccess->DBEngine->OpenDatabase($filename); my $new_property = $oDatabase->Containers->Databases->Documents->User +Defined->CreateProperty("Test1",12,"Test"); $oDatabase->Containers->Databases->Documents->UserDefined->Propertie +s->Append($new_property); foreach (in $oDatabase->Containers->Databases->Documents->UserDefined- +>Properties) { #print Dumper($_); print "prop ".$_->Name."\n"; } undef $oDatabase; #undef $oAccess; $oAccess->Quit();
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Ms Access and win32 ole
by Sinistral (Monsignor) on Oct 26, 2012 at 13:50 UTC |
In Section
Seekers of Perl Wisdom