Hi Sinistral
I am now trying to open using this code
$oDatabase = $oAccess->DBEngine->OpenCurrentDatabase($filename);
It says invalid argument.Do we need to provide other arguments also.
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();
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|